From 18ebd3e4e76a1120d5b4c3e6e9bf944ea45198e6 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 25 Jul 2023 11:39:29 -0500 Subject: [PATCH] Script to tar up mkroot output for web page, with top level README. --- mkroot/README.root | 18 ++++++++++++++++++ mkroot/tar-for-web.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 mkroot/README.root create mode 100755 mkroot/tar-for-web.sh diff --git a/mkroot/README.root b/mkroot/README.root new file mode 100644 index 00000000..c50d728c --- /dev/null +++ b/mkroot/README.root @@ -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 diff --git a/mkroot/tar-for-web.sh b/mkroot/tar-for-web.sh new file mode 100755 index 00000000..31bd9fe7 --- /dev/null +++ b/mkroot/tar-for-web.sh @@ -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 -- 2.39.2