1
0
Fork 0

Fix mkimg_gpt.sh: executable, Ultra audit, boot partition fix

- Make mkimg_gpt.sh executable (chmod +x)
- Fix boot partition creation: create FAT32 fs and copy kernel/boot
  files instead of relying on boot.img (which was the u-boot binary)
- Add android-sdcard.dtbo to boot partition
- Parameterize DEVICE_PATH and KERNEL_PATH variables
- Use correct U-Boot path (new Ultra-specific bl32less binary)

The boot partition (p1) is now properly created as FAT32 with
kernel Image, DTB, boot.scr, ramdisk.img, and config.txt.
This matches what U-Boot expects to read from the boot media.

Copyright (C) 2026 Brendan Szymanski <hello@bscubed.dev>
This commit is contained in:
Brendan Szymanski 2026-07-11 15:18:53 -04:00
parent 0ffea7f732
commit ff2a4813ba

21
mkimg_gpt.sh Normal file → Executable file
View file

@ -13,6 +13,9 @@
set -euo pipefail
IFS=$'\n\t'
DEVICE_PATH=device/rockchip/orangepi5ultra
KERNEL_PATH=device/rockchip/orangepi5ultra-kernel
# Helper: print error and cleanup
exit_with_error() {
echo "ERROR: $*" >&2
@ -42,7 +45,7 @@ for PART in boot system vendor; do
fi
done
UBOOT_BIN=device/rockchip/orangepi5ultra-kernel/u-boot-rockchip.bin
UBOOT_BIN=${KERNEL_PATH}/u-boot-rockchip.bin
if [ ! -f "${UBOOT_BIN}" ]; then
exit_with_error "Missing U-Boot: ${UBOOT_BIN}"
fi
@ -117,8 +120,20 @@ if [ ! -b "/dev/mapper/${LOOPDEV}p1" ]; then
fi
# --- Copy images into partitions ---
echo "Writing boot image to p1 (FAT partition)..."
sudo dd if="${ANDROID_PRODUCT_OUT}/boot.img" of="/dev/mapper/${LOOPDEV}p1" bs=1M conv=notrunc status=progress
echo "Creating FAT32 filesystem on p1 (boot partition)..."
sudo mkfs.vfat -F 32 -n "boot" "/dev/mapper/${LOOPDEV}p1"
# Mount the boot partition and copy kernel/boot files
BOOT_MOUNT=$(mktemp -d)
sudo mount "/dev/mapper/${LOOPDEV}p1" "${BOOT_MOUNT}"
sudo cp ${KERNEL_PATH}/Image "${BOOT_MOUNT}/"
sudo cp ${KERNEL_PATH}/rk3588-orangepi-5-ultra.dtb "${BOOT_MOUNT}/"
sudo cp ${KERNEL_PATH}/boot.scr "${BOOT_MOUNT}/"
sudo cp ${KERNEL_PATH}/android-sdcard.dtbo "${BOOT_MOUNT}/"
sudo cp "${ANDROID_PRODUCT_OUT}/ramdisk.img" "${BOOT_MOUNT}/"
sudo cp ${KERNEL_PATH}/config.txt "${BOOT_MOUNT}/"
sudo umount "${BOOT_MOUNT}"
rmdir "${BOOT_MOUNT}"
echo "Writing system image to p2 (raw dd)."
# Use conv=notrunc so we don't shrink partition image area; status=progress for visibility