Script to tar up mkroot output for web page, with top level README.

This commit is contained in:
Rob Landley 2023-07-25 11:39:29 -05:00
parent 5586ab90d0
commit 18ebd3e4e7
2 changed files with 49 additions and 0 deletions

18
mkroot/README.root Normal file
View File

@ -0,0 +1,18 @@
Use ./run-qemu.sh to boot system image to a shell prompt, "exit" when done.
Additional arguments to run-qemu.sh are QEMU arguments,
$KARGS contains additional linux kernel arguments. For example:
KARGS=quiet ./run-qemu.sh -hda docs/linux-fullconfig
# cat /dev/?da
# exit
To extract the root filesystem from cpio.gz and chroot into it
( mkdir fs && cd fs && zcat ../initramfs.cpio.gz | cpio -i -d -H newc )
chroot fs /init
To recreate the initramfs.cpio.gz from fs directory
( cd fs && find . -printf '%P\n' | cpio -o -H newc -R +0:+0 | gzip ) \
> initramfs.cpio.gz

31
mkroot/tar-for-web.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# tar up completed system images to send to website, with READMEs
for i in root/*/run-qemu.sh
do
i=${i%/run-qemu.sh} j=${i#root/}
[ ! -e "$i" ] && continue
# Add README, don't include "fs" dir (you can extract it from cpio.gz)
cp mkroot/README.root $i/docs/README &&
tar cvzfC $i.tgz root --exclude=fs $j || break
done
# Add top level README
KVERS=$(toybox sed -n '3s@# Linux/[^ ]* \(.*\) Kernel Configuration@\1@p' root/*/docs/linux-fullconfig)
cat > root/README << EOF
Bootable system images created by:
mkroot/mkroot.sh LINUX=~/linux CROSS=allnonstop
Each system image is built from two packages: toybox and Linux.
Run the ./qemu-*.sh script in the tarball to boot the system
to a shell prompt under qemu. Run the "exit" command to shut down the
virtual system and exit the emulator.
See https://landley.net/toybox/FAQ.html#mkroot for details.
Built from mkroot $(git describe --tags), and Linux $KVERS with patches in linux-patches/
EOF
# scp root/*.tgz root/README website:dir