23 lines
2.2 KiB
Bash
23 lines
2.2 KiB
Bash
#!/bin/sh
|
|
# Build the B12/B13 Alpine 3.24.2 aarch64 chroot tarball (RAM-only use on the board: /tmp/alpine tmpfs).
|
|
# minirootfs (sha-checked) + apk add X stack + prune of mesa/LLVM (Xorg does not link them; fbdev/modesetting w/o glamor) + overlay.
|
|
# Ownership/modes are preserved through fakeroot state. -> out/alpine-b13.tar.gz
|
|
set -e; cd "$(dirname "$0")"; A=$PWD/dl/apkst/sbin/apk.static; C=$PWD/dl/apkcache; W=${TMPDIR:-/tmp}/b12-alp.$$; R=$W/root; FS=$W/fakeroot.state
|
|
PKGS="xorg-server xf86-video-fbdev x11vnc xterm twm font-misc-misc xsetroot xdpyinfo e2fsprogs"
|
|
echo "9bf70a7f18ea44094cbb5f70c58f9af129c8214745743db0e68e5502cc2ce773 dl/alpine-minirootfs-3.24.2-aarch64.tar.gz" | sha256sum -c
|
|
mkdir -p $R out; touch $FS
|
|
fakeroot -s $FS tar xzf dl/alpine-minirootfs-3.24.2-aarch64.tar.gz -C $R
|
|
fakeroot -i $FS -s $FS $A --root $R --arch aarch64 --keys-dir $R/etc/apk/keys --cache-dir $C --no-scripts add $PKGS > $W/apk.log
|
|
tail -1 $W/apk.log; grep Installing $W/apk.log | sed 's/.*Installing //' > out/alpine-b13.pkgs
|
|
# prune (documented: apk db still lists mesa/llvm/spirv; files removed to fit RAM)
|
|
P="usr/lib/libLLVM* usr/lib/libgallium-* usr/lib/libSPIRV-Tools* usr/lib/gbm usr/lib/dri usr/lib/xorg/modules/libglamoregl.so usr/lib/xorg/modules/extensions/libglx.so usr/share/hwdata"
|
|
(cd $R && for p in $P; do ls -d $p 2>/dev/null; done) > out/alpine-b13.pruned
|
|
(cd $R && fakeroot -i $FS -s $FS rm -rf $P)
|
|
fakeroot -i $FS -s $FS cp -a alpine/overlay/. $R/
|
|
fakeroot -i $FS -s $FS sh -c "chown -R 0:0 $R/etc/X11/xorg.conf $R/etc/X11/xorg-modesetting.conf $R/usr/local/bin/aurora-x"
|
|
echo "aurora-b13-chroot" > $R/etc/hostname
|
|
# all NEEDED of Xorg, its modules and the X clients must still resolve (catch over-pruning)
|
|
for f in $R/usr/libexec/Xorg $R/usr/lib/xorg/modules/*.so $R/usr/lib/xorg/modules/*/*.so $R/usr/bin/x11vnc $R/usr/bin/xterm $R/usr/bin/twm; do aarch64-linux-gnu-readelf -d $f | sed -n 's/.*NEEDED.*\[\(.*\)\]/\1/p'; done | sort -u | while read n; do [ -e $R/usr/lib/$n ] || [ -e $R/lib/$n ] || { echo "UNRESOLVED $n"; exit 1; }; done
|
|
du -sm $R | awk '{print "rootfs MiB:", $1}'
|
|
(cd $R && fakeroot -i $FS tar --numeric-owner -czf - .) > out/alpine-b13.tar.gz; rm -rf $W
|
|
sha256sum out/alpine-b13.tar.gz; ls -l out/alpine-b13.tar.gz
|