Shuffle around the creation of sysb

For further RAM savings, we want to create sysb -without- having linux
tarball extracted at the same time. To accomplish this, we move the
gen_init_cpio + related script out of the tree and create it afterward.

Also use hard links to free up some more space.
This commit is contained in:
fosslinux 2021-10-11 07:54:23 +11:00 committed by Andrius Štikonas
parent 732af79cdd
commit f12897265c
4 changed files with 28 additions and 13 deletions

View file

@ -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