| 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" | 
| 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-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch \ | 
 | 19 |            file://0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch \ | 
 | 20 |            file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch \ | 
| Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 21 |            file://0001-klibc_2.0.4-add-kexec_file_load-syscall.patch \ | 
 | 22 |            file://0001-klibc-add-getrandom-syscall.patch \ | 
 | 23 |            file://0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch \ | 
| Andrew Geissler | 1548c07 | 2019-02-22 16:03:50 -0600 | [diff] [blame] | 24 |            file://0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch \ | 
| Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 25 |            " | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 |  | 
 | 27 | ARMPATCHES ?= "" | 
 | 28 |  | 
| Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 29 | ARMPATCHES_arm = " \ | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 30 |                   file://armv4-fix-v4bx.patch \ | 
 | 31 |                  " | 
 | 32 |  | 
| Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 33 | SRC_URI[md5sum] = "712f8bc1a069e03d92584b7f5380c521" | 
 | 34 | SRC_URI[sha256sum] = "abef2637ca823485d9c90ce9512e2b08a65047ec4da204635eeaef95a41a9122" | 
 | 35 |  | 
 | 36 | S = "${WORKDIR}/klibc-${PV}" | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 37 |  | 
| Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 38 | OPTFLAGS = "${TUNE_CCARGS} -Os" | 
| Brad Bishop | 90ca747 | 2019-08-20 09:15:15 -0400 | [diff] [blame] | 39 | OPTFLAGS_append_toolchain-clang = " -fno-builtin-bcmp" | 
| Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 40 | OPTFLAGS_append_toolchain-clang_mipsarch = " -no-integrated-as" | 
| Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 41 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 42 | PARALLEL_MAKE = "" | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 43 | EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \ | 
 | 44 |                 'CROSS_COMPILE=${TARGET_PREFIX}' \ | 
 | 45 |                 'KLIBCKERNELSRC=${STAGING_DIR_TARGET}${exec_prefix}' \ | 
 | 46 |                 'KLIBCLIBGCC=${STAGING_DIR_TARGET}${libdir}/${TARGET_SYS}/*/libgcc.a' \ | 
 | 47 |                 'prefix=${exec_prefix}' \ | 
 | 48 |                 'INSTALLROOT=${D}' \ | 
| Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 49 |                 'INSTALLDIR=${libdir}/klibc' \ | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 50 |                 'SHLIBDIR=${libdir}' \ | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 51 |                 '${KLIBCTHUMB}' \ | 
| Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 52 |                 'KLIBCOPTFLAGS=${OPTFLAGS}' \ | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 53 |                  V=1 \ | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 54 |                 " | 
 | 55 |  | 
 | 56 | export FIX_ARMV4_EABI_BX = "${FIX_V4BX}" | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 57 | 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] | 58 |  | 
 | 59 | do_configure () { | 
 | 60 |     ln -sf "${STAGING_DIR_TARGET}${exec_prefix}" linux | 
 | 61 | } | 
 | 62 |  | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 63 | do_compile_prepend_toolchain-clang() { | 
 | 64 |     sed -i -e 's#$(KLIBCROSS)gcc#$(KLIBCROSS)clang#g' ${S}/Makefile | 
 | 65 | } | 
 | 66 |  | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 67 | INHIBIT_PACKAGE_STRIP = "1" | 
 | 68 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | 
 | 69 | INSANE_SKIP_${PN} = "already-stripped" | 
 | 70 | INSANE_SKIP_libklibc-dev = "dev-elf" | 
 | 71 | KLIBC_ARCH = "${TARGET_ARCH}" | 
 | 72 | KLIBC_ARCH_aarch64 = "arm64" | 
 | 73 | KLIBC_ARCH_armeb = "arm" | 
 | 74 | KLIBC_ARCH_mipsel = "mips" | 
| Andrew Geissler | 1548c07 | 2019-02-22 16:03:50 -0600 | [diff] [blame] | 75 | KLIBC_ARCH_mips64el = "mips64" | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 76 | KLIBC_ARCH_x86 = "i386" | 
 | 77 | KLIBC_ARCH_x86-64 = "x86_64" | 
 | 78 | KLIBC_ARCH_powerpc = "ppc" | 
 | 79 | KLIBC_ARCH_powerpc64 = "ppc64" | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 80 | KLIBC_ARCH_powerpc64le = "ppc64" | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 81 | THIS_LIBKLIBC = "libklibc (= ${PV}-${PR})" |