diff --git a/sysa/linux-4.9.10/files/config b/sysa/linux-4.9.10/files/config index 1ccf3fb..408a4e7 100644 --- a/sysa/linux-4.9.10/files/config +++ b/sysa/linux-4.9.10/files/config @@ -177,7 +177,7 @@ CONFIG_SCHED_AUTOGROUP=y # CONFIG_SYSFS_DEPRECATED is not set CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="/sysb" +CONFIG_INITRAMFS_SOURCE="" CONFIG_INITRAMFS_ROOT_UID=0 CONFIG_INITRAMFS_ROOT_GID=0 CONFIG_RD_GZIP=y diff --git a/sysa/linux-4.9.10/linux-4.9.10.sh b/sysa/linux-4.9.10/linux-4.9.10.sh index 4569830..47bf14f 100755 --- a/sysa/linux-4.9.10/linux-4.9.10.sh +++ b/sysa/linux-4.9.10/linux-4.9.10.sh @@ -41,14 +41,6 @@ src_prepare() { } src_compile() { - # Generate the initramfs so we can remove /sysb - make ARCH=i386 prepare - make ARCH=i386 usr/ - mkdir -p "${PREFIX}/boot" - mv usr/initramfs_data.cpio.gz "${PREFIX}/boot/initramfs-sysb" - make clean - rm -rf /sysb - sed -i 's:/sysb::' .config cp .config include/config/auto.conf rm include/generated/autoconf.h generate_autoconf_h @@ -58,5 +50,8 @@ src_compile() { } src_install() { + mkdir -p "${PREFIX}/boot" cp arch/i386/boot/bzImage "${PREFIX}/boot/linux-4.9.10" + cp usr/gen_init_cpio "${PREFIX}/bin" + cp scripts/gen_initramfs_list.sh "${PREFIX}/bin" } diff --git a/sysa/linux-4.9.10/patches/initramfs_list.patch b/sysa/linux-4.9.10/patches/initramfs_list.patch new file mode 100644 index 0000000..a3da57e --- /dev/null +++ b/sysa/linux-4.9.10/patches/initramfs_list.patch @@ -0,0 +1,17 @@ +SPDX-FileCopyrightText: 2021 fosslinux + +SPDX-License-Identifier: GPL-2.0-only + +Use gen_initramfs_list.sh from outside kernel source tree. + +--- scripts/gen_initramfs_list.sh 2021-10-10 20:37:12.220231015 +1100 ++++ scripts/gen_initramfs_list.sh 2021-10-10 20:37:22.694296140 +1100 +@@ -310,7 +310,7 @@ + fi + fi + cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" +- usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} ++ gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} + else + cpio_tfile=${cpio_file} + fi diff --git a/sysa/run.sh b/sysa/run.sh index 9c1f807..76ddc9e 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -22,10 +22,14 @@ create_sysb() { echo "Creating sysb rootfs" mkdir -p /sysb/usr for d in bin include lib libexec sbin share; do - cp -r "${PREFIX}/${d}" "/sysb/usr/${d}" + # Minimise RAM (storage) use - use hard links + cp -rl "${PREFIX}/${d}" "/sysb/usr/${d}" done cp "${SOURCES}/bootstrap.cfg" /sysb/usr/src/bootstrap.cfg populate_device_nodes /sysb + echo "Creating sysb initramfs" + gen_initramfs_list.sh -o "${PREFIX}/boot/initramfs-sysb.cpio.gz" /sysb + rm -rf /sysb # Cleanup } go_sysb() { @@ -35,7 +39,7 @@ go_sysb() { # kexec time echo "Loading kernel + sysb initramfs using kexec" kexec -l "${PREFIX}/boot/linux-4.9.10" --console-serial \ - --initrd="${PREFIX}/boot/initramfs-sysb" \ + --initrd="${PREFIX}/boot/initramfs-sysb.cpio.gz" \ --append="init=/init console=ttyS0" echo "kexecing into sysb" kexec -e @@ -237,10 +241,9 @@ rm -rf "${SOURCES}/mes" if [ "${CHROOT}" = False ]; then build kexec-tools-2.0.22 - create_sysb - build linux-4.9.10 + create_sysb go_sysb fi