added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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) \

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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";
}

View File

@@ -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";
}

View File

@@ -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";

View File

@@ -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"

View File

@@ -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

View File

@@ -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)
}

View File

@@ -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"

View File

@@ -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})"

View File

@@ -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