mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-28 15:36:29 +00:00
Avoid custom GPT location (#2386)
Currently the only board supporting GPT partition table and SPL is the ASUS Tinker board. Its Rockchip boot loader is stored at LBA 0x40 (64) which is well past the last LBA of a regular GPT partition table which is at LBA 33). Therefor a custom GPT main partition table location (via sgdisk -j, --adjust-main-table=sector) is not necessary. Technically we could copy anything after LBA 34 from the SPL image, but since we don't support a board which needs that space for its SPL let's stick with the well aligned Rockchip start at LBA 64. Note: To preserve the layout we still add the SPL size to the regular offset. Technically we could start the boot partition at LBA 16384, but this would mean a different partition table compared to before and different offset of subsequent partitions compared to other GPT platforms.
This commit is contained in:
parent
923c22ff9e
commit
9ce0766353
@ -41,7 +41,7 @@ install_spl() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${PART_LABEL}" = "gpt" ]; then
|
if [ "${PART_LABEL}" = "gpt" ]; then
|
||||||
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=512 seek=2 skip=2
|
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=512 seek=64 skip=64
|
||||||
else
|
else
|
||||||
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=1 count=440
|
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=1 count=440
|
||||||
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=512 seek=1 skip=1
|
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=512 seek=1 skip=1
|
||||||
|
@ -131,13 +131,12 @@ function _create_disk_gpt() {
|
|||||||
##
|
##
|
||||||
# Partition layout
|
# Partition layout
|
||||||
|
|
||||||
# SPL
|
|
||||||
if [ "${BOOT_SPL}" == "true" ]; then
|
|
||||||
sgdisk -j 16384 "${hdd_img}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# boot
|
# boot
|
||||||
boot_offset="$(sgdisk -F "${hdd_img}")"
|
boot_offset="$(sgdisk -F "${hdd_img}")"
|
||||||
|
if [ "${BOOT_SPL}" == "true" ]; then
|
||||||
|
# Make sure boot partition is shifted by SPL size
|
||||||
|
boot_offset=$((boot_offset+$(size2sectors "${BOOT_SPL_SIZE}")))
|
||||||
|
fi
|
||||||
sgdisk -n "0:${boot_offset}:+$(get_boot_size)" -c 0:"hassos-boot" -t 0:"C12A7328-F81F-11D2-BA4B-00A0C93EC93B" -u 0:${BOOT_UUID} "${hdd_img}"
|
sgdisk -n "0:${boot_offset}:+$(get_boot_size)" -c 0:"hassos-boot" -t 0:"C12A7328-F81F-11D2-BA4B-00A0C93EC93B" -u 0:${BOOT_UUID} "${hdd_img}"
|
||||||
|
|
||||||
# Kernel 0
|
# Kernel 0
|
||||||
@ -276,7 +275,9 @@ function _fix_disk_spl_gpt() {
|
|||||||
|
|
||||||
sgdisk -t 1:"E3C9E316-0B5C-4DB8-817D-F92DF00215AE" "${hdd_img}"
|
sgdisk -t 1:"E3C9E316-0B5C-4DB8-817D-F92DF00215AE" "${hdd_img}"
|
||||||
dd if="${BR2_EXTERNAL_HASSOS_PATH}/bootloader/mbr-spl.img" of="${hdd_img}" conv=notrunc bs=512 count=1
|
dd if="${BR2_EXTERNAL_HASSOS_PATH}/bootloader/mbr-spl.img" of="${hdd_img}" conv=notrunc bs=512 count=1
|
||||||
dd if="${spl_img}" of="${hdd_img}" conv=notrunc bs=512 seek=2 skip=2
|
|
||||||
|
# Copy SPL, make sure to not overwrite GPT
|
||||||
|
dd if="${spl_img}" of="${hdd_img}" conv=notrunc bs=512 seek=64 skip=64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user