From fab1c5481e336eb28d9227a99c40c046158662b4 Mon Sep 17 00:00:00 2001 From: spycat88 Date: Tue, 2 Apr 2024 23:14:10 +0100 Subject: [PATCH] mkimage: fix reading /flash on Windows on RK devices --- scripts/mkimage | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/scripts/mkimage b/scripts/mkimage index 966dbb206..516c71a2a 100755 --- a/scripts/mkimage +++ b/scripts/mkimage @@ -68,41 +68,22 @@ sync # create partitions echo "image: creating partitions..." -if [ "${PARTITION_TABLE}" = "gpt" ] && [ "${BOOTLOADER}" = "u-boot" ] -then - echo "image: creating SPL partition(s)." - parted -s "${DISK}" unit s mkpart ${UBOOT_LABEL} 16384 24575 >/dev/null 2>&1 - parted -s "${DISK}" unit s mkpart ${TRUST_LABEL} 24576 32767 >/dev/null 2>&1 -fi - SYSTEM_PART_END=$(( ${SYSTEM_PART_START} + (${SYSTEM_SIZE} * 1024 * 1024 / 512) - 1 )) STORAGE_PART_START=$(( ${SYSTEM_PART_END} + 1 )) STORAGE_PART_END=$(( ${STORAGE_PART_START} + (${STORAGE_SIZE} * 1024 * 1024 / 512) - 1 )) if [ "${PARTITION_TABLE}" = "gpt" ]; then echo "image: Create GPT boot partition." - parted -s "${DISK}" -a min unit s mkpart boot fat32 ${SYSTEM_PART_START} ${SYSTEM_PART_END} + parted -s "${DISK}" -a min unit s mkpart system fat32 ${SYSTEM_PART_START} ${SYSTEM_PART_END} + parted -s "${DISK}" -a min unit s mkpart storage ext4 ${STORAGE_PART_START} ${STORAGE_PART_END} + parted -s "${DISK}" set 1 legacy_boot on else echo "image: Create MBR boot partition." - parted -s "${DISK}" -a min unit s mkpart primary fat32 ${SYSTEM_PART_START} ${SYSTEM_PART_END} + parted -s "${DISK}" -a min unit s mkpart primary fat32 ${SYSTEM_PART_START} ${SYSTEM_PART_END} + parted -s "${DISK}" -a min unit s mkpart primary ext4 ${STORAGE_PART_START} ${STORAGE_PART_END} parted -s "${DISK}" set 1 boot on fi -if [ "${PARTITION_TABLE}" = "gpt" ]; then - echo "image: Create GPT storage partition." - parted -s "${DISK}" -a min unit s mkpart storage ext4 ${STORAGE_PART_START} ${STORAGE_PART_END} - else - echo "image: Create MBR Storage partition." - parted -s "${DISK}" -a min unit s mkpart primary ext4 ${STORAGE_PART_START} ${STORAGE_PART_END} -fi -sync - -if [ "${PARTITION_TABLE}" = "gpt" ] && [ "${BOOTLOADER}" = "u-boot" ]; then - echo "image: Set OS partition as boot" - parted -s "${DISK}" set 3 boot on -fi -sync - echo "image: creating sparse file for part2..." STORAGE_PART_COUNT=$(( ${STORAGE_PART_END} - ${STORAGE_PART_START} + 1 )) sync