#!/bin/bash # B5b candidate: minimal ext2 image, exactly cache-sized (134217728 B), deterministic. Offline only. set -e cd ~/doc/modem/jz08-aurora/b5b OUT=${1:-cache-extlinux-mm1.img} ST=$(mktemp -d) mkdir -p $ST/extlinux cp components/Image.gz-dtb components/aurora-mm1.dtb components/initramfs.cpio.gz $ST/ printf "default mm1\nlabel mm1\n\tlinux /Image.gz-dtb\n\tfdt /aurora-mm1.dtb\n\tinitrd /initramfs.cpio.gz\n\tappend %s\n" "$(cat components/cmdline.txt)" > $ST/extlinux/extlinux.conf cp $ST/extlinux/extlinux.conf extlinux.conf chmod 0644 $ST/*.* $ST/extlinux/extlinux.conf; chmod 0755 $ST $ST/extlinux find $ST -exec touch -h -d @1790000000 {} + rm -f $OUT; truncate -s 134217728 $OUT E2FSPROGS_FAKE_TIME=1790000000 /sbin/mke2fs -F -q -t ext2 -O none,filetype,sparse_super \ -b 4096 -I 128 -N 64 -m 0 -L aurora-mm1 -U 4a5a3038-b5b0-4000-8000-00000000b5b0 \ -E root_owner=0:0,hash_seed=4a5a3038-b5b0-4000-8000-00000000b5b1 -d $ST $OUT 32768 rm -rf $ST for f in / /lost+found /extlinux /extlinux/extlinux.conf /Image.gz-dtb /aurora-mm1.dtb /initramfs.cpio.gz; do for t in atime ctime mtime; do echo "sif $f $t @1790000000"; done; done > /tmp/b5b-sif.$$ /sbin/debugfs -w -f /tmp/b5b-sif.$$ $OUT >/dev/null 2>&1; rm -f /tmp/b5b-sif.$$ stat -c "%n %s" $OUT; sha256sum $OUT