added my Recipes
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
From ff5e1a662ba93ba79e2aeaaaec48a2a8ec4b4701 Mon Sep 17 00:00:00 2001
|
||||
From: Yi Zhao <yi.zhao@windriver.com>
|
||||
Date: Thu, 31 Mar 2022 22:22:44 +0800
|
||||
Subject: [PATCH] Guard against __GLIBC_PREREQ for musl libc
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
|
||||
---
|
||||
src/install/util.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/install/util.c b/src/install/util.c
|
||||
index 5721de89..784aec48 100644
|
||||
--- a/src/install/util.c
|
||||
+++ b/src/install/util.c
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "util.h"
|
||||
|
||||
+#if defined(__GLIBC__)
|
||||
#if __GLIBC_PREREQ(2, 30) == 0
|
||||
#include <sys/syscall.h>
|
||||
#ifndef SYS_gettid
|
||||
@@ -35,6 +36,7 @@
|
||||
|
||||
#define gettid() ((pid_t) syscall(SYS_gettid))
|
||||
#endif /*__GLIBC_PREREQ */
|
||||
+#endif /*__GLIBC__*/
|
||||
|
||||
size_t page_size(void)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 7f8ef553b7c433af153d48c6a16b2943780abf67 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 31 Dec 2022 14:41:52 -0800
|
||||
Subject: [PATCH] install: Do not undef _FILE_OFFSET_BITS
|
||||
|
||||
_FILE_OFFSET_BITS is a feature test macro to determine largefile
|
||||
support. Usually its set to 64 on systems supporting LFS. Its also
|
||||
needed to be set to 64 for supporting 64bit time_t on glibc on 32bit
|
||||
systems. If its undefined explicitly, then 64bit time_t can not be
|
||||
enabled.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/dracutdevs/dracut/pull/2157]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
src/install/dracut-install.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c
|
||||
index dda0caca..05a67a03 100644
|
||||
--- a/src/install/dracut-install.c
|
||||
+++ b/src/install/dracut-install.c
|
||||
@@ -22,7 +22,6 @@
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
-#undef _FILE_OFFSET_BITS
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
--
|
||||
2.39.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 9f7740c4c2fda64029c23674e9858ce8bd4367df Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Thu, 13 Jul 2017 17:14:05 -0700
|
||||
Subject: [PATCH] util.h: include <sys/reg.h> when libc != glibc
|
||||
|
||||
For musl libc it is required to include <sys/reg.h> to
|
||||
have __WORDSIZE defined to e.g. 32 for arm*-musl.
|
||||
|
||||
Taken from void-linux
|
||||
https://github.com/voidlinux/void-packages/blob/master/srcpkgs/dracut/patches/musl-__wordsize.patch
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
src/install/util.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/install/util.h b/src/install/util.h
|
||||
index a6f9a184..82732913 100644
|
||||
--- a/src/install/util.h
|
||||
+++ b/src/install/util.h
|
||||
@@ -36,6 +36,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/resource.h>
|
||||
+#if !defined(__GLIBC__)
|
||||
+#include <sys/reg.h>
|
||||
+#endif
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
SUMMARY = "Initramfs generator using udev"
|
||||
HOMEPAGE = "https://dracut.wiki.kernel.org/index.php/Main_Page"
|
||||
DESCRIPTION = "Dracut is an event driven initramfs infrastructure. dracut (the tool) is used to create an initramfs image by copying tools and files from an installed system and combining it with the dracut framework, usually found in /usr/lib/dracut/modules.d."
|
||||
|
||||
LICENSE = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
|
||||
|
||||
PE = "1"
|
||||
|
||||
SRCREV = "631d5f72a223288aa1f48bb8e8d0313e75947400"
|
||||
SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http;branch=master \
|
||||
file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \
|
||||
file://0001-Guard-against-__GLIBC_PREREQ-for-musl-libc.patch \
|
||||
file://0001-install-Do-not-undef-_FILE_OFFSET_BITS.patch \
|
||||
"
|
||||
|
||||
DEPENDS += "kmod"
|
||||
DEPENDS:append:libc-musl = " fts"
|
||||
|
||||
inherit bash-completion pkgconfig
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
EXTRA_OECONF = "--prefix=${prefix} \
|
||||
--libdir=${prefix}/lib \
|
||||
--datadir=${datadir} \
|
||||
--sysconfdir=${sysconfdir} \
|
||||
--sbindir=${sbindir} \
|
||||
--disable-documentation \
|
||||
--bindir=${bindir} \
|
||||
--includedir=${includedir} \
|
||||
--localstatedir=${localstatedir} \
|
||||
"
|
||||
|
||||
# RDEPEND on systemd optionally
|
||||
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
|
||||
PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,,,systemd"
|
||||
|
||||
EXTRA_OEMAKE += 'libdir=${prefix}/lib LDLIBS="${LDLIBS}"'
|
||||
|
||||
CFLAGS:append = " -fPIC"
|
||||
LDLIBS:append:libc-musl = " -lfts"
|
||||
|
||||
do_configure() {
|
||||
./configure ${EXTRA_OECONF}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
oe_runmake install DESTDIR=${D}
|
||||
# Its Makefile uses cp -arx to install modules.d, so fix the owner
|
||||
# to root:root
|
||||
chown -R root:root ${D}/${prefix}/lib/dracut/modules.d
|
||||
}
|
||||
|
||||
FILES:${PN} += "${prefix}/lib/kernel \
|
||||
${prefix}/lib/dracut \
|
||||
${systemd_unitdir} \
|
||||
"
|
||||
FILES:${PN}-dbg += "${prefix}/lib/dracut/.debug"
|
||||
|
||||
CONFFILES:${PN} += "${sysconfdir}/dracut.conf"
|
||||
|
||||
RDEPENDS:${PN} = "findutils cpio util-linux-blkid util-linux-getopt util-linux bash ldd"
|
||||
|
||||
# This could be optimized a bit, but let's avoid non-booting systems :)
|
||||
RRECOMMENDS:${PN} = " \
|
||||
kernel-modules \
|
||||
busybox \
|
||||
coreutils \
|
||||
"
|
||||
|
||||
# CVE-2010-4176 affects only Fedora
|
||||
CVE_CHECK_IGNORE += "CVE-2010-4176"
|
||||
@@ -0,0 +1,78 @@
|
||||
From 7a72139d2e3cc80f64090a823afe7bcea76e4792 Mon Sep 17 00:00:00 2001
|
||||
From: Jackie Huang <jackie.huang@windriver.com>
|
||||
Date: Tue, 4 Aug 2015 23:54:41 -0700
|
||||
Subject: [PATCH] rename grub2-editenv to grub-editenv
|
||||
|
||||
We don't use the name grub2-editenv for grub2.
|
||||
|
||||
Upstream-Status: Inactive-Upstream [lastcommit: 2022 lastrelease: 2016]
|
||||
|
||||
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
|
||||
---
|
||||
grubby.c | 4 ++--
|
||||
test.sh | 8 ++++----
|
||||
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index 98c1516..be832f6 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -301,7 +301,7 @@ static char *grub2GetEnv(struct configFileInfo *info, char *name)
|
||||
char *ret = NULL;
|
||||
char *envFile = info->envFile ? info->envFile : "/boot/grub2/grubenv";
|
||||
int rc =
|
||||
- asprintf(&s, "grub2-editenv %s list | grep '^%s='", envFile, name);
|
||||
+ asprintf(&s, "grub-editenv %s list | grep '^%s='", envFile, name);
|
||||
|
||||
if (rc < 0)
|
||||
return NULL;
|
||||
@@ -373,7 +373,7 @@ static int grub2SetEnv(struct configFileInfo *info, char *name, char *value)
|
||||
if (!value)
|
||||
return -1;
|
||||
|
||||
- rc = asprintf(&s, "grub2-editenv %s set '%s=%s'", envFile, name, value);
|
||||
+ rc = asprintf(&s, "grub-editenv %s set '%s=%s'", envFile, name, value);
|
||||
free(value);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
diff --git a/test.sh b/test.sh
|
||||
index 33d24cf..009479c 100755
|
||||
--- a/test.sh
|
||||
+++ b/test.sh
|
||||
@@ -573,7 +573,7 @@ if [ "$testgrub2" == "y" ]; then
|
||||
--remove-kernel=/boot/vmlinuz-2.6.38.2-9.fc15.x86_64 \
|
||||
--boot-filesystem=/boot/
|
||||
commandTest "saved_default output" \
|
||||
- "grub2-editenv test/grub2-support_files/env_temp list" \
|
||||
+ "grub-editenv test/grub2-support_files/env_temp list" \
|
||||
"saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64"
|
||||
|
||||
# copy a stanza and add arguments as well, while using --set-index=
|
||||
@@ -627,7 +627,7 @@ if [ "$testgrub2" == "y" ]; then
|
||||
--title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
|
||||
--copy-default
|
||||
commandTest "saved_default output" \
|
||||
- "grub2-editenv test/grub2-support_files/env_temp list" \
|
||||
+ "grub-editenv test/grub2-support_files/env_temp list" \
|
||||
"saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64"
|
||||
|
||||
testing="GRUB2 add kernel with default=saved_entry and a terrible title"
|
||||
@@ -640,13 +640,13 @@ if [ "$testgrub2" == "y" ]; then
|
||||
testing="GRUB2 set default with default=saved_entry and a terrible name"
|
||||
grub2Test grub2.9 add/g2-1.9 --env grubenv.1 --set-default-index=0
|
||||
commandTest "saved_default output" \
|
||||
- "grub2-editenv test/grub2-support_files/env_temp list" \
|
||||
+ "grub-editenv test/grub2-support_files/env_temp list" \
|
||||
'saved_entry=Fedora (3.10.3-300.fc19.x86_64) 19 (Schrödinger’s Cat)'
|
||||
|
||||
testing="GRUB2 set default with default=saved_entry"
|
||||
grub2Test grub2.8 add/g2-1.8 --env grubenv.1 --set-default-index=0
|
||||
commandTest "saved_default output" \
|
||||
- "grub2-editenv test/grub2-support_files/env_temp list" \
|
||||
+ "grub-editenv test/grub2-support_files/env_temp list" \
|
||||
"saved_entry=title"
|
||||
|
||||
testing="GRUB2 --default-index with default=saved_entry"
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From c02d1bf46174656cdb6f7c08fa3e8fa520edcd8e Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 15 Jul 2017 10:19:22 -0700
|
||||
Subject: [PATCH] Add another variable LIBS to provides libraries from env
|
||||
|
||||
Upstream-Status: Inactive-Upstream [lastcommit: 2022 lastrelease: 2016]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
Makefile | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 968c276..75abe44 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -31,7 +31,8 @@ ifneq ($(VERBOSE_TEST),)
|
||||
VERBOSE_TEST="--verbose"
|
||||
endif
|
||||
|
||||
-grubby_LIBS = -lblkid -lpopt
|
||||
+grubby_LIBS = -lblkid -lpopt ${LIBS}
|
||||
+rpm-sort_LIBS = ${LIBS}
|
||||
|
||||
all: grubby rpm-sort
|
||||
|
||||
@@ -63,7 +64,7 @@ grubby:: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(grubby_LIBS)
|
||||
|
||||
rpm-sort::rpm-sort.o
|
||||
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpmio
|
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpmio $(rpm-sort_LIBS)
|
||||
|
||||
clean:
|
||||
rm -f *.o grubby rpm-sort *~
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 7e68976eb6edd766471c11382f5bf57940ba9315 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 15 Jul 2017 10:19:50 -0700
|
||||
Subject: [PATCH] include paths.h for _PATH_MOUNTED
|
||||
|
||||
Upstream-Status: Inactive-Upstream [lastcommit: 2022 lastrelease: 2016]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
grubby.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index be832f6..4825797 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <libgen.h>
|
||||
#include <execinfo.h>
|
||||
#include <signal.h>
|
||||
+#include <paths.h>
|
||||
#include <blkid/blkid.h>
|
||||
|
||||
#include "log.h"
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 45bc228090b3adfc0a5058b9cd019d91831e110a Mon Sep 17 00:00:00 2001
|
||||
From: Yi Zhao <yi.zhao@windriver.com>
|
||||
Date: Tue, 3 Jan 2023 13:59:48 +0800
|
||||
Subject: [PATCH] rpm-sort: include string.h for strverscmp
|
||||
|
||||
Include string.h to fix build error:
|
||||
rpm-sort.c: In function 'package_version_compare':
|
||||
rpm-sort.c:156:13: error: 'strverscmp' undeclared (first use in this function)
|
||||
156 | cmp = strverscmp;
|
||||
| ^~~~~~~~~~
|
||||
|
||||
Upstream-Status: Inactive-Upstream [lastcommit: 2022 lastrelease: 2016]
|
||||
|
||||
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
|
||||
---
|
||||
rpm-sort.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/rpm-sort.c b/rpm-sort.c
|
||||
index f196356..2eb91ce 100644
|
||||
--- a/rpm-sort.c
|
||||
+++ b/rpm-sort.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <argp.h>
|
||||
#include <rpm/rpmlib.h>
|
||||
#include <err.h>
|
||||
+#include <string.h>
|
||||
|
||||
typedef enum {
|
||||
RPMNVRCMP,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
./test.sh -v
|
||||
@@ -0,0 +1,46 @@
|
||||
SUMMARY = "A command line tool for updating and displaying info about boot loaders"
|
||||
DESCRIPTION = "grubby is a command line tool for updating and displaying information \
|
||||
about the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc) and \
|
||||
zipl (s390) boot loaders. It is primarily designed to be used from scripts which install \
|
||||
new kernels and need to find information about the current boot environment. \
|
||||
"
|
||||
HOMEPAGE = "https://github.com/rhboot/grubby"
|
||||
LICENSE = "GPL-2.0-or-later"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a"
|
||||
|
||||
DEPENDS = "popt util-linux rpm"
|
||||
DEPENDS:append:libc-musl = " libexecinfo argp-standalone"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
SRCREV = "c01b0d5bb182bde35b464d14996acf354a3ada2e"
|
||||
SRC_URI = "git://github.com/rhboot/grubby.git;protocol=https;;branch=main \
|
||||
file://0001-rename-grub2-editenv-to-grub-editenv.patch \
|
||||
file://0002-Add-another-variable-LIBS-to-provides-libraries-from.patch \
|
||||
file://0003-include-paths.h-for-_PATH_MOUNTED.patch \
|
||||
file://0004-rpm-sort-include-string.h-for-strverscmp.patch \
|
||||
file://run-ptest \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN} += "dracut"
|
||||
|
||||
inherit autotools-brokensep ptest
|
||||
|
||||
EXTRA_OEMAKE = "-e 'CC=${CC}' 'LDFLAGS=${LDFLAGS}' 'LIBS=${LIBS}'"
|
||||
|
||||
LIBS:libc-musl = "-lexecinfo -largp"
|
||||
LIBS ?= ""
|
||||
do_install_ptest() {
|
||||
install -d ${D}${PTEST_PATH}
|
||||
cp -r ${S}/test ${S}/test.sh ${D}${PTEST_PATH}
|
||||
sed -i 's|./grubby|grubby|' ${D}${PTEST_PATH}/test.sh
|
||||
}
|
||||
|
||||
RDEPENDS:${PN} += "bash"
|
||||
RDEPENDS:${PN}-ptest = "util-linux-getopt bash"
|
||||
|
||||
inherit update-alternatives
|
||||
ALTERNATIVE:${PN} = "installkernel"
|
||||
ALTERNATIVE_LINK_NAME[installkernel] = "${sbindir}/installkernel"
|
||||
|
||||
COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)'
|
||||
@@ -0,0 +1,83 @@
|
||||
From 57e3a60b23891905733bfea7a1cb78c2377cc524 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 9 Jul 2017 15:17:29 -0700
|
||||
Subject: [PATCH] Define in_* structs for non-glibc system libs
|
||||
|
||||
These defines and structs are required to be coming from
|
||||
userspace netinet/in.h, which is being overridden in klibc
|
||||
however, libc-compat.h from kernel is only written keeping
|
||||
glibc in mind, and does not provide adequate guards for musl
|
||||
to infer that these structs should be defined in linux/in.h
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
usr/include/net/if.h | 11 +++++++++++
|
||||
usr/include/netinet/in.h | 36 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 47 insertions(+)
|
||||
|
||||
--- a/usr/include/net/if.h
|
||||
+++ b/usr/include/net/if.h
|
||||
@@ -1,6 +1,17 @@
|
||||
#ifndef _NET_IF_H
|
||||
#define _NET_IF_H
|
||||
|
||||
+#ifndef __GLIBC__
|
||||
+#include <linux/libc-compat.h>
|
||||
+#undef __UAPI_DEF_IF_IFREQ
|
||||
+#define __UAPI_DEF_IF_IFREQ 1
|
||||
+#undef __UAPI_DEF_IF_IFNAMSIZ
|
||||
+#define __UAPI_DEF_IF_IFNAMSIZ 1
|
||||
+#undef __UAPI_DEF_IF_IFMAP
|
||||
+#define __UAPI_DEF_IF_IFMAP 1
|
||||
+#undef __UAPI_DEF_IF_NET_DEVICE_FLAGS
|
||||
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <linux/if.h>
|
||||
--- a/usr/include/netinet/in.h
|
||||
+++ b/usr/include/netinet/in.h
|
||||
@@ -5,6 +5,42 @@
|
||||
#ifndef _NETINET_IN_H
|
||||
#define _NETINET_IN_H
|
||||
|
||||
+#ifndef __GLIBC__
|
||||
+#include <linux/libc-compat.h>
|
||||
+
|
||||
+#undef __UAPI_DEF_IN_ADDR
|
||||
+#undef __UAPI_DEF_IN_IPPROTO
|
||||
+#undef __UAPI_DEF_IN_PKTINFO
|
||||
+#undef __UAPI_DEF_IP_MREQ
|
||||
+#undef __UAPI_DEF_SOCKADDR_IN
|
||||
+#undef __UAPI_DEF_IN_CLASS
|
||||
+#undef __UAPI_DEF_IN6_ADDR
|
||||
+#undef __UAPI_DEF_IN6_ADDR_ALT
|
||||
+#undef __UAPI_DEF_SOCKADDR_IN6
|
||||
+#undef __UAPI_DEF_IPV6_MREQ
|
||||
+#undef __UAPI_DEF_IPPROTO_V6
|
||||
+#undef __UAPI_DEF_IPV6_OPTIONS
|
||||
+#undef __UAPI_DEF_IN6_PKTINFO
|
||||
+#undef __UAPI_DEF_IP6_MTUINFO
|
||||
+#undef __UAPI_DEF_IF_IFREQ
|
||||
+
|
||||
+#define __UAPI_DEF_IN_ADDR 1
|
||||
+#define __UAPI_DEF_IN_IPPROTO 1
|
||||
+#define __UAPI_DEF_IN_PKTINFO 1
|
||||
+#define __UAPI_DEF_IP_MREQ 1
|
||||
+#define __UAPI_DEF_SOCKADDR_IN 1
|
||||
+#define __UAPI_DEF_IN_CLASS 1
|
||||
+#define __UAPI_DEF_IN6_ADDR 1
|
||||
+#define __UAPI_DEF_IN6_ADDR_ALT 1
|
||||
+#define __UAPI_DEF_SOCKADDR_IN6 1
|
||||
+#define __UAPI_DEF_IPV6_MREQ 1
|
||||
+#define __UAPI_DEF_IPPROTO_V6 1
|
||||
+#define __UAPI_DEF_IPV6_OPTIONS 1
|
||||
+#define __UAPI_DEF_IN6_PKTINFO 1
|
||||
+#define __UAPI_DEF_IP6_MTUINFO 1
|
||||
+#define __UAPI_DEF_IF_IFREQ 1
|
||||
+#endif
|
||||
+
|
||||
#include <sys/types.h>
|
||||
#include <klibc/extern.h>
|
||||
#include <stdint.h>
|
||||
@@ -0,0 +1,28 @@
|
||||
From 63ab5102d6ef362a597941e62470bf19e6f1652b Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 11 Jul 2017 08:09:52 -0700
|
||||
Subject: [PATCH] always use bfd linker
|
||||
|
||||
its possible that distros choose to default to gold linker
|
||||
therefore explicitly asking for bfd linker would fix the
|
||||
linking issues on such distros
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index dc10fc5..40647be 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -20,7 +20,7 @@ include $(srctree)/scripts/Kbuild.include
|
||||
KLIBCROSS ?= $(CROSS_COMPILE)
|
||||
export KLIBCROSS
|
||||
export CC := $(KLIBCROSS)gcc
|
||||
-export LD := $(KLIBCROSS)ld
|
||||
+export LD := $(KLIBCROSS)ld.bfd
|
||||
export AR := $(KLIBCROSS)ar
|
||||
export RANLIB := $(KLIBCROSS)ranlib
|
||||
export STRIP := $(KLIBCROSS)strip
|
||||
@@ -0,0 +1,27 @@
|
||||
From ebd2b0e414c98467156b961abb470b5d07f37ea8 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Fri, 29 Sep 2017 23:11:53 -0700
|
||||
Subject: [PATCH] arm: Do not set a fallback march and mtune
|
||||
|
||||
In OE we pass the options explicitly, there is
|
||||
no need to set it inside the makefiles, we will
|
||||
need to compute values for CPU_ARCH and CPU_TUNE
|
||||
which is a bit harder in OE
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
usr/klibc/arch/arm/MCONFIG | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/usr/klibc/arch/arm/MCONFIG
|
||||
+++ b/usr/klibc/arch/arm/MCONFIG
|
||||
@@ -10,7 +10,7 @@
|
||||
CPU_ARCH ?= armv4
|
||||
CPU_TUNE ?= strongarm
|
||||
|
||||
-KLIBCOPTFLAGS += -Os -march=$(CPU_ARCH) -mtune=$(CPU_TUNE)
|
||||
+KLIBCOPTFLAGS += -Os
|
||||
KLIBCBITSIZE = 32
|
||||
KLIBCREQFLAGS += -fno-exceptions
|
||||
KLIBCSTRIPFLAGS += -R .ARM.exidx
|
||||
@@ -0,0 +1,34 @@
|
||||
From a33c262f828f803fffdad8e1f44d524dc9c75856 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Hutchings <ben@decadent.org.uk>
|
||||
Date: Wed, 3 Aug 2022 01:10:01 +0200
|
||||
Subject: [PATCH] fcntl: Fix build failure for some architectures with Linux
|
||||
5.19
|
||||
|
||||
Starting from Linux 5.19, the kernel UAPI headers now only define
|
||||
__ARCH_FLOCK64_PAD if the architecture actually needs padding in
|
||||
struct flock64. Wrap its use with #ifdef,
|
||||
|
||||
Upstream-Status: Backport [https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=bb2fde5ddbc18a2e7795ca4d24759230c2aae9d0]
|
||||
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
usr/include/fcntl.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/usr/include/fcntl.h b/usr/include/fcntl.h
|
||||
index ed703a6..cb2e4e5 100644
|
||||
--- a/usr/include/fcntl.h
|
||||
+++ b/usr/include/fcntl.h
|
||||
@@ -33,7 +33,9 @@ struct flock {
|
||||
__kernel_loff_t l_start;
|
||||
__kernel_loff_t l_len;
|
||||
__kernel_pid_t l_pid;
|
||||
+#ifdef __ARCH_FLOCK64_PAD
|
||||
__ARCH_FLOCK64_PAD
|
||||
+#endif
|
||||
};
|
||||
|
||||
#ifdef F_GETLK64
|
||||
--
|
||||
2.37.2
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From d966d52d1e569cbc2293d841285e2b8941f28c61 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 9 Jul 2017 15:56:28 -0700
|
||||
Subject: [PATCH] include linux/sysinfo.h directly
|
||||
|
||||
This is done to avoid the kernel header linux/kernel.h to use
|
||||
__GLIBC__ define to decide on if libc implements sysinfo() API
|
||||
or not. Kernel headers should be independent of such assumptions
|
||||
but until its done in right place, change the local header
|
||||
override to avoid this assumption
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
usr/include/sys/sysinfo.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/usr/include/sys/sysinfo.h
|
||||
+++ b/usr/include/sys/sysinfo.h
|
||||
@@ -6,7 +6,7 @@
|
||||
#define _SYS_SYSINFO_H
|
||||
|
||||
#include <sys/types.h>
|
||||
-#include <linux/kernel.h>
|
||||
+#include <linux/sysinfo.h>
|
||||
|
||||
extern int sysinfo(struct sysinfo *info);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From cdc6edc2cfcd0ce88d6e66654d605dad303b1a75 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 11 Sep 2018 17:03:36 -0700
|
||||
Subject: [PATCH] klibc/Kbuild: Accept EXTRA_KLIBCAFLAGS
|
||||
|
||||
For passing additional assembler flags
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
usr/klibc/Kbuild | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/usr/klibc/Kbuild
|
||||
+++ b/usr/klibc/Kbuild
|
||||
@@ -183,7 +183,8 @@ $(SOHASH): $(SOLIB) $(SOLIB).hash
|
||||
targets += interp.o
|
||||
|
||||
quiet_cmd_interp = BUILD $@
|
||||
- cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__ \
|
||||
+ cmd_interp = $(KLIBCCC) $(klibccflags) $(EXTRA_KLIBCAFLAGS) \
|
||||
+ -D__ASSEMBLY__ \
|
||||
-DLIBDIR=\"$(SHLIBDIR)\" \
|
||||
-DSOHASH=\"$(SOLIBHASH)\" \
|
||||
$(KLIBCSTACKFLAGS) \
|
||||
@@ -0,0 +1,22 @@
|
||||
From e4d5d5224609d7d5c824dd231f5baec868befdfa Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Tue, 4 Sep 2018 23:56:00 +0200
|
||||
Subject: [PATCH 1/1] klibc: add getrandom() syscall
|
||||
|
||||
needed by latest kexec-tools for qemuarm64 (kashan)
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
---
|
||||
usr/klibc/SYSCALLS.def | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/usr/klibc/SYSCALLS.def
|
||||
+++ b/usr/klibc/SYSCALLS.def
|
||||
@@ -275,6 +275,7 @@ int syslog::klogctl(int, char *, int);
|
||||
int sysinfo(struct sysinfo *);
|
||||
long kexec_load(void *, unsigned long, struct kexec_segment *, unsigned long);
|
||||
<x86_64,ppc64,s390x> long kexec_file_load(int, int, unsigned long, const char *, unsigned long);
|
||||
+ssize_t getrandom(void *, size_t, unsigned int);
|
||||
|
||||
/*
|
||||
* Low-level I/O (generally architecture-specific);
|
||||
@@ -0,0 +1,22 @@
|
||||
From 90683d5eaabfa684a71411d6e3262153ac191ad8 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Tue, 4 Sep 2018 23:44:30 +0200
|
||||
Subject: [PATCH 1/1] klibc_2.0.4: add kexec_file_load syscall
|
||||
|
||||
for supported archs only (matched in kexec-tools)
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
---
|
||||
usr/klibc/SYSCALLS.def | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/usr/klibc/SYSCALLS.def
|
||||
+++ b/usr/klibc/SYSCALLS.def
|
||||
@@ -274,6 +274,7 @@ int reboot::__reboot(int, int, int, void
|
||||
int syslog::klogctl(int, char *, int);
|
||||
int sysinfo(struct sysinfo *);
|
||||
long kexec_load(void *, unsigned long, struct kexec_segment *, unsigned long);
|
||||
+<x86_64,ppc64,s390x> long kexec_file_load(int, int, unsigned long, const char *, unsigned long);
|
||||
|
||||
/*
|
||||
* Low-level I/O (generally architecture-specific);
|
||||
@@ -0,0 +1,27 @@
|
||||
From cf97079009ba48d10e52052b2eab7461ea4dd09b Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 10 Jul 2017 20:42:50 -0700
|
||||
Subject: [PATCH] mkfifo: Implement mkfifo
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
usr/utils/mkfifo.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/usr/utils/mkfifo.c b/usr/utils/mkfifo.c
|
||||
index 5a758b2..f1f577e 100644
|
||||
--- a/usr/utils/mkfifo.c
|
||||
+++ b/usr/utils/mkfifo.c
|
||||
@@ -26,6 +26,11 @@ static int make_fifo(char *dir)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int mkfifo (const char *__p, mode_t __m)
|
||||
+{
|
||||
+ return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t) 0);
|
||||
+}
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int c, ret = 0;
|
||||
@@ -0,0 +1,47 @@
|
||||
From 911130ce429cbf6a92d0fbd17f0ff638ec941df2 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Ovtchenkov <ptr@void-ptr.info>
|
||||
Date: Sun, 7 Feb 2021 00:04:36 -0800
|
||||
Subject: [PATCH] workaround for overlapping sections in binary
|
||||
|
||||
Problem: binary (typesize.bin) created from object file (typesize.o)
|
||||
with 'objcopy -O binary ... '. But typesize.o has relocatable objects that all
|
||||
copied with offset 0. This will lead to overlapping sections in binary.
|
||||
By fortunate syscalls.pl check magic bytes and ring the bell.
|
||||
|
||||
This is naive workaround: skip .note.gnu.property section that overlap
|
||||
.rodata section.
|
||||
|
||||
This not a bug of objcopy, https://sourceware.org/bugzilla/show_bug.cgi?id=27314
|
||||
|
||||
Related commit:
|
||||
|
||||
commit de6f630e6be90d6d32d8bf2fed3f856b0c32f7ba
|
||||
Author: H. Peter Anvin <hpa at zytor.com>
|
||||
Date: Sat Jun 10 11:15:19 2006 -0700
|
||||
|
||||
[klibc] Detect the sizes of various types, and make available to sysstub.ph.
|
||||
|
||||
This additional code effectively queries the C compiler for the sizes of
|
||||
various types, and makes an associative array %typesize available to
|
||||
sysstub.ph. This is currently not used, but it's expected that some
|
||||
architectures, e.g. s390, will need this to determine which registers
|
||||
go where, and how many registers are needed.
|
||||
|
||||
Upstream-Status: Submitted [https://lists.zytor.com/archives/klibc/2021-February/004583.html]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
usr/klibc/syscalls/Kbuild | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/usr/klibc/syscalls/Kbuild
|
||||
+++ b/usr/klibc/syscalls/Kbuild
|
||||
@@ -71,7 +71,7 @@ $(obj)/typesize.c: $(srctree)/$(KLIBCSRC
|
||||
|
||||
# Convert typesize.o to typesize.bin
|
||||
quiet_cmd_mkbin = OBJCOPY $@
|
||||
- cmd_mkbin = $(KLIBCOBJCOPY) -O binary --only-section .rodata $< $@
|
||||
+ cmd_mkbin = $(KLIBCOBJCOPY) -O binary --remove-section .note.gnu.property $< $@
|
||||
|
||||
$(obj)/typesize.bin: $(obj)/typesize.o FORCE
|
||||
$(call if_changed,mkbin)
|
||||
@@ -0,0 +1,24 @@
|
||||
From d2fb484d995221277cce7abddcd7dfa0e8bceec3 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Fri, 11 Jan 2013 17:26:40 +0000
|
||||
Subject: [PATCH] klibc_2.0.2: apply FIX_V4BX patch for armv4 targets only
|
||||
|
||||
Status: not applicable upstream, in OE/Yocto we use $(FIX_V4BX)
|
||||
which is "" in case of armv5 or thumbs.
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
|
||||
---
|
||||
usr/klibc/arch/arm/MCONFIG | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/usr/klibc/arch/arm/MCONFIG
|
||||
+++ b/usr/klibc/arch/arm/MCONFIG
|
||||
@@ -27,6 +27,7 @@ else
|
||||
KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x01800000
|
||||
ifeq ($(CONFIG_AEABI),y)
|
||||
KLIBCREQFLAGS += -mabi=aapcs-linux -mno-thumb-interwork
|
||||
+KLIBCLDFLAGS += $(FIX_ARMV4_EABI_BX)
|
||||
else
|
||||
KLIBCREQFLAGS += -mabi=apcs-gnu -mno-thumb-interwork
|
||||
endif
|
||||
@@ -0,0 +1,24 @@
|
||||
--- a/scripts/Kbuild.klibc
|
||||
+++ b/scripts/Kbuild.klibc
|
||||
@@ -113,10 +113,8 @@ KLIBCCPPFLAGS := -nostdinc -iwithpref
|
||||
-I$(KLIBCINC)/arch/$(KLIBCARCHDIR) \
|
||||
-I$(KLIBCINC)/bits$(KLIBCBITSIZE) \
|
||||
-I$(KLIBCOBJ)/../include \
|
||||
- -I$(KLIBCINC)
|
||||
-ifeq ($(cc-name),clang)
|
||||
-KLIBCCPPFLAGS += -isystem $(shell $(KLIBCCC) $(KLIBCCFLAGS) --print-file-name=include)
|
||||
-endif
|
||||
+ -I$(KLIBCINC) \
|
||||
+ -I$(shell $(KLIBCCC) $(KLIBCCFLAGS) --print-file-name=include)
|
||||
|
||||
# kernel include paths
|
||||
KLIBCKERNELSRC ?= $(srctree)
|
||||
@@ -137,7 +135,7 @@ KLIBCCFLAGS += $(KLIBCCPPFLAGS) $(K
|
||||
KLIBCAFLAGS += -D__ASSEMBLY__ $(KLIBCCFLAGS)
|
||||
KLIBCSTRIPFLAGS += --strip-all -R .comment -R .note
|
||||
|
||||
-KLIBCLIBGCC_DEF := $(shell $(KLIBCCC) $(KLIBCCFLAGS) $(if $(filter gcc,$(cc-name)),--print-libgcc,--print-libgcc-file-name))
|
||||
+KLIBCLIBGCC_DEF := $(shell $(KLIBCCC) $(KLIBCCFLAGS) --print-libgcc-file-name)
|
||||
KLIBCLIBGCC ?= $(KLIBCLIBGCC_DEF)
|
||||
KLIBCCRT0 := $(KLIBCOBJ)/arch/$(KLIBCARCHDIR)/crt0.o
|
||||
KLIBCLIBC := $(KLIBCOBJ)/libc.a
|
||||
@@ -0,0 +1,22 @@
|
||||
From 0cb26cf2d25d36c1fdcc4f1635e4329436ed866a Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Fri, 19 Sep 2014 23:09:29 +0200
|
||||
|
||||
---
|
||||
klcc/klcc.in | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/klcc/klcc.in b/klcc/klcc.in
|
||||
index 43d0984..61e9385 100644
|
||||
--- a/klcc/klcc.in
|
||||
+++ b/klcc/klcc.in
|
||||
@@ -204,6 +204,9 @@ while ( defined($a = shift(@ARGV)) ) {
|
||||
# Libraries
|
||||
push(@libs, $a);
|
||||
push(@libs, shift(@ARGV)) if ( $2 eq '' );
|
||||
+ } elsif ( $a =~ /^--([sysroot=])(.*)$/ ) {
|
||||
+ # Override gcc encoded sysroot
|
||||
+ push(@ccopt, $a);
|
||||
} else {
|
||||
die "$0: unknown option: $a\n";
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
meta-clang passes this option to compiler defaults
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
--- a/klcc/klcc.in
|
||||
+++ b/klcc/klcc.in
|
||||
@@ -207,6 +207,30 @@ while ( defined($a = shift(@ARGV)) ) {
|
||||
} elsif ( $a =~ /^--([sysroot=])(.*)$/ ) {
|
||||
# Override gcc encoded sysroot
|
||||
push(@ccopt, $a);
|
||||
+ } elsif ( $a eq '-nostartfiles' ) {
|
||||
+ # Allow clang options
|
||||
+ push(@ccopt, $a);
|
||||
+ } elsif ( $a eq '-nostdlib' ) {
|
||||
+ # Allow clang options
|
||||
+ push(@ccopt, $a);
|
||||
+ } elsif ( $a eq '-nodefaultlibs' ) {
|
||||
+ # Allow clang options
|
||||
+ push(@ccopt, $a);
|
||||
+ } elsif ( $a eq '-no-pie' ) {
|
||||
+ # Allow clang options
|
||||
+ push(@ccopt, $a);
|
||||
+ } elsif ( $a eq '-no-integrated-as' ) {
|
||||
+ # Allow clang options
|
||||
+ push(@ccopt, $a);
|
||||
+ } elsif ( $a =~ '--unwindlib=.*' ) {
|
||||
+ # Allow clang options
|
||||
+ push(@ccopt, $a);
|
||||
+ } elsif ( $a =~ '-rtlib=.*' ) {
|
||||
+ # Allow clang options
|
||||
+ push(@ccopt, $a);
|
||||
+ } elsif ( $a =~ '--dyld-prefix=.*' ) {
|
||||
+ # Allow clang options
|
||||
+ push(@ccopt, $a);
|
||||
} else {
|
||||
die "$0: unknown option: $a\n";
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
Patch was imported from the OpenEmbedded git server
|
||||
(git://git.openembedded.org/openembedded)
|
||||
as of commit id 676cbb54d42c89a4832871064cfcb7ee2ad372ee
|
||||
|
||||
klcc-cross: Add patch to use /usr/bin/env perl
|
||||
Certain configurations (such as autobuilders) may build in very
|
||||
deep paths (that are longer than the #! mechanism allows) which
|
||||
makes it unsafe to use the direct path for perl. In our case we know
|
||||
that /usr/bin/env perl will always return ours (if it has been built).
|
||||
|
||||
Signed-off-by: Tom Rini <tom_rini@mentor.com>
|
||||
|
||||
--- a/klcc/makeklcc.pl
|
||||
+++ b/klcc/makeklcc.pl
|
||||
@@ -26,7 +26,7 @@ sub pathsearch($) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
-print "#!${perlpath}\n";
|
||||
+print "#!/usr/bin/env perl\n";
|
||||
|
||||
open(KLIBCCONF, "< $klibcconf\0")
|
||||
or die "$0: cannot open $klibcconf: $!\n";
|
||||
@@ -0,0 +1,32 @@
|
||||
SUMMARY = "The klcc crosscompiler for klibc"
|
||||
|
||||
require klibc.inc
|
||||
DEPENDS = "klibc"
|
||||
|
||||
# no packaging for this crossscript
|
||||
PACKAGES = ""
|
||||
inherit nopackages
|
||||
|
||||
SRC_URI += "file://use-env-for-perl.patch"
|
||||
|
||||
# disable task already run in klibc recipe
|
||||
do_configure[noexec] = "1"
|
||||
|
||||
do_compile() {
|
||||
oe_runmake 'INSTALLDIR=${STAGING_DIR_TARGET}${libdir}/klibc' klcc
|
||||
}
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir_crossscripts}/
|
||||
install -m 0755 klcc/klcc ${D}${bindir_crossscripts}/${TARGET_PREFIX}klcc
|
||||
# Turn the horribly encoded paths into something which sstate can transform using its ususal
|
||||
# magic by removing all the crazy escaping.
|
||||
sed -i -e "2i \$TARGETSYSROOT = '${STAGING_DIR_TARGET}';" \
|
||||
-e "2i \$NATIVESYSROOT = '${STAGING_DIR_NATIVE}';" \
|
||||
-e 's#${@d.getVar("STAGING_DIR_NATIVE").replace("/", "\\\\/").replace("-", "\\\\-").replace(".", "\\\\.")}#${NATIVESYSROOT}#g;' \
|
||||
-e 's#${@d.getVar("STAGING_DIR_TARGET").replace("/", "\\\\/").replace("-", "\\\\-").replace(".", "\\\\.")}#${TARGETSYSROOT}#g' \
|
||||
${D}${bindir_crossscripts}/${TARGET_PREFIX}klcc
|
||||
}
|
||||
|
||||
SYSROOT_DIRS += "${bindir_crossscripts}"
|
||||
SSTATE_SCAN_FILES += "*-klcc"
|
||||
@@ -0,0 +1,12 @@
|
||||
SUMMARY = "klibc utils for initramfs statically compiled"
|
||||
|
||||
FILESPATH =. "${FILE_DIRNAME}/klibc-${PV}:"
|
||||
|
||||
PACKAGES = "${PN}"
|
||||
FILES:${PN} = ""
|
||||
|
||||
KLIBC_UTILS_VARIANT = "static"
|
||||
KLIBC_UTILS_PKGNAME = "klibc-static-utils"
|
||||
|
||||
require klibc-utils.inc
|
||||
require klibc.inc
|
||||
@@ -0,0 +1,58 @@
|
||||
do_install() {
|
||||
install -d ${D}${base_bindir}
|
||||
install -d ${D}${base_sbindir}
|
||||
if [ "${KLIBC_UTILS_VARIANT}" = "shared" ]; then
|
||||
install -m 755 usr/kinit/shared/kinit ${D}${base_bindir}/kinit.shared
|
||||
install -m 755 usr/dash/shared/sh ${D}${base_bindir}/sh.shared
|
||||
else
|
||||
install -m 755 usr/dash/static/sh ${D}${base_bindir}/sh
|
||||
install -m 755 usr/kinit/static/kinit ${D}${base_bindir}/kinit
|
||||
install -m 755 usr/gzip/gzip ${D}${base_bindir}
|
||||
ln -s gzip ${D}${base_bindir}/gunzip
|
||||
ln -s gzip ${D}${base_bindir}/zcat
|
||||
fi
|
||||
install -m 755 usr/kinit/fstype/${KLIBC_UTILS_VARIANT}/fstype ${D}${base_bindir}
|
||||
install -m 755 usr/kinit/ipconfig/${KLIBC_UTILS_VARIANT}/ipconfig ${D}${base_bindir}
|
||||
install -m 755 usr/kinit/nfsmount/${KLIBC_UTILS_VARIANT}/nfsmount ${D}${base_bindir}
|
||||
install -m 755 usr/kinit/resume/${KLIBC_UTILS_VARIANT}/resume ${D}${base_bindir}
|
||||
install -m 755 usr/kinit/run-init/${KLIBC_UTILS_VARIANT}/run-init ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/cat ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/chroot ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/cpio ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/dd ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/dmesg ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/false ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/halt ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/kill ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/ln ${D}${base_bindir}
|
||||
# losetup goes in ${base_sbindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/losetup ${D}${base_sbindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/ls ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/minips ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/mkdir ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/mkfifo ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/mknod ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/mount ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/mv ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/nuke ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/pivot_root ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/poweroff ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/readlink ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/reboot ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/sleep ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/sync ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/true ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/umount ${D}${base_bindir}
|
||||
install -m 755 usr/utils/${KLIBC_UTILS_VARIANT}/uname ${D}${base_bindir}
|
||||
}
|
||||
|
||||
EXTRA_KLIBC_DEPS = "${@oe.utils.conditional('KLIBC_UTILS_VARIANT', 'shared', '${THIS_LIBKLIBC}', '', d)}"
|
||||
|
||||
PACKAGES_DYNAMIC += "^${KLIBC_UTILS_PKGNAME}-.*"
|
||||
|
||||
python populate_packages:prepend () {
|
||||
base_bin_dir = d.expand('${base_bindir}')
|
||||
do_split_packages(d, base_bin_dir, '(.*)', '${KLIBC_UTILS_PKGNAME}-%s', 'Klibc util for %s', extra_depends='${EXTRA_KLIBC_DEPS}', allow_links=True, allow_dirs=True)
|
||||
base_sbin_dir = d.expand('${base_sbindir}')
|
||||
do_split_packages(d, base_sbin_dir, '(.*)', '${KLIBC_UTILS_PKGNAME}-%s', 'Klibc util for %s', extra_depends='${EXTRA_KLIBC_DEPS}', allow_dirs=True)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
SUMMARY = "klibc utils for initramfs"
|
||||
|
||||
FILESPATH =. "${FILE_DIRNAME}/klibc-${PV}:"
|
||||
|
||||
PACKAGES = "${PN}"
|
||||
FILES:${PN} = ""
|
||||
|
||||
KLIBC_UTILS_VARIANT = "shared"
|
||||
KLIBC_UTILS_PKGNAME = "klibc-utils"
|
||||
|
||||
require klibc-utils.inc
|
||||
require klibc.inc
|
||||
|
||||
DEPENDS = "klibc"
|
||||
@@ -0,0 +1,78 @@
|
||||
DESCRIPTION = "klibc is intended to be a minimalistic libc subset for \
|
||||
use with initramfs. It is deliberately written for small size, \
|
||||
minimal entaglement, and portability, not speed."
|
||||
SECTION = "libs"
|
||||
LICENSE = "BSD-3-Clause & GPL-2.0-only & MIT & Zlib"
|
||||
LIC_FILES_CHKSUM = "file://usr/klibc/LICENSE;md5=d75181f10e998c21eb147f6d2e43ce8b"
|
||||
DEPENDS = "linux-libc-headers perl-native"
|
||||
|
||||
SRC_URI = "${KERNELORG_MIRROR}/linux/libs/klibc/2.0/klibc-${PV}.tar.xz \
|
||||
${ARMPATCHES} \
|
||||
file://klcc-consider-sysroot.patch \
|
||||
file://klcc-cross-accept-clang-options.patch \
|
||||
file://0001-Define-in_-structs-for-non-glibc-system-libs.patch \
|
||||
file://0001-include-linux-sysinfo.h-directly.patch \
|
||||
file://0001-mkfifo-Implement-mkfifo.patch \
|
||||
file://0001-always-use-bfd-linker.patch \
|
||||
file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch \
|
||||
file://0001-klibc_2.0.4-add-kexec_file_load-syscall.patch \
|
||||
file://0001-klibc-add-getrandom-syscall.patch \
|
||||
file://0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch \
|
||||
file://cross-clang.patch \
|
||||
file://0001-workaround-for-overlapping-sections-in-binary.patch \
|
||||
file://0001-fcntl-Fix-build-failure-for-some-architectures-with-.patch \
|
||||
"
|
||||
|
||||
ARMPATCHES ?= ""
|
||||
|
||||
ARMPATCHES:arm = " \
|
||||
file://armv4-fix-v4bx.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "662753da8889e744dfc0db6eb4021c3377ee7ef8ed66d7d57765f8c9e25939cd"
|
||||
|
||||
S = "${WORKDIR}/klibc-${PV}"
|
||||
|
||||
OPTFLAGS = "${TUNE_CCARGS} -Os -fcommon"
|
||||
OPTFLAGS:append:toolchain-clang = " -fno-builtin-bcmp"
|
||||
OPTFLAGS:append:toolchain-clang:mipsarch = " -no-integrated-as"
|
||||
|
||||
PARALLEL_MAKE = ""
|
||||
EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \
|
||||
'CROSS_COMPILE=${TARGET_PREFIX}' \
|
||||
'KLIBCKERNELSRC=${STAGING_DIR_TARGET}${exec_prefix}' \
|
||||
'KLIBCLIBGCC=${STAGING_DIR_TARGET}${libdir}/${TARGET_SYS}/*/libgcc.a' \
|
||||
'prefix=${exec_prefix}' \
|
||||
'INSTALLROOT=${D}' \
|
||||
'INSTALLDIR=${libdir}/klibc' \
|
||||
'SHLIBDIR=${libdir}' \
|
||||
'${KLIBCTHUMB}' \
|
||||
'KLIBCOPTFLAGS=${OPTFLAGS}' \
|
||||
V=1 \
|
||||
"
|
||||
|
||||
export FIX_ARMV4_EABI_BX = "${FIX_V4BX}"
|
||||
KLIBCTHUMB = "${@['CONFIG_KLIBC_THUMB=n', 'CONFIG_KLIBC_THUMB=y'][(d.getVar('ARM_INSTRUCTION_SET') == 'thumb')]}"
|
||||
|
||||
do_configure () {
|
||||
ln -sf "${STAGING_DIR_TARGET}${exec_prefix}" linux
|
||||
}
|
||||
|
||||
do_compile:prepend:toolchain-clang() {
|
||||
sed -i -e 's#$(KLIBCROSS)gcc#$(KLIBCROSS)clang#g' ${S}/Makefile
|
||||
}
|
||||
|
||||
INHIBIT_PACKAGE_STRIP = "1"
|
||||
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
|
||||
INSANE_SKIP:${PN} = "already-stripped"
|
||||
INSANE_SKIP:libklibc-dev = "dev-elf"
|
||||
KLIBC_ARCH = "${TARGET_ARCH}"
|
||||
KLIBC_ARCH:aarch64 = "arm64"
|
||||
KLIBC_ARCH:armeb = "arm"
|
||||
KLIBC_ARCH:mipsel = "mips"
|
||||
KLIBC_ARCH:mips64el = "mips64"
|
||||
KLIBC_ARCH:x86 = "i386"
|
||||
KLIBC_ARCH:x86-64 = "x86_64"
|
||||
KLIBC_ARCH:powerpc = "ppc"
|
||||
KLIBC_ARCH:powerpc64 = "ppc64"
|
||||
KLIBC_ARCH:powerpc64le = "ppc64"
|
||||
THIS_LIBKLIBC = "libklibc (= ${PV}-${PR})"
|
||||
@@ -0,0 +1,26 @@
|
||||
SUMMARY = "klibc, a small C library for use with initramfs"
|
||||
|
||||
do_install() {
|
||||
oe_runmake install
|
||||
# the crosscompiler is packaged by klcc-cross
|
||||
# remove klcc
|
||||
rm ${D}${bindir}/klcc
|
||||
# remove now empty dir
|
||||
rmdir ${D}${bindir}
|
||||
install -d ${D}${libdir}
|
||||
install -m 755 usr/klibc/klibc-*.so ${D}${libdir}
|
||||
(cd ${D}${libdir}; ln -s klibc-*.so klibc.so)
|
||||
rm -rf ${D}${exec_prefix}/man
|
||||
rm -rf ${D}${libdir}/klibc/bin
|
||||
}
|
||||
|
||||
PACKAGES = "libklibc libklibc-staticdev libklibc-dev"
|
||||
|
||||
FILES:libklibc = "${libdir}/klibc-*.so"
|
||||
FILES:libklibc-staticdev = "${libdir}/klibc/lib/libc.a"
|
||||
FILES:libklibc-dev = "${libdir}/klibc.so \
|
||||
${libdir}/klibc/lib/* \
|
||||
${libdir}/klibc/include/* \
|
||||
"
|
||||
|
||||
require klibc.inc
|
||||
@@ -0,0 +1,40 @@
|
||||
From e596ae99059c28fa9bb3461e03e7ecaacbf41727 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Wed, 23 May 2018 15:34:59 +0200
|
||||
Subject: [PATCH] libmissing.h: fix klibc build when using glibc toolchain
|
||||
|
||||
klibc lacks execinfo.h so adda guard around it.
|
||||
Note: build with musl toolchain is ok even without this patch.
|
||||
|
||||
Fix build error:
|
||||
|
||||
| In file included from ../git/lib/execinfo.c:1:0:
|
||||
| ../git/include/libmissing.h:7:10: fatal error: execinfo.h:
|
||||
No such file or directory
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
---
|
||||
include/libmissing.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/include/libmissing.h b/include/libmissing.h
|
||||
index 0196033..832c372 100644
|
||||
--- a/include/libmissing.h
|
||||
+++ b/include/libmissing.h
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+#ifndef __KLIBC__
|
||||
#ifdef HAVE_EXECINFO_H
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
#ifndef HAVE_EXECINFO_H
|
||||
int backtrace(void **buffer, int size);
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 884ec4c654f1d07a387fdc1dae5640606369f254 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 6 Feb 2021 10:56:36 -0800
|
||||
Subject: [PATCH] make: Add compiler includes in cflags
|
||||
|
||||
Fixes
|
||||
In file included from ../git/ubi-utils/ubiformat.c:47:
|
||||
| ../git/include/common.h:22:10: fatal error: 'stdbool.h' file not found
|
||||
| #include <stdbool.h>
|
||||
| ^~~~~~~~~~~
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
Makefile.am | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 5a6e77c..f0003d5 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -9,6 +9,7 @@ endif
|
||||
if WITHOUT_LZO
|
||||
AM_CPPFLAGS += -DWITHOUT_LZO
|
||||
endif
|
||||
+AM_CPPFLAGS += -I$(shell $(CC) -print-file-name=include)
|
||||
|
||||
sbin_PROGRAMS =
|
||||
sbin_SCRIPTS =
|
||||
--
|
||||
2.30.0
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
From 01c98d5d5d044d9a125abcdbb2f3d771966365b0 Mon Sep 17 00:00:00 2001
|
||||
From: mirabilos <m@mirbsd.org>
|
||||
Date: Thu, 1 Feb 2018 15:34:07 +0100
|
||||
Subject: [PATCH] Instead of doing preprocessor magic, just output off_t as
|
||||
long long
|
||||
|
||||
Fix warnings abot PRIdoff_t in libmtd.c, in mtd_read (and mtd_write):
|
||||
|
||||
In file included from ../git/lib/libmtd.c:40:0:
|
||||
../git/lib/libmtd.c: In function 'mtd_read':
|
||||
../git/include/common.h:110:18: warning: format '%ld' expects argument of
|
||||
type 'long int', but argument 5 has type 'off_t {aka long long int}'
|
||||
[-Wformat=]
|
||||
|
||||
../git/include/common.h:120:2: note: in expansion of macro 'errmsg'
|
||||
errmsg(fmt, ##__VA_ARGS__); \
|
||||
^~~~~~
|
||||
../git/lib/libmtd.c:1082:10: note: in expansion of macro 'sys_errmsg'
|
||||
return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t,
|
||||
^~~~~~~~~~
|
||||
|
||||
/usr/lib/klibc/include/inttypes.h:28:17: note: format string is defined here
|
||||
#define PRId32 "d"
|
||||
|
||||
Upstream-Status: Submitted
|
||||
|
||||
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
|
||||
---
|
||||
include/common.h | 18 ------------------
|
||||
jffsX-utils/mkfs.jffs2.c | 20 ++++++++++----------
|
||||
lib/libmtd.c | 8 ++++----
|
||||
misc-utils/flash_erase.c | 6 +++---
|
||||
misc-utils/flash_otp_write.c | 2 +-
|
||||
misc-utils/ftl_check.c | 2 +-
|
||||
misc-utils/mtd_debug.c | 4 ++--
|
||||
misc-utils/serve_image.c | 4 ++--
|
||||
tests/fs-tests/integrity/integck.c | 4 ++--
|
||||
tests/mtd-tests/nandpagetest.c | 4 ++--
|
||||
tests/ubi-tests/integ.c | 6 +++---
|
||||
ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 6 +++---
|
||||
12 files changed, 33 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/include/common.h b/include/common.h
|
||||
index f8f72ea..642c212 100644
|
||||
--- a/include/common.h
|
||||
+++ b/include/common.h
|
||||
@@ -70,24 +70,6 @@ extern "C" {
|
||||
#define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
-/* define a print format specifier for off_t */
|
||||
-#if (SIZEOF_OFF_T >= 8)
|
||||
-#define PRIxoff_t PRIx64
|
||||
-#define PRIdoff_t PRId64
|
||||
-#else
|
||||
-#define PRIxoff_t "l"PRIx32
|
||||
-#define PRIdoff_t "l"PRId32
|
||||
-#endif
|
||||
-
|
||||
-/* define a print format specifier for loff_t */
|
||||
-#if (SIZEOF_LOFF_T >= 8)
|
||||
-#define PRIxloff_t PRIx64
|
||||
-#define PRIdloff_t PRId64
|
||||
-#else
|
||||
-#define PRIxloff_t "l"PRIx32
|
||||
-#define PRIdloff_t "l"PRId32
|
||||
-#endif
|
||||
-
|
||||
/* Verbose messages */
|
||||
#define bareverbose(verbose, fmt, ...) do { \
|
||||
if (verbose) \
|
||||
diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c
|
||||
index 9aa6c39..0661786 100644
|
||||
--- a/jffsX-utils/mkfs.jffs2.c
|
||||
+++ b/jffsX-utils/mkfs.jffs2.c
|
||||
@@ -1237,8 +1237,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir)
|
||||
} else switch (e->sb.st_mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
if (verbose) {
|
||||
- printf("\td %04o %9" PRIdoff_t " %5d:%-3d %s\n",
|
||||
- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
|
||||
+ printf("\td %04o %9lld %5d:%-3d %s\n",
|
||||
+ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size,
|
||||
(int) (e->sb.st_uid), (int) (e->sb.st_gid),
|
||||
e->name);
|
||||
}
|
||||
@@ -1247,8 +1247,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir)
|
||||
break;
|
||||
case S_IFSOCK:
|
||||
if (verbose) {
|
||||
- printf("\ts %04o %9" PRIdoff_t " %5d:%-3d %s\n",
|
||||
- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
|
||||
+ printf("\ts %04o %9lld %5d:%-3d %s\n",
|
||||
+ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size,
|
||||
(int) e->sb.st_uid, (int) e->sb.st_gid, e->name);
|
||||
}
|
||||
write_pipe(e);
|
||||
@@ -1256,8 +1256,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir)
|
||||
break;
|
||||
case S_IFIFO:
|
||||
if (verbose) {
|
||||
- printf("\tp %04o %9" PRIdoff_t " %5d:%-3d %s\n",
|
||||
- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
|
||||
+ printf("\tp %04o %9lld %5d:%-3d %s\n",
|
||||
+ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size,
|
||||
(int) e->sb.st_uid, (int) e->sb.st_gid, e->name);
|
||||
}
|
||||
write_pipe(e);
|
||||
@@ -1285,8 +1285,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir)
|
||||
break;
|
||||
case S_IFLNK:
|
||||
if (verbose) {
|
||||
- printf("\tl %04o %9" PRIdoff_t " %5d:%-3d %s -> %s\n",
|
||||
- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
|
||||
+ printf("\tl %04o %9lld %5d:%-3d %s -> %s\n",
|
||||
+ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size,
|
||||
(int) e->sb.st_uid, (int) e->sb.st_gid, e->name,
|
||||
e->link);
|
||||
}
|
||||
@@ -1297,8 +1297,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir)
|
||||
wrote = write_regular_file(e);
|
||||
write_xattr_entry(e);
|
||||
if (verbose) {
|
||||
- printf("\tf %04o %9" PRIdoff_t " (%9u) %5d:%-3d %s\n",
|
||||
- e->sb.st_mode & ~S_IFMT, e->sb.st_size, wrote,
|
||||
+ printf("\tf %04o %9lld (%9u) %5d:%-3d %s\n",
|
||||
+ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size, wrote,
|
||||
(int) e->sb.st_uid, (int) e->sb.st_gid, e->name);
|
||||
}
|
||||
break;
|
||||
diff --git a/lib/libmtd.c b/lib/libmtd.c
|
||||
index 86c89ae..f375381 100644
|
||||
--- a/lib/libmtd.c
|
||||
+++ b/lib/libmtd.c
|
||||
@@ -1079,8 +1079,8 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
|
||||
/* Seek to the beginning of the eraseblock */
|
||||
seek = (off_t)eb * mtd->eb_size + offs;
|
||||
if (lseek(fd, seek, SEEK_SET) != seek)
|
||||
- return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t,
|
||||
- mtd->mtd_num, seek);
|
||||
+ return sys_errmsg("cannot seek mtd%d to offset %lld",
|
||||
+ mtd->mtd_num, (long long)seek);
|
||||
|
||||
while (rd < len) {
|
||||
ret = read(fd, buf + rd, len - rd);
|
||||
@@ -1188,8 +1188,8 @@ int mtd_write(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb,
|
||||
if (data) {
|
||||
/* Seek to the beginning of the eraseblock */
|
||||
if (lseek(fd, seek, SEEK_SET) != seek)
|
||||
- return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t,
|
||||
- mtd->mtd_num, seek);
|
||||
+ return sys_errmsg("cannot seek mtd%d to offset %lld",
|
||||
+ mtd->mtd_num, (long long)seek);
|
||||
ret = write(fd, data, len);
|
||||
if (ret != len)
|
||||
return sys_errmsg("cannot write %d bytes to mtd%d "
|
||||
diff --git a/misc-utils/flash_erase.c b/misc-utils/flash_erase.c
|
||||
index 0c9449f..ec4b2e1 100644
|
||||
--- a/misc-utils/flash_erase.c
|
||||
+++ b/misc-utils/flash_erase.c
|
||||
@@ -53,8 +53,8 @@ int target_endian = __BYTE_ORDER;
|
||||
static void show_progress(struct mtd_dev_info *mtd, off_t start, int eb,
|
||||
int eb_start, int eb_cnt)
|
||||
{
|
||||
- bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ",
|
||||
- mtd->eb_size / 1024, start, ((eb - eb_start) * 100) / eb_cnt);
|
||||
+ bareverbose(!quiet, "\rErasing %d Kibyte @ %llx -- %2i %% complete ",
|
||||
+ mtd->eb_size / 1024, (unsigned long long)start, ((eb - eb_start) * 100) / eb_cnt);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ int main(int argc, char *argv[])
|
||||
if (!noskipbad) {
|
||||
int ret = mtd_is_bad(&mtd, fd, eb);
|
||||
if (ret > 0) {
|
||||
- verbose(!quiet, "Skipping bad block at %08"PRIxoff_t, offset);
|
||||
+ verbose(!quiet, "Skipping bad block at %08llx", (unsigned long long)offset);
|
||||
continue;
|
||||
} else if (ret < 0) {
|
||||
if (errno == EOPNOTSUPP) {
|
||||
diff --git a/misc-utils/flash_otp_write.c b/misc-utils/flash_otp_write.c
|
||||
index b02d0b0..04c96c6 100644
|
||||
--- a/misc-utils/flash_otp_write.c
|
||||
+++ b/misc-utils/flash_otp_write.c
|
||||
@@ -76,7 +76,7 @@ int main(int argc,char *argv[])
|
||||
return errno;
|
||||
}
|
||||
|
||||
- printf("Writing OTP user data on %s at offset 0x%"PRIxoff_t"\n", argv[2], offset);
|
||||
+ printf("Writing OTP user data on %s at offset 0x%llx\n", argv[2], (unsigned long long)offset);
|
||||
|
||||
if (mtd_type_is_nand_user(&mtdInfo))
|
||||
len = mtdInfo.writesize;
|
||||
diff --git a/misc-utils/ftl_check.c b/misc-utils/ftl_check.c
|
||||
index a853cf4..e854922 100644
|
||||
--- a/misc-utils/ftl_check.c
|
||||
+++ b/misc-utils/ftl_check.c
|
||||
@@ -131,7 +131,7 @@ static void check_partition(int fd)
|
||||
perror("read failed");
|
||||
break;
|
||||
}
|
||||
- printf("\nErase unit %"PRIdoff_t":\n", i);
|
||||
+ printf("\nErase unit %lld:\n", (long long)i);
|
||||
if ((hdr2.FormattedSize != hdr.FormattedSize) ||
|
||||
(hdr2.NumEraseUnits != hdr.NumEraseUnits) ||
|
||||
(hdr2.SerialNumber != hdr.SerialNumber))
|
||||
diff --git a/misc-utils/mtd_debug.c b/misc-utils/mtd_debug.c
|
||||
index ac37e23..d65ad36 100644
|
||||
--- a/misc-utils/mtd_debug.c
|
||||
+++ b/misc-utils/mtd_debug.c
|
||||
@@ -160,7 +160,7 @@ retry:
|
||||
if (buf != NULL)
|
||||
free(buf);
|
||||
close(outfd);
|
||||
- printf("Copied %zu bytes from address 0x%.8"PRIxoff_t" in flash to %s\n", len, offset, filename);
|
||||
+ printf("Copied %zu bytes from address 0x%.8llx in flash to %s\n", len, (unsigned long long)offset, filename);
|
||||
return 0;
|
||||
|
||||
err2:
|
||||
@@ -225,7 +225,7 @@ retry:
|
||||
if (buf != NULL)
|
||||
free(buf);
|
||||
fclose(fp);
|
||||
- printf("Copied %d bytes from %s to address 0x%.8"PRIxoff_t" in flash\n", len, filename, offset);
|
||||
+ printf("Copied %d bytes from %s to address 0x%.8llx in flash\n", len, filename, (unsigned long long)offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/misc-utils/serve_image.c b/misc-utils/serve_image.c
|
||||
index f2475d6..6c8c8fb 100644
|
||||
--- a/misc-utils/serve_image.c
|
||||
+++ b/misc-utils/serve_image.c
|
||||
@@ -129,8 +129,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (st.st_size % erasesize) {
|
||||
- fprintf(stderr, "Image size %" PRIdoff_t " bytes is not a multiple of erasesize %d bytes\n",
|
||||
- st.st_size, erasesize);
|
||||
+ fprintf(stderr, "Image size %lld bytes is not a multiple of erasesize %d bytes\n",
|
||||
+ (long long)st.st_size, erasesize);
|
||||
exit(1);
|
||||
}
|
||||
image = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, rfd, 0);
|
||||
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
|
||||
index 84753d6..0a7f142 100644
|
||||
--- a/tests/fs-tests/integrity/integck.c
|
||||
+++ b/tests/fs-tests/integrity/integck.c
|
||||
@@ -897,8 +897,8 @@ static ssize_t file_write_data(struct file_info *file, int fd, off_t offset,
|
||||
remains = size;
|
||||
actual = 0;
|
||||
written = IO_BUFFER_SIZE;
|
||||
- v("write %zd bytes, offset %"PRIdoff_t", file %s",
|
||||
- size, offset, get_file_name(file));
|
||||
+ v("write %zd bytes, offset %lld, file %s",
|
||||
+ size, (long long)offset, get_file_name(file));
|
||||
while (remains) {
|
||||
/* Fill up buffer with random data */
|
||||
if (written < IO_BUFFER_SIZE) {
|
||||
diff --git a/tests/mtd-tests/nandpagetest.c b/tests/mtd-tests/nandpagetest.c
|
||||
index c6812df..465e548 100644
|
||||
--- a/tests/mtd-tests/nandpagetest.c
|
||||
+++ b/tests/mtd-tests/nandpagetest.c
|
||||
@@ -232,8 +232,8 @@ static int verify_eraseblock(int ebnum)
|
||||
return err;
|
||||
|
||||
if (lseek(fd, addr, SEEK_SET) != addr) {
|
||||
- fprintf(stderr, "cannot seek mtd%d to offset %"PRIdloff_t,
|
||||
- mtd.mtd_num, addr);
|
||||
+ fprintf(stderr, "cannot seek mtd%d to offset %lld",
|
||||
+ mtd.mtd_num, (long long)addr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff --git a/tests/ubi-tests/integ.c b/tests/ubi-tests/integ.c
|
||||
index 26c2ce5..1cd0649 100644
|
||||
--- a/tests/ubi-tests/integ.c
|
||||
+++ b/tests/ubi-tests/integ.c
|
||||
@@ -243,7 +243,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
|
||||
while (size)
|
||||
if (read_buffer[--size] != 0xff) {
|
||||
fprintf(stderr, "block no. = %d\n" , erase_block->block_number);
|
||||
- fprintf(stderr, "offset = %"PRIdoff_t"\n" , gap_start);
|
||||
+ fprintf(stderr, "offset = %lld\n" , (long long)gap_start);
|
||||
fprintf(stderr, "size = %ld\n" , (long) bytes_read);
|
||||
error_exit("verify 0xff failed");
|
||||
}
|
||||
@@ -254,7 +254,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
|
||||
errno = 0;
|
||||
bytes_read = read(fd, read_buffer, w->size);
|
||||
if (bytes_read != w->size) {
|
||||
- fprintf(stderr, "offset = %"PRIdoff_t"\n" , w->offset);
|
||||
+ fprintf(stderr, "offset = %lld\n" , (long long)w->offset);
|
||||
fprintf(stderr, "size = %ld\n" , (long) w->size);
|
||||
fprintf(stderr, "bytes_read = %ld\n" , (long) bytes_read);
|
||||
error_exit("read failed");
|
||||
@@ -279,7 +279,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
|
||||
while (size)
|
||||
if (read_buffer[--size] != 0xff) {
|
||||
fprintf(stderr, "block no. = %d\n" , erase_block->block_number);
|
||||
- fprintf(stderr, "offset = %"PRIdoff_t"\n" , gap_start);
|
||||
+ fprintf(stderr, "offset = %lld\n" , (long long)gap_start);
|
||||
fprintf(stderr, "size = %ld\n" , (long) bytes_read);
|
||||
error_exit("verify 0xff failed!");
|
||||
}
|
||||
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
|
||||
index c916f48..f0237ab 100644
|
||||
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
|
||||
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
|
||||
@@ -772,11 +772,11 @@ int write_leb(int lnum, int len, void *buf)
|
||||
return sys_err_msg("ubi_leb_change_start failed");
|
||||
|
||||
if (lseek(out_fd, pos, SEEK_SET) != pos)
|
||||
- return sys_err_msg("lseek failed seeking %"PRIdoff_t, pos);
|
||||
+ return sys_err_msg("lseek failed seeking %lld", (long long)pos);
|
||||
|
||||
if (write(out_fd, buf, c->leb_size) != c->leb_size)
|
||||
- return sys_err_msg("write failed writing %d bytes at pos %"PRIdoff_t,
|
||||
- c->leb_size, pos);
|
||||
+ return sys_err_msg("write failed writing %d bytes at pos %lld",
|
||||
+ c->leb_size, (long long)pos);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 139d93bc405272a3261d57be26da842e737fe4d0 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Sun, 28 Jan 2018 23:10:34 +0100
|
||||
Subject: [PATCH] Makefile.am: only build ubi-utils
|
||||
|
||||
We only target the ubi-utils, static, small.
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
---
|
||||
Makefile.am | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 5a6e77c..98715dd 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -34,9 +34,9 @@ EXTRA_DIST += $(GLOBAL_HEADER) $(GLOBAL_EXTRA)
|
||||
|
||||
include lib/Makemodule.am
|
||||
include ubi-utils/Makemodule.am
|
||||
-include misc-utils/Makemodule.am
|
||||
-include nand-utils/Makemodule.am
|
||||
-include nor-utils/Makemodule.am
|
||||
+#include misc-utils/Makemodule.am
|
||||
+#include nand-utils/Makemodule.am
|
||||
+#include nor-utils/Makemodule.am
|
||||
|
||||
if BUILD_UBIFS
|
||||
include ubifs-utils/Makemodule.am
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From ae1cf6d0eb1833e46549328a4473222c259723d7 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Thu, 1 Feb 2018 00:25:00 +0100
|
||||
Subject: [PATCH] mtd-utils: common.h: no features.h for klibc builds
|
||||
|
||||
Add guard around features.h to fix missing include (here first error):
|
||||
|
||||
../git/include/common.h:29:10:
|
||||
fatal error: features.h: No such file or directory
|
||||
#include <features.h>
|
||||
^~~~~~~~~~~~
|
||||
compilation terminated
|
||||
|
||||
Upstream-Status: Submitted
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
---
|
||||
include/common.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/include/common.h b/include/common.h
|
||||
index 642c212..f7c71fe 100644
|
||||
--- a/include/common.h
|
||||
+++ b/include/common.h
|
||||
@@ -26,7 +26,10 @@
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
+#if defined(__KLIBC__)
|
||||
+#else
|
||||
#include <features.h>
|
||||
+#endif
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/sysmacros.h>
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
From 2137eb1a6cd0326510bd3b9faf8037d9bf34ca3d Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Adami <andrea.adami@gmail.com>
|
||||
Date: Wed, 23 May 2018 15:52:34 +0200
|
||||
Subject: [PATCH] common.h: replace getline() with fgets
|
||||
|
||||
There is an unofficial upstream patch adding a simple getline()
|
||||
to libmissing.h. Unfortunately the patch creates issues if the
|
||||
toolchain is using glibc (autotools cache?) so for the moment
|
||||
keep the old hack and wait for commits upstream.
|
||||
|
||||
Fix:
|
||||
|
||||
| ubi-utils/ubiformat.o: In function `prompt.constprop.4':
|
||||
| ubiformat.c:(.text+0x70): undefined reference to `getline'
|
||||
|
||||
Upstream-Status: Inappropriate [klibc specific]
|
||||
|
||||
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
|
||||
---
|
||||
include/common.h | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/include/common.h b/include/common.h
|
||||
index a1d59d0..96b0bdb 100644
|
||||
--- a/include/common.h
|
||||
+++ b/include/common.h
|
||||
@@ -126,15 +126,26 @@ extern "C" {
|
||||
*/
|
||||
static inline bool prompt(const char *msg, bool def)
|
||||
{
|
||||
+
|
||||
+#ifndef __KLIBC__
|
||||
char *line = NULL;
|
||||
size_t len;
|
||||
+#else
|
||||
+ char *line;
|
||||
+ const int sizeof_line = 2;
|
||||
+ line = malloc(sizeof_line);
|
||||
+#endif
|
||||
bool ret = def;
|
||||
|
||||
do {
|
||||
normsg_cont("%s (%c/%c) ", msg, def ? 'Y' : 'y', def ? 'n' : 'N');
|
||||
fflush(stdout);
|
||||
|
||||
+#ifndef __KLIBC__
|
||||
while (getline(&line, &len, stdin) == -1) {
|
||||
+#else
|
||||
+ while (fgets(line, sizeof_line, stdin) == NULL) {
|
||||
+#endif
|
||||
printf("failed to read prompt; assuming '%s'\n",
|
||||
def ? "yes" : "no");
|
||||
break;
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
SUMMARY = "UBI utils statically compiled against klibc"
|
||||
DESCRIPTION = "Small sized tools from mtd-utils for use with initramfs."
|
||||
SECTION = "base"
|
||||
DEPENDS = "zlib e2fsprogs util-linux"
|
||||
HOMEPAGE = "http://www.linux-mtd.infradead.org/"
|
||||
LICENSE = "GPL-2.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
|
||||
file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c"
|
||||
|
||||
inherit autotools pkgconfig klibc
|
||||
|
||||
SRCREV = "64f61a9dc71b158c7084006cbce4ea23886f0b47"
|
||||
SRC_URI = "git://git.infradead.org/mtd-utils.git;branch=master \
|
||||
file://0001-libmissing.h-fix-klibc-build-when-using-glibc-toolch.patch \
|
||||
file://0002-Instead-of-doing-preprocessor-magic-just-output-off_.patch \
|
||||
file://0003-Makefile.am-only-build-ubi-utils.patch \
|
||||
file://0004-mtd-utils-common.h-no-features.h-for-klibc-builds.patch \
|
||||
file://0005-common.h-replace-getline-with-fgets.patch \
|
||||
file://0001-make-Add-compiler-includes-in-cflags.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
EXTRA_OECONF += "--disable-tests --without-jffs --without-ubifs"
|
||||
|
||||
PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'xattr', d)}"
|
||||
PACKAGECONFIG[xattr] = ",,acl,"
|
||||
PACKAGECONFIG[lzo] = "--with-lzo,--without-lzo,lzo"
|
||||
|
||||
EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} ${@bb.utils.contains('PACKAGECONFIG', 'xattr', '', '-DWITHOUT_XATTR', d)} -I${S}/include' 'BUILDDIR=${S}'"
|
||||
|
||||
do_install () {
|
||||
oe_runmake install DESTDIR=${D} SBINDIR=${sbindir} MANDIR=${mandir} INCLUDEDIR=${includedir}
|
||||
}
|
||||
|
||||
PACKAGES = "ubi-utils-klibc-dbg ubi-utils-klibc-doc"
|
||||
|
||||
PACKAGES =+ "mtdinfo-klibc ubiattach-klibc ubiblock-klibc ubicrc32-klibc ubidetach-klibc \
|
||||
ubiformat-klibc ubimkvol-klibc ubinfo-klibc ubinize-klibc ubirename-klibc \
|
||||
ubirmvol-klibc ubirsvol-klibc ubiupdatevol-klibc"
|
||||
|
||||
FILES:mtdinfo-klibc = "${sbindir}/mtdinfo"
|
||||
FILES:ubiattach-klibc = "${sbindir}/ubiattach"
|
||||
FILES:ubiblock-klibc = "${sbindir}/ubiblock"
|
||||
FILES:ubicrc32-klibc = "${sbindir}/ubicrc32"
|
||||
FILES:ubidetach-klibc = "${sbindir}/ubidetach"
|
||||
FILES:ubiformat-klibc = "${sbindir}/ubiformat"
|
||||
FILES:ubimkvol-klibc = "${sbindir}/ubimkvol"
|
||||
FILES:ubinfo-klibc = "${sbindir}/ubinfo"
|
||||
FILES:ubinize-klibc = "${sbindir}/ubinize"
|
||||
FILES:ubirename-klibc = "${sbindir}/ubirename"
|
||||
FILES:ubirmvol-klibc = "${sbindir}/ubirmvol"
|
||||
FILES:ubirsvol-klibc = "${sbindir}/ubirsvol"
|
||||
FILES:ubiupdatevol-klibc = "${sbindir}/ubiupdatevol"
|
||||
Reference in New Issue
Block a user