Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 1 | DESCRIPTION = "klibc is intended to be a minimalistic libc subset for \ |
| 2 | use with initramfs. It is deliberately written for small size, \ |
| 3 | minimal entaglement, and portability, not speed." |
| 4 | SECTION = "libs" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 5 | LICENSE = "BSD-3-Clause & GPL-2.0-only & MIT & Zlib" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://usr/klibc/LICENSE;md5=d75181f10e998c21eb147f6d2e43ce8b" |
| 7 | DEPENDS = "linux-libc-headers perl-native" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 8 | |
Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 9 | SRC_URI = "${KERNELORG_MIRROR}/linux/libs/klibc/2.0/klibc-${PV}.tar.xz \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 10 | ${ARMPATCHES} \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | file://klcc-consider-sysroot.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 12 | file://klcc-cross-accept-clang-options.patch \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 13 | file://0001-dash-Specify-format-string-in-fmtstr.patch \ |
| 14 | file://0001-Define-in_-structs-for-non-glibc-system-libs.patch \ |
| 15 | file://0001-include-linux-sysinfo.h-directly.patch \ |
| 16 | file://0001-mkfifo-Implement-mkfifo.patch \ |
| 17 | file://0001-always-use-bfd-linker.patch \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 18 | file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 19 | file://0001-klibc_2.0.4-add-kexec_file_load-syscall.patch \ |
| 20 | file://0001-klibc-add-getrandom-syscall.patch \ |
| 21 | file://0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch \ |
Andrew Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame] | 22 | file://cross-clang.patch \ |
| 23 | file://0001-workaround-for-overlapping-sections-in-binary.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 24 | " |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | |
| 26 | ARMPATCHES ?= "" |
| 27 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 28 | ARMPATCHES:arm = " \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 29 | file://armv4-fix-v4bx.patch \ |
| 30 | " |
Andrew Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame] | 31 | SRC_URI[sha256sum] = "4e48f1398cfe3ce0b6df55ce6e70acf54fc8488e3aea3fb3610ee1622d9cb436" |
Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 32 | |
| 33 | S = "${WORKDIR}/klibc-${PV}" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 34 | |
Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame] | 35 | OPTFLAGS = "${TUNE_CCARGS} -Os -fcommon" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 36 | OPTFLAGS:append:toolchain-clang = " -fno-builtin-bcmp" |
| 37 | OPTFLAGS:append:toolchain-clang:mipsarch = " -no-integrated-as" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 38 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 39 | PARALLEL_MAKE = "" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 40 | EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \ |
| 41 | 'CROSS_COMPILE=${TARGET_PREFIX}' \ |
| 42 | 'KLIBCKERNELSRC=${STAGING_DIR_TARGET}${exec_prefix}' \ |
| 43 | 'KLIBCLIBGCC=${STAGING_DIR_TARGET}${libdir}/${TARGET_SYS}/*/libgcc.a' \ |
| 44 | 'prefix=${exec_prefix}' \ |
| 45 | 'INSTALLROOT=${D}' \ |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 46 | 'INSTALLDIR=${libdir}/klibc' \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 47 | 'SHLIBDIR=${libdir}' \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 48 | '${KLIBCTHUMB}' \ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 49 | 'KLIBCOPTFLAGS=${OPTFLAGS}' \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 50 | V=1 \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 51 | " |
| 52 | |
| 53 | export FIX_ARMV4_EABI_BX = "${FIX_V4BX}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 54 | KLIBCTHUMB = "${@['CONFIG_KLIBC_THUMB=n', 'CONFIG_KLIBC_THUMB=y'][(d.getVar('ARM_INSTRUCTION_SET') == 'thumb')]}" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 55 | |
| 56 | do_configure () { |
| 57 | ln -sf "${STAGING_DIR_TARGET}${exec_prefix}" linux |
| 58 | } |
| 59 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 60 | do_compile:prepend:toolchain-clang() { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 61 | sed -i -e 's#$(KLIBCROSS)gcc#$(KLIBCROSS)clang#g' ${S}/Makefile |
| 62 | } |
| 63 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 64 | INHIBIT_PACKAGE_STRIP = "1" |
| 65 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 66 | INSANE_SKIP:${PN} = "already-stripped" |
| 67 | INSANE_SKIP:libklibc-dev = "dev-elf" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 68 | KLIBC_ARCH = "${TARGET_ARCH}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 69 | KLIBC_ARCH:aarch64 = "arm64" |
| 70 | KLIBC_ARCH:armeb = "arm" |
| 71 | KLIBC_ARCH:mipsel = "mips" |
| 72 | KLIBC_ARCH:mips64el = "mips64" |
| 73 | KLIBC_ARCH:x86 = "i386" |
| 74 | KLIBC_ARCH:x86-64 = "x86_64" |
| 75 | KLIBC_ARCH:powerpc = "ppc" |
| 76 | KLIBC_ARCH:powerpc64 = "ppc64" |
| 77 | KLIBC_ARCH:powerpc64le = "ppc64" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 78 | THIS_LIBKLIBC = "libklibc (= ${PV}-${PR})" |