blob: 30294b19a8277e50d2fd0327f383b70ac49e638b [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001DESCRIPTION = "klibc is intended to be a minimalistic libc subset for \
2use with initramfs. It is deliberately written for small size, \
3minimal entaglement, and portability, not speed."
4SECTION = "libs"
5LICENSE = "BSD-3-Clause & GPL-2.0 & MIT & Zlib"
6LIC_FILES_CHKSUM = "file://usr/klibc/LICENSE;md5=d75181f10e998c21eb147f6d2e43ce8b"
7DEPENDS = "linux-libc-headers perl-native"
8SRCREV = "4d19974d7020488f63651244e1f9f51727c3f66c"
9
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010SRC_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 \
15 file://0001-dash-Specify-format-string-in-fmtstr.patch \
16 file://0001-Define-in_-structs-for-non-glibc-system-libs.patch \
17 file://0001-include-linux-sysinfo.h-directly.patch \
18 file://0001-mkfifo-Implement-mkfifo.patch \
19 file://0001-always-use-bfd-linker.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050020 file://0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch \
21 file://0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch \
22 file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023"
24
25ARMPATCHES ?= ""
26
27ARMPATCHES_arm = "file://klibc-config-eabi.patch \
28 file://armv4-fix-v4bx.patch \
29 "
30
Patrick Williamsb48b7b42016-08-17 15:04:38 -050031
32S = "${WORKDIR}/git"
33
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034PARALLEL_MAKE = ""
Patrick Williamsb48b7b42016-08-17 15:04:38 -050035EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \
36 'CROSS_COMPILE=${TARGET_PREFIX}' \
37 'KLIBCKERNELSRC=${STAGING_DIR_TARGET}${exec_prefix}' \
38 'KLIBCLIBGCC=${STAGING_DIR_TARGET}${libdir}/${TARGET_SYS}/*/libgcc.a' \
39 'prefix=${exec_prefix}' \
40 'INSTALLROOT=${D}' \
Patrick Williamsddad1a12017-02-23 20:36:32 -060041 'INSTALLDIR=${libdir}/klibc' \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050042 'SHLIBDIR=${libdir}' \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050043 '${KLIBCTHUMB}' \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050044 'KLIBCOPTFLAGS=${TUNE_CCARGS} -Os' \
45 V=1 \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050046 "
47
48export FIX_ARMV4_EABI_BX = "${FIX_V4BX}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050049KLIBCTHUMB = "${@['CONFIG_KLIBC_THUMB=n', 'CONFIG_KLIBC_THUMB=y'][(d.getVar('ARM_INSTRUCTION_SET') == 'thumb')]}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050050
51do_configure () {
52 ln -sf "${STAGING_DIR_TARGET}${exec_prefix}" linux
53}
54
Brad Bishopd7bf8c12018-02-25 22:55:05 -050055do_compile_prepend_toolchain-clang() {
56 sed -i -e 's#$(KLIBCROSS)gcc#$(KLIBCROSS)clang#g' ${S}/Makefile
57}
58
Patrick Williamsb48b7b42016-08-17 15:04:38 -050059INHIBIT_PACKAGE_STRIP = "1"
60INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
61INSANE_SKIP_${PN} = "already-stripped"
62INSANE_SKIP_libklibc-dev = "dev-elf"
63KLIBC_ARCH = "${TARGET_ARCH}"
64KLIBC_ARCH_aarch64 = "arm64"
65KLIBC_ARCH_armeb = "arm"
66KLIBC_ARCH_mipsel = "mips"
67KLIBC_ARCH_x86 = "i386"
68KLIBC_ARCH_x86-64 = "x86_64"
69KLIBC_ARCH_powerpc = "ppc"
70KLIBC_ARCH_powerpc64 = "ppc64"
71THIS_LIBKLIBC = "libklibc (= ${PV}-${PR})"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072
73SECURITY_CFLAGS = "-fno-PIE -no-pie"
74SECURITY_LDFLAGS = "-no-pie"