commit: dcfc952708ed4d6f7ffd303178d7b72e79c6aa3c Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> AuthorDate: Sat Mar 23 04:58:03 2019 +0000 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> CommitDate: Sat Mar 23 08:06:18 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=dcfc9527
Try to compile gen_init_cpio if missing gen_init_cpio is required in append_devices(). However, when KERNEL_OUTPUTDIR was cleaned, this file is missing. Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> gen_compile.sh | 17 +++++++++++++++++ gen_initramfs.sh | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/gen_compile.sh b/gen_compile.sh index d08d1e5..14d059d 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -244,6 +244,23 @@ apply_patches() { fi } +compile_gen_init_cpio() { + local gen_init_cpio_SRC="${KERNEL_DIR}/usr/gen_init_cpio.c" + local gen_init_cpio_DIR="${KERNEL_OUTPUTDIR}/usr" + + print_info 1 "$(getIndent 2)>> Compiling gen_init_cpio..." + + [ ! -e "${gen_init_cpio_SRC}" ] && gen_die "'${gen_init_cpio_SRC}' is missing. Cannot compile gen_init_cpio!" + [ ! -d "${gen_init_cpio_DIR}" ] && mkdir "${gen_init_cpio_DIR}" + + export_utils_args + + ${CC} -O2 "${KERNEL_DIR}/usr/gen_init_cpio.c" -o "${KERNEL_OUTPUTDIR}/usr/gen_init_cpio" -Wl,--no-as-needed || + gen_die 'Failed to compile gen_init_cpio!' + + unset_utils_args +} + compile_generic() { local RET [ "$#" -lt '2' ] && diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 5cafd11..f4706a5 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -63,6 +63,10 @@ log_future_cpio_content() { } append_devices() { + if [[ ! -x "${KERNEL_OUTPUTDIR}/usr/gen_init_cpio" ]]; then + compile_gen_init_cpio + fi + # WARNING, does NOT support appending to cpio! cat >"${TEMP}/initramfs-base-temp.devices" <<-EOF dir /dev 0755 0 0