Boots into initramfs then switch_root

This commit is contained in:
2026-03-26 09:00:28 +08:00
parent 8acf025a9d
commit 215eb0dc75
11 changed files with 173 additions and 32 deletions

View File

@@ -7,6 +7,14 @@ set -euo pipefail
mkdir -p "$ROOTFS/var/cache/apk"
mkdir -p "$ROOTFS/opt/monok8s/config"
mkdir -p "$ROOTFS/build"
mkdir -p \
"$ROOTFS/dev" \
"$ROOTFS/proc" \
"$ROOTFS/sys" \
"$ROOTFS/run" \
"$ROOTFS/data" \
"$ROOTFS/var" \
"$ROOTFS/tmp"
mount --bind /var/cache/apk "$ROOTFS/var/cache/apk"
mount --bind /dev "$ROOTFS/dev"
@@ -72,6 +80,8 @@ mount "${TMP_LOOP}p4" /mnt/data
# Put the real /var onto the data partition
cp -a "$ROOTFS/var" /mnt/data/
mkdir -p /mnt/data/etc-overlay/work
mkdir -p /mnt/data/etc-overlay/upper
# Copy rootfs to root partition, but exclude /var
cp -a "$ROOTFS"/. /mnt/img-root/
@@ -79,9 +89,7 @@ rm -rf /mnt/img-root/var
mkdir -p /mnt/img-root/var
mkdir -p /mnt/img-root/boot
cp /build/Image.gz /mnt/img-root/boot/Image.gz
cp /build/board.itb /mnt/img-root/boot/kernel.itb
cp /build/${DEVICE_TREE_TARGET}.dtb /mnt/img-root/boot/${DEVICE_TREE_TARGET}.dtb
sync
umount /mnt/img-root