1*cf5a6c84SAndroid Build Coastguard Worker#!/bin/bash 2*cf5a6c84SAndroid Build Coastguard Worker 3*cf5a6c84SAndroid Build Coastguard Worker# tar up completed system images to send to website, with READMEs 4*cf5a6c84SAndroid Build Coastguard Worker 5*cf5a6c84SAndroid Build Coastguard Workerrm -f root/toybox-* root/*.tgz 6*cf5a6c84SAndroid Build Coastguard Workerfor i in root/*/fs/bin/toybox 7*cf5a6c84SAndroid Build Coastguard Workerdo 8*cf5a6c84SAndroid Build Coastguard Worker cp $i root/toybox-$(echo $i | sed 's@root/\([^/]*\)/.*@\1@') || exit 1 9*cf5a6c84SAndroid Build Coastguard Workerdone 10*cf5a6c84SAndroid Build Coastguard Worker 11*cf5a6c84SAndroid Build Coastguard Workerfor i in root/*/run-qemu.sh 12*cf5a6c84SAndroid Build Coastguard Workerdo 13*cf5a6c84SAndroid Build Coastguard Worker i=${i%/run-qemu.sh} j=${i#root/} 14*cf5a6c84SAndroid Build Coastguard Worker [ ! -e "$i" ] && continue 15*cf5a6c84SAndroid Build Coastguard Worker # Add README, don't include "fs" dir (you can extract it from cpio.gz) 16*cf5a6c84SAndroid Build Coastguard Worker cp mkroot/README.root $i/docs/README && 17*cf5a6c84SAndroid Build Coastguard Worker tar cvzfC $i.tgz root --exclude=fs $j || exit 1 18*cf5a6c84SAndroid Build Coastguard Workerdone 19*cf5a6c84SAndroid Build Coastguard Worker 20*cf5a6c84SAndroid Build Coastguard Worker# Generate top level README 21*cf5a6c84SAndroid Build Coastguard WorkerKVERS=$(toybox sed -n '3s@# Linux/[^ ]* \(.*\) Kernel Configuration@\1@p' root/*/docs/linux-fullconfig) 22*cf5a6c84SAndroid Build Coastguard Workercat > root/README << EOF 23*cf5a6c84SAndroid Build Coastguard WorkerBootable system images created by: 24*cf5a6c84SAndroid Build Coastguard Worker 25*cf5a6c84SAndroid Build Coastguard Worker mkroot/mkroot.sh LINUX=~/linux CROSS=allnonstop 26*cf5a6c84SAndroid Build Coastguard Worker 27*cf5a6c84SAndroid Build Coastguard WorkerEach system image is built from two packages: toybox and linux. 28*cf5a6c84SAndroid Build Coastguard WorkerThe run-qemu.sh script in each tarball should boot the system 29*cf5a6c84SAndroid Build Coastguard Workerto a shell prompt under qemu, exit from that shell to shut down the 30*cf5a6c84SAndroid Build Coastguard Workervirtual system and stop the emulator. 31*cf5a6c84SAndroid Build Coastguard Worker 32*cf5a6c84SAndroid Build Coastguard WorkerSee https://landley.net/toybox/faq.html#mkroot for details. 33*cf5a6c84SAndroid Build Coastguard Worker 34*cf5a6c84SAndroid Build Coastguard WorkerBuilt from mkroot $(git describe --tags), and Linux $KVERS with patches in linux-patches/ 35*cf5a6c84SAndroid Build Coastguard WorkerEOF 36*cf5a6c84SAndroid Build Coastguard Worker 37*cf5a6c84SAndroid Build Coastguard Workerif [ $# -eq 2 ] 38*cf5a6c84SAndroid Build Coastguard Workerthen 39*cf5a6c84SAndroid Build Coastguard Worker scp root/toybox-* "$1/$2/" && 40*cf5a6c84SAndroid Build Coastguard Worker scp root/*.tgz root/README "$1/mkroot/$2/" 41*cf5a6c84SAndroid Build Coastguard Workerfi 42