1*4882a593Smuzhiyun# the binaries are statically linked against klibc
2*4882a593SmuzhiyunSUMMARY = "Kexec tools, statically compiled against klibc"
3*4882a593SmuzhiyunAUTHOR = "Eric Biederman"
4*4882a593SmuzhiyunHOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/kexec/"
5*4882a593SmuzhiyunSECTION = "kernel/userland"
6*4882a593SmuzhiyunLICENSE = "GPL-2.0-only"
7*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \
8*4882a593Smuzhiyun                    file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09"
9*4882a593SmuzhiyunPV = "2.0.18+git${SRCPV}"
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunDEPENDS = "zlib xz"
12*4882a593Smuzhiyun
13*4882a593Smuzhiyuninherit klibc autotools siteinfo
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git;branch=master"
16*4882a593SmuzhiyunSRCREV = "5750980cdbbc33ef75bfba6660295b932376ce15"
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunBUILD_PATCHES = "file://0001-force-static-build.patch \
19*4882a593Smuzhiyun                 file://0002-Adjust-the-order-of-headers-to-fix-build-for-musl.patch"
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunKLIBC_PATCHES += " \
22*4882a593Smuzhiyun            file://0003-kexec-elf-rel-use-our-elf.h.patch \
23*4882a593Smuzhiyun            file://0004-kexec-elf-exec.c-replace-with-our-err.h.patch \
24*4882a593Smuzhiyun            file://0005-crashdump-elf.c-work-around-for-sysconf-_SC_NPROCESS.patch \
25*4882a593Smuzhiyun            file://0006-kexec-syscall.h-work-around-missing-syscall-wrapper.patch \
26*4882a593Smuzhiyun            file://0007-kexec.c-add-guard-around-ENOTSUP.patch \
27*4882a593Smuzhiyun            file://0008-kexec.c-replace-mising-BLKGETSIZE64.patch \
28*4882a593Smuzhiyun            file://0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch \
29*4882a593Smuzhiyun            file://0010-fs2dt.c-work-around-missing-getline.patch \
30*4882a593Smuzhiyun            file://0011-purgatory-Makefile-adapt-to-klcc.patch \
31*4882a593Smuzhiyun            file://0012-purgatory-string.c-avoid-inclusion-of-string.h.patch \
32*4882a593Smuzhiyun            file://0013-sha256.h-avoid-inclusion-of-sys-types.h.patch \
33*4882a593Smuzhiyun            file://0014-add-if_nameindex-from-musl.patch \
34*4882a593Smuzhiyun            file://0015-vmcore-dmesg-fix-warning.patch \
35*4882a593Smuzhiyun            file://klibc-reboot.patch \
36*4882a593Smuzhiyun            file://include_next.patch \
37*4882a593Smuzhiyun            "
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunWARNING_FIXES = ""
40*4882a593SmuzhiyunFROM_OE_CORE = "file://arm_crashdump-fix-buffer-align.patch \
41*4882a593Smuzhiyun                file://powerpc_change-the-memory-size-limit.patch \
42*4882a593Smuzhiyun                file://kexec-x32.patch"
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunSRC_URI += "${BUILD_PATCHES} ${KLIBC_PATCHES} ${WARNING_FIXES} ${FROM_OE_CORE}"
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunSRC_URI:append:arm = " file://arm_crashdump.patch"
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunSRC_URI:append:mips = " file://140-mips_disable_devicetree_support.patch"
49*4882a593SmuzhiyunSRC_URI:append:mipsel = " file://140-mips_disable_devicetree_support.patch"
50*4882a593Smuzhiyun
51*4882a593SmuzhiyunSRC_URI:append:x86 = " file://x86_sys_io.patch file://x86_basename.patch \
52*4882a593Smuzhiyun                       file://x86_vfscanf.patch file://x86_kexec_test.patch"
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunSRC_URI:append:x86-64 = " file://x86_sys_io.patch file://x86_basename.patch \
55*4882a593Smuzhiyun                          file://x86_vfscanf.patch file://x86_kexec_test.patch"
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunSRC_URI:append:aarch64 = " file://arm64_kexec-image-header.h-add-missing-le64toh.patch \
58*4882a593Smuzhiyun                           file://arm64-crashdump-arm64.c-fix-warning.patch \
59*4882a593Smuzhiyun                           file://arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch"
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunSRC_URI:append:powerpc = " file://powerpc-purgatory-Makefile-remove-unknown-flags.patch"
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunS = "${WORKDIR}/git"
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunEXTRA_OECONF += "--without-zlib --without-lzma --without-xen"
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun# fix purgatory/printf.c:2:10: fatal error: limits.h: No such file or directory
68*4882a593Smuzhiyun# fix include/limits.h:42:10: fatal error: bitsize/limits.h: No such file or directory
69*4882a593SmuzhiyunCFLAGS += "-O2 -I${STAGING_DIR_HOST}${libdir}/klibc/include -I${S}/purgatory/include \
70*4882a593Smuzhiyun           -I${STAGING_DIR_HOST}${libdir}/klibc/include/bits${SITEINFO_BITS}"
71*4882a593Smuzhiyun
72*4882a593Smuzhiyundo_compile:prepend() {
73*4882a593Smuzhiyun    # Remove the prepackaged config.h from the source tree as it overrides
74*4882a593Smuzhiyun    # the same file generated by configure and placed in the build tree
75*4882a593Smuzhiyun    rm -f ${S}/include/config.h
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun    # Remove the '*.d' file to make sure the recompile is OK
78*4882a593Smuzhiyun    for dep in `find ${B} -type f -name '*.d'`; do
79*4882a593Smuzhiyun        dep_no_d="`echo $dep | sed 's#.d$##'`"
80*4882a593Smuzhiyun        # Remove file.d when there is a file.o
81*4882a593Smuzhiyun        if [ -f "$dep_no_d.o" ]; then
82*4882a593Smuzhiyun            rm -f $dep
83*4882a593Smuzhiyun        fi
84*4882a593Smuzhiyun    done
85*4882a593Smuzhiyun}
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunPACKAGES =+ "kexec-klibc vmcore-dmesg-klibc"
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunFILES:kexec-klibc = "${sbindir}/kexec"
90*4882a593SmuzhiyunFILES:vmcore-dmesg-klibc = "${sbindir}/vmcore-dmesg"
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunINSANE_SKIP:${PN} = "arch"
93*4882a593Smuzhiyun
94*4882a593SmuzhiyunCOMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)'
95