blob: 26689f87e743fd85dce892b49e74d3a8eb26adbd [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 Bishopc1d34332019-09-09 14:56:00 -040026 file://0001-Fix-missing-include-in-sys-mman.h.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080027 "
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028
29ARMPATCHES ?= ""
30
31ARMPATCHES_arm = "file://klibc-config-eabi.patch \
32 file://armv4-fix-v4bx.patch \
33 "
34
Patrick Williamsb48b7b42016-08-17 15:04:38 -050035S = "${WORKDIR}/git"
36
Brad Bishop26bdd442019-08-16 17:08:17 -040037OPTFLAGS = "${TUNE_CCARGS} -Os"
Brad Bishop90ca7472019-08-20 09:15:15 -040038OPTFLAGS_append_toolchain-clang = " -fno-builtin-bcmp"
Brad Bishop26bdd442019-08-16 17:08:17 -040039
Brad Bishop6e60e8b2018-02-01 10:27:11 -050040PARALLEL_MAKE = ""
Patrick Williamsb48b7b42016-08-17 15:04:38 -050041EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \
42 'CROSS_COMPILE=${TARGET_PREFIX}' \
43 'KLIBCKERNELSRC=${STAGING_DIR_TARGET}${exec_prefix}' \
44 'KLIBCLIBGCC=${STAGING_DIR_TARGET}${libdir}/${TARGET_SYS}/*/libgcc.a' \
45 'prefix=${exec_prefix}' \
46 'INSTALLROOT=${D}' \
Patrick Williamsddad1a12017-02-23 20:36:32 -060047 'INSTALLDIR=${libdir}/klibc' \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050048 'SHLIBDIR=${libdir}' \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050049 '${KLIBCTHUMB}' \
Brad Bishop26bdd442019-08-16 17:08:17 -040050 'KLIBCOPTFLAGS=${OPTFLAGS}' \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050051 V=1 \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050052 "
53
54export FIX_ARMV4_EABI_BX = "${FIX_V4BX}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050055KLIBCTHUMB = "${@['CONFIG_KLIBC_THUMB=n', 'CONFIG_KLIBC_THUMB=y'][(d.getVar('ARM_INSTRUCTION_SET') == 'thumb')]}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050056
57do_configure () {
58 ln -sf "${STAGING_DIR_TARGET}${exec_prefix}" linux
59}
60
Brad Bishopd7bf8c12018-02-25 22:55:05 -050061do_compile_prepend_toolchain-clang() {
62 sed -i -e 's#$(KLIBCROSS)gcc#$(KLIBCROSS)clang#g' ${S}/Makefile
63}
64
Patrick Williamsb48b7b42016-08-17 15:04:38 -050065INHIBIT_PACKAGE_STRIP = "1"
66INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
67INSANE_SKIP_${PN} = "already-stripped"
68INSANE_SKIP_libklibc-dev = "dev-elf"
69KLIBC_ARCH = "${TARGET_ARCH}"
70KLIBC_ARCH_aarch64 = "arm64"
71KLIBC_ARCH_armeb = "arm"
72KLIBC_ARCH_mipsel = "mips"
Andrew Geissler1548c072019-02-22 16:03:50 -060073KLIBC_ARCH_mips64el = "mips64"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050074KLIBC_ARCH_x86 = "i386"
75KLIBC_ARCH_x86-64 = "x86_64"
76KLIBC_ARCH_powerpc = "ppc"
77KLIBC_ARCH_powerpc64 = "ppc64"
78THIS_LIBKLIBC = "libklibc (= ${PV}-${PR})"