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" |
| 5 | LICENSE = "BSD-3-Clause & GPL-2.0 & MIT & Zlib" |
| 6 | LIC_FILES_CHKSUM = "file://usr/klibc/LICENSE;md5=d75181f10e998c21eb147f6d2e43ce8b" |
| 7 | DEPENDS = "linux-libc-headers perl-native" |
| 8 | SRCREV = "4d19974d7020488f63651244e1f9f51727c3f66c" |
| 9 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 10 | SRC_URI = "git://git.kernel.org/pub/scm/libs/klibc/klibc.git \ |
| 11 | ${ARMPATCHES} \ |
| 12 | file://klibc-linux-libc-dev.patch \ |
| 13 | file://staging.patch \ |
| 14 | file://klcc-consider-sysroot.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 15 | file://klcc-cross-accept-clang-options.patch \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 16 | file://0001-dash-Specify-format-string-in-fmtstr.patch \ |
| 17 | file://0001-Define-in_-structs-for-non-glibc-system-libs.patch \ |
| 18 | file://0001-include-linux-sysinfo.h-directly.patch \ |
| 19 | file://0001-mkfifo-Implement-mkfifo.patch \ |
| 20 | file://0001-always-use-bfd-linker.patch \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 21 | file://0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch \ |
| 22 | file://0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch \ |
| 23 | file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 24 | file://0001-klibc_2.0.4-add-kexec_file_load-syscall.patch \ |
| 25 | file://0001-klibc-add-getrandom-syscall.patch \ |
| 26 | file://0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch \ |
Andrew Geissler | 1548c07 | 2019-02-22 16:03:50 -0600 | [diff] [blame] | 27 | file://0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 28 | " |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 29 | |
| 30 | ARMPATCHES ?= "" |
| 31 | |
| 32 | ARMPATCHES_arm = "file://klibc-config-eabi.patch \ |
| 33 | file://armv4-fix-v4bx.patch \ |
| 34 | " |
| 35 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 36 | S = "${WORKDIR}/git" |
| 37 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 38 | PARALLEL_MAKE = "" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 39 | EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \ |
| 40 | 'CROSS_COMPILE=${TARGET_PREFIX}' \ |
| 41 | 'KLIBCKERNELSRC=${STAGING_DIR_TARGET}${exec_prefix}' \ |
| 42 | 'KLIBCLIBGCC=${STAGING_DIR_TARGET}${libdir}/${TARGET_SYS}/*/libgcc.a' \ |
| 43 | 'prefix=${exec_prefix}' \ |
| 44 | 'INSTALLROOT=${D}' \ |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 45 | 'INSTALLDIR=${libdir}/klibc' \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 46 | 'SHLIBDIR=${libdir}' \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 47 | '${KLIBCTHUMB}' \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 48 | 'KLIBCOPTFLAGS=${TUNE_CCARGS} -Os' \ |
| 49 | V=1 \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 50 | " |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 51 | EXTRA_OEMAKE += "'EXTRA_KLIBCAFLAGS=${SECURITY_CFLAGS} -Wa,--noexecstack' \ |
| 52 | 'EXTRA_KLIBCLDFLAGS=${SECURITY_LDFLAGS} -z noexecstack'" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 53 | |
| 54 | export FIX_ARMV4_EABI_BX = "${FIX_V4BX}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 55 | 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] | 56 | |
| 57 | do_configure () { |
| 58 | ln -sf "${STAGING_DIR_TARGET}${exec_prefix}" linux |
| 59 | } |
| 60 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 61 | do_compile_prepend_toolchain-clang() { |
| 62 | sed -i -e 's#$(KLIBCROSS)gcc#$(KLIBCROSS)clang#g' ${S}/Makefile |
| 63 | } |
| 64 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 65 | INHIBIT_PACKAGE_STRIP = "1" |
| 66 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" |
| 67 | INSANE_SKIP_${PN} = "already-stripped" |
| 68 | INSANE_SKIP_libklibc-dev = "dev-elf" |
| 69 | KLIBC_ARCH = "${TARGET_ARCH}" |
| 70 | KLIBC_ARCH_aarch64 = "arm64" |
| 71 | KLIBC_ARCH_armeb = "arm" |
| 72 | KLIBC_ARCH_mipsel = "mips" |
Andrew Geissler | 1548c07 | 2019-02-22 16:03:50 -0600 | [diff] [blame] | 73 | KLIBC_ARCH_mips64el = "mips64" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 74 | KLIBC_ARCH_x86 = "i386" |
| 75 | KLIBC_ARCH_x86-64 = "x86_64" |
| 76 | KLIBC_ARCH_powerpc = "ppc" |
| 77 | KLIBC_ARCH_powerpc64 = "ppc64" |
| 78 | THIS_LIBKLIBC = "libklibc (= ${PV}-${PR})" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 79 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 80 | GCCPIE ?= "" |
| 81 | SECURITY_LDFLAGS = "${@'-z relro -z now -pie' if '${GCCPIE}' else ''}" |
| 82 | SECURITY_LDFLAGS_mips = "" |
Andrew Geissler | 1548c07 | 2019-02-22 16:03:50 -0600 | [diff] [blame] | 83 | SECURITY_LDFLAGS_mipsel = "" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 84 | SECURITY_LDFLAGS_mips64 = "" |
Andrew Geissler | 1548c07 | 2019-02-22 16:03:50 -0600 | [diff] [blame] | 85 | SECURITY_LDFLAGS_mips64el = "" |