Support custom sized SPL/raw boot region (#2385)

* Support custom sized SPL/raw boot region

This is required for Rockchip which by default stores the U-Boot FIT
image at the 8MiB offset.

* Ignore shellcheck warning
This commit is contained in:
Stefan Agner 2023-03-06 23:06:45 +01:00 committed by GitHub
parent eb3e2ab003
commit 923c22ff9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 27 additions and 8 deletions

View File

@ -4,6 +4,7 @@ CHASSIS=embedded
BOOTLOADER=grub BOOTLOADER=grub
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=efi BOOT_SYS=efi
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
DISK_SIZE=6 DISK_SIZE=6
SUPERVISOR_MACHINE=qemuarm-64 SUPERVISOR_MACHINE=qemuarm-64

View File

@ -4,7 +4,9 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hybrid BOOT_SYS=hybrid
BOOT_SIZE=24M
BOOT_SPL=true BOOT_SPL=true
BOOT_SPL_SIZE=8M
BOOT_ENV_SIZE=0x8000 BOOT_ENV_SIZE=0x8000
SUPERVISOR_MACHINE=tinker SUPERVISOR_MACHINE=tinker
SUPERVISOR_ARCH=armv7 SUPERVISOR_ARCH=armv7

View File

@ -4,7 +4,9 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=mbr BOOT_SYS=mbr
BOOT_SIZE=24M
BOOT_SPL=true BOOT_SPL=true
BOOT_SPL_SIZE=8M
BOOT_ENV_SIZE=0x2000 BOOT_ENV_SIZE=0x2000
SUPERVISOR_MACHINE=odroid-c2 SUPERVISOR_MACHINE=odroid-c2
SUPERVISOR_ARCH=aarch64 SUPERVISOR_ARCH=aarch64

View File

@ -4,7 +4,9 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=mbr BOOT_SYS=mbr
BOOT_SIZE=24M
BOOT_SPL=true BOOT_SPL=true
BOOT_SPL_SIZE=8M
BOOT_ENV_SIZE=0x2000 BOOT_ENV_SIZE=0x2000
SUPERVISOR_MACHINE=odroid-c4 SUPERVISOR_MACHINE=odroid-c4
SUPERVISOR_ARCH=aarch64 SUPERVISOR_ARCH=aarch64

View File

@ -4,7 +4,9 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=mbr BOOT_SYS=mbr
BOOT_SIZE=24M
BOOT_SPL=true BOOT_SPL=true
BOOT_SPL_SIZE=8M
BOOT_ENV_SIZE=0x2000 BOOT_ENV_SIZE=0x2000
SUPERVISOR_MACHINE=odroid-n2 SUPERVISOR_MACHINE=odroid-n2
SUPERVISOR_ARCH=aarch64 SUPERVISOR_ARCH=aarch64

View File

@ -4,7 +4,9 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=mbr BOOT_SYS=mbr
BOOT_SIZE=24M
BOOT_SPL=true BOOT_SPL=true
BOOT_SPL_SIZE=8M
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000
SUPERVISOR_MACHINE=odroid-xu SUPERVISOR_MACHINE=odroid-xu
SUPERVISOR_ARCH=armv7 SUPERVISOR_ARCH=armv7

View File

@ -4,7 +4,9 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=mbr BOOT_SYS=mbr
BOOT_SIZE=24M
BOOT_SPL=true BOOT_SPL=true
BOOT_SPL_SIZE=8M
BOOT_ENV_SIZE=0x2000 BOOT_ENV_SIZE=0x2000
SUPERVISOR_MACHINE=khadas-vim3 SUPERVISOR_MACHINE=khadas-vim3
SUPERVISOR_ARCH=aarch64 SUPERVISOR_ARCH=aarch64

View File

@ -4,6 +4,7 @@ CHASSIS=embedded
BOOTLOADER=grub BOOTLOADER=grub
KERNEL_FILE=bzImage KERNEL_FILE=bzImage
BOOT_SYS=efi BOOT_SYS=efi
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
DISK_SIZE=6 DISK_SIZE=6
SUPERVISOR_MACHINE=generic-x86-64 SUPERVISOR_MACHINE=generic-x86-64

View File

@ -4,6 +4,7 @@ CHASSIS=vm
BOOTLOADER=grub BOOTLOADER=grub
KERNEL_FILE=bzImage KERNEL_FILE=bzImage
BOOT_SYS=efi BOOT_SYS=efi
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
DISK_SIZE=32 DISK_SIZE=32
SUPERVISOR_MACHINE=qemux86-64 SUPERVISOR_MACHINE=qemux86-64

View File

@ -4,6 +4,7 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hybrid BOOT_SYS=hybrid
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000
SUPERVISOR_MACHINE=raspberrypi2 SUPERVISOR_MACHINE=raspberrypi2

View File

@ -4,6 +4,7 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=hybrid BOOT_SYS=hybrid
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000
SUPERVISOR_MACHINE=raspberrypi3-64 SUPERVISOR_MACHINE=raspberrypi3-64

View File

@ -4,6 +4,7 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hybrid BOOT_SYS=hybrid
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000
SUPERVISOR_MACHINE=raspberrypi3 SUPERVISOR_MACHINE=raspberrypi3

View File

@ -4,6 +4,7 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=hybrid BOOT_SYS=hybrid
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000
SUPERVISOR_MACHINE=raspberrypi4-64 SUPERVISOR_MACHINE=raspberrypi4-64

View File

@ -4,6 +4,7 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hybrid BOOT_SYS=hybrid
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000
SUPERVISOR_MACHINE=raspberrypi4 SUPERVISOR_MACHINE=raspberrypi4

View File

@ -4,6 +4,7 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=hybrid BOOT_SYS=hybrid
BOOT_SIZE=32M
BOOT_SPL=false BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000
SUPERVISOR_MACHINE=yellow SUPERVISOR_MACHINE=yellow

View File

@ -10,7 +10,6 @@ KERNEL1_UUID="fc02a4f0-5350-406f-93a2-56cbed636b5f"
OVERLAY_UUID="f1326040-5236-40eb-b683-aaa100a9afcf" OVERLAY_UUID="f1326040-5236-40eb-b683-aaa100a9afcf"
DATA_UUID="a52a4597-fa3a-4851-aefd-2fbe9f849079" DATA_UUID="a52a4597-fa3a-4851-aefd-2fbe9f849079"
BOOT_SIZE=(32M 24M)
BOOTSTATE_SIZE=8M BOOTSTATE_SIZE=8M
SYSTEM_SIZE=256M SYSTEM_SIZE=256M
KERNEL_SIZE=24M KERNEL_SIZE=24M
@ -45,11 +44,8 @@ function size2sectors() {
function get_boot_size() { function get_boot_size() {
if [ "${BOOT_SPL}" == "true" ]; then # shellcheck disable=SC2153
echo "${BOOT_SIZE[1]}" echo "${BOOT_SIZE}"
else
echo "${BOOT_SIZE[0]}"
fi
} }
@ -57,7 +53,7 @@ function create_spl_image() {
local boot_img="$(path_spl_img)" local boot_img="$(path_spl_img)"
rm -f "${boot_img}" rm -f "${boot_img}"
truncate --size=8M "${boot_img}" truncate --size="${BOOT_SPL_SIZE}" "${boot_img}"
} }
@ -199,7 +195,9 @@ function _create_disk_mbr() {
local hdd_img="$(hassos_image_name img)" local hdd_img="$(hassos_image_name img)"
local hdd_count=${DISK_SIZE:-2} local hdd_count=${DISK_SIZE:-2}
local disk_layout="${BINARIES_DIR}/disk.layout" local disk_layout="${BINARIES_DIR}/disk.layout"
local boot_start=$(size2sectors "8M")
# All boards with MBR disk layout have SPL
local boot_start=$(size2sectors "${BOOT_SPL_SIZE}")
local boot_size=$(size2sectors "$(get_boot_size)") local boot_size=$(size2sectors "$(get_boot_size)")
local kernel0_size=$(size2sectors "$KERNEL_SIZE") local kernel0_size=$(size2sectors "$KERNEL_SIZE")