blob: 580544867119075333fa12e93c679bb477fe6b5e [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"
Brad Bishop19323692019-04-05 15:28:33 -04008SRCREV = "22b36d1ae34416bc48869619cbb0cccb2070f48f"
Patrick Williamsb48b7b42016-08-17 15:04:38 -05009
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010SRC_URI = "git://git.kernel.org/pub/scm/libs/klibc/klibc.git \
11 ${ARMPATCHES} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050012 file://klcc-consider-sysroot.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080013 file://klcc-cross-accept-clang-options.patch \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050014 file://0001-dash-Specify-format-string-in-fmtstr.patch \
15 file://0001-Define-in_-structs-for-non-glibc-system-libs.patch \
16 file://0001-include-linux-sysinfo.h-directly.patch \
17 file://0001-mkfifo-Implement-mkfifo.patch \
18 file://0001-always-use-bfd-linker.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019 file://0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch \
20 file://0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch \
21 file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022 file://0001-klibc_2.0.4-add-kexec_file_load-syscall.patch \
23 file://0001-klibc-add-getrandom-syscall.patch \
24 file://0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch \
Andrew Geissler1548c072019-02-22 16:03:50 -060025 file://0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080026 "
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027
28ARMPATCHES ?= ""
29
30ARMPATCHES_arm = "file://klibc-config-eabi.patch \
31 file://armv4-fix-v4bx.patch \
32 "
33
Patrick Williamsb48b7b42016-08-17 15:04:38 -050034S = "${WORKDIR}/git"
35
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036PARALLEL_MAKE = ""
Patrick Williamsb48b7b42016-08-17 15:04:38 -050037EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \
38 'CROSS_COMPILE=${TARGET_PREFIX}' \
39 'KLIBCKERNELSRC=${STAGING_DIR_TARGET}${exec_prefix}' \
40 'KLIBCLIBGCC=${STAGING_DIR_TARGET}${libdir}/${TARGET_SYS}/*/libgcc.a' \
41 'prefix=${exec_prefix}' \
42 'INSTALLROOT=${D}' \
Patrick Williamsddad1a12017-02-23 20:36:32 -060043 'INSTALLDIR=${libdir}/klibc' \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050044 'SHLIBDIR=${libdir}' \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050045 '${KLIBCTHUMB}' \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050046 'KLIBCOPTFLAGS=${TUNE_CCARGS} -Os' \
47 V=1 \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050048 "
49
50export FIX_ARMV4_EABI_BX = "${FIX_V4BX}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050051KLIBCTHUMB = "${@['CONFIG_KLIBC_THUMB=n', 'CONFIG_KLIBC_THUMB=y'][(d.getVar('ARM_INSTRUCTION_SET') == 'thumb')]}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050052
53do_configure () {
54 ln -sf "${STAGING_DIR_TARGET}${exec_prefix}" linux
55}
56
Brad Bishopd7bf8c12018-02-25 22:55:05 -050057do_compile_prepend_toolchain-clang() {
58 sed -i -e 's#$(KLIBCROSS)gcc#$(KLIBCROSS)clang#g' ${S}/Makefile
59}
60
Patrick Williamsb48b7b42016-08-17 15:04:38 -050061INHIBIT_PACKAGE_STRIP = "1"
62INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
63INSANE_SKIP_${PN} = "already-stripped"
64INSANE_SKIP_libklibc-dev = "dev-elf"
65KLIBC_ARCH = "${TARGET_ARCH}"
66KLIBC_ARCH_aarch64 = "arm64"
67KLIBC_ARCH_armeb = "arm"
68KLIBC_ARCH_mipsel = "mips"
Andrew Geissler1548c072019-02-22 16:03:50 -060069KLIBC_ARCH_mips64el = "mips64"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050070KLIBC_ARCH_x86 = "i386"
71KLIBC_ARCH_x86-64 = "x86_64"
72KLIBC_ARCH_powerpc = "ppc"
73KLIBC_ARCH_powerpc64 = "ppc64"
74THIS_LIBKLIBC = "libklibc (= ${PV}-${PR})"