mkimage: fix reading /flash on Windows on RK devices

This commit is contained in:
spycat88 2024-04-02 23:14:10 +01:00
parent 37e4a438ad
commit fab1c5481e

View file

@ -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