Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkimage: fix reading /flash on Windows on RK devices #41

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions projects/Rockchip/packages/u-boot/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ PKG_DEPENDS_TARGET="toolchain Python3 swig:host rkbin glibc pyelftools:host"
PKG_LONGDESC="Rockchip U-Boot is a bootloader for embedded systems."
PKG_PATCH_DIRS+="${DEVICE}"

PKG_NEED_UNPACK="$PROJECT_DIR/$PROJECT/bootloader"

case ${DEVICE} in
RK3588*)
PKG_VERSION="ad0cfba1ac51e8dd8b039f6c56b9c9f9a679df91"
Expand Down
29 changes: 5 additions & 24 deletions scripts/mkimage
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down