Skip to content

Commit

Permalink
Script to tar up mkroot output for web page, with top level README.
Browse files Browse the repository at this point in the history
  • Loading branch information
landley committed Jul 25, 2023
1 parent 5586ab9 commit 18ebd3e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mkroot/README.root
Original file line number Diff line number Diff line change
@@ -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 changes: 31 additions & 0 deletions mkroot/tar-for-web.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 18ebd3e

Please sign in to comment.