Automatically update deviceinfo, extlinux fdt, and boot.img when switching target devices

This commit is contained in:
Luxferre committed 2026-11-02 08:02:01 +02:00
1 parent 49830e137d
commit 699444d717
2 files changed
+22 -5

No files matched your search

+6 -2
View File
@@ -405,8 +405,11 @@ EOF
depmod -b "$ROOTFS" 6.12.1-msm8916
if [ "$RUN_MKINITFS" = "--mkinitfs" ] || [ ! -f "$ROOTFS/boot/initramfs" ]; then
echo "[2/5] Running depmod and mkinitfs inside $ROOTFS..."
# Automatically regenerate boot.img/initramfs if switching target devices
LAST_DEV_FILE="$ROOTFS/boot/.bananarchy_target_device"
LAST_DEV="$(cat "$LAST_DEV_FILE" 2>/dev/null || true)"
if [ "$RUN_MKINITFS" = "--mkinitfs" ] || [ ! -f "$ROOTFS/boot/initramfs" ] || [ "$LAST_DEV" != "$TARGET_DEVICE" ]; then
echo "[2/5] Running depmod and mkinitfs inside $ROOTFS (target: $TARGET_DEVICE)..."
rm -rf "$ROOTFS/tmp/hostbin"
mkdir -p "$ROOTFS/tmp/hostbin"
cp /bin/busybox.static "$ROOTFS/tmp/hostbin/busybox.static"
@@ -446,6 +449,7 @@ EOF
ln -sf /bin/busybox "$ROOTFS/bin/sh"
rm -rf "$ROOTFS/tmp/hostbin" "$ROOTFS/lib/ld-musl-x86_64.so.1" "$ROOTFS/proc/1"
echo "$TARGET_DEVICE" > "$LAST_DEV_FILE"
else
echo "[2/5] Using existing $ROOTFS/boot/initramfs (pass --mkinitfs to regenerate)..."
fi