initramfs to also use merge-rootfs
This commit is contained in:
9
initramfs/build-rootfs.sh
Executable file
9
initramfs/build-rootfs.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
mkdir -p bin sbin etc proc sys dev lib mnt usr/bin usr/sbin
|
||||
|
||||
/build/selective-mods.sh /out/rootfs/lib/modules/$(ls /out/rootfs/lib/modules/) ./
|
||||
/build/merge-rootfs.sh "/build/rootfs-extra" "./"
|
||||
|
||||
find . -print0 | cpio --null -ov --format=newc | gzip -9 > ../initramfs.cpio.gz
|
||||
67
initramfs/rootfs-extra/bin/flash-emmc.sh.tmpl
Executable file
67
initramfs/rootfs-extra/bin/flash-emmc.sh.tmpl
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
MNT=/mnt
|
||||
USB_DEV=/dev/sda
|
||||
EMMC_DEV=/dev/mmcblk0
|
||||
DEFAULT_GLOB="${MNT}/$${BUILD_TAG}_RELEASE_IMAGE"
|
||||
|
||||
mkdir -p "$MNT"
|
||||
|
||||
echo "[*] Mounting USB..."
|
||||
mount "$USB_DEV" "$MNT"
|
||||
|
||||
# Find a default image (first match)
|
||||
DEFAULT_IMG="$(ls $DEFAULT_GLOB 2>/dev/null | head -n1 || true)"
|
||||
|
||||
echo
|
||||
if [ -n "$DEFAULT_IMG" ]; then
|
||||
echo "Default image found:"
|
||||
echo " $DEFAULT_IMG"
|
||||
else
|
||||
echo "No default image found under $DEFAULT_GLOB"
|
||||
fi
|
||||
echo
|
||||
|
||||
# Prompt user
|
||||
printf "Image Location (%s): " "${DEFAULT_IMG:-/mnt/...}"
|
||||
read -r IMG
|
||||
|
||||
# Use default if empty
|
||||
if [ -z "$IMG" ]; then
|
||||
IMG="$DEFAULT_IMG"
|
||||
fi
|
||||
|
||||
# Validate
|
||||
if [ -z "$IMG" ] || [ ! -f "$IMG" ]; then
|
||||
echo "Invalid image: $IMG"
|
||||
umount "$MNT" || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "About to write:"
|
||||
echo " Image: $IMG"
|
||||
echo " Target: $EMMC_DEV"
|
||||
echo
|
||||
|
||||
printf "Type 'YES' to continue: "
|
||||
read -r CONFIRM
|
||||
|
||||
if [ "$CONFIRM" != "YES" ]; then
|
||||
echo "Aborted."
|
||||
umount "$MNT" || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[*] Flashing..."
|
||||
gunzip -c "$IMG" > "$EMMC_DEV"
|
||||
|
||||
echo "[*] Syncing..."
|
||||
sync
|
||||
|
||||
echo "[*] Done."
|
||||
umount "$MNT" || true
|
||||
|
||||
echo "[*] Rebooting..."
|
||||
reboot -f
|
||||
@@ -14,6 +14,8 @@ mount -t devpts devpts /dev/pts
|
||||
echo "Booting kernel took $(cut -d' ' -f1 /proc/uptime) seconds."
|
||||
echo "Dropping to shell on ttyS0..."
|
||||
|
||||
. /etc/build-info
|
||||
|
||||
while true; do
|
||||
setsid cttyhack /bin/sh
|
||||
echo "Shell exited. Starting another one..."
|
||||
Reference in New Issue
Block a user