Change handling for SPL based images (#578)

* Change handling for SPL based images

* Fix script

* Fix path for rauc-hook
This commit is contained in:
Pascal Vizeli 2020-02-10 14:52:03 +01:00 committed by GitHub
parent 66c1b016c9
commit a592fc9866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 37 additions and 14 deletions

View File

@ -5,7 +5,6 @@
`BOOT_SYS`: `BOOT_SYS`:
- efi - efi
- hyprid - hyprid
- spl
- mbr - mbr
HassOS is basicly used GPT. But for use GPT we need own the first 1024 of HassOS is basicly used GPT. But for use GPT we need own the first 1024 of
@ -13,6 +12,12 @@ boot drive. Is that not possible, you can use MBR for your device, they work als
Hyprid and SPL use both a hyprid MBR/GPT table but SPL move the GPT header 8MB for give space to write SPL and boot images before. Hyprid and SPL use both a hyprid MBR/GPT table but SPL move the GPT header 8MB for give space to write SPL and boot images before.
`BOOT_SPL`:
- true
- false
Enable SPL update handling.
`BOOTLOADER`: `BOOTLOADER`:
- uboot - uboot
- barebox - barebox

View File

@ -3,5 +3,6 @@ BOARD_NAME="Asus TinkerBoard"
CHASSIS=embedded CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=spl BOOT_SYS=hyprid
BOOT_SPL=true
BOOT_ENV_SIZE=0x8000 BOOT_ENV_SIZE=0x8000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=mbr BOOT_SYS=mbr
BOOT_SPL=true
BOOT_ENV_SIZE=0x2000 BOOT_ENV_SIZE=0x2000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=mbr BOOT_SYS=mbr
BOOT_SPL=true
BOOT_ENV_SIZE=0x2000 BOOT_ENV_SIZE=0x2000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=mbr BOOT_SYS=mbr
BOOT_SPL=true
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=barebox BOOTLOADER=barebox
KERNEL_FILE=bzImage KERNEL_FILE=bzImage
BOOT_SYS=efi BOOT_SYS=efi
BOOT_SPL=false
DISK_SIZE=6 DISK_SIZE=6

View File

@ -4,4 +4,5 @@ CHASSIS=vm
BOOTLOADER=barebox BOOTLOADER=barebox
KERNEL_FILE=bzImage KERNEL_FILE=bzImage
BOOT_SYS=efi BOOT_SYS=efi
BOOT_SPL=false
DISK_SIZE=6 DISK_SIZE=6

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hyprid BOOT_SYS=hyprid
BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hyprid BOOT_SYS=hyprid
BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hyprid BOOT_SYS=hyprid
BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=hyprid BOOT_SYS=hyprid
BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hyprid BOOT_SYS=hyprid
BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=Image KERNEL_FILE=Image
BOOT_SYS=hyprid BOOT_SYS=hyprid
BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000

View File

@ -4,4 +4,5 @@ CHASSIS=embedded
BOOTLOADER=uboot BOOTLOADER=uboot
KERNEL_FILE=zImage KERNEL_FILE=zImage
BOOT_SYS=hyprid BOOT_SYS=hyprid
BOOT_SPL=false
BOOT_ENV_SIZE=0x4000 BOOT_ENV_SIZE=0x4000

View File

@ -45,7 +45,7 @@ function size2sectors() {
function get_boot_size() { function get_boot_size() {
if [ "${BOOT_SYS}" == "spl" ]; then if [ "${BOOT_SPL}" == "true" ]; then
echo "${BOOT_SIZE[1]}" echo "${BOOT_SIZE[1]}"
else else
echo "${BOOT_SIZE[0]}" echo "${BOOT_SIZE[0]}"
@ -138,7 +138,7 @@ function _create_disk_gpt() {
# Partition layout # Partition layout
# SPL # SPL
if [ "${BOOT_SYS}" == "spl" ]; then if [ "${BOOT_SPL}" == "true" ]; then
sgdisk -j 16384 "${hdd_img}" sgdisk -j 16384 "${hdd_img}"
fi fi
@ -180,10 +180,13 @@ function _create_disk_gpt() {
dd if="${overlay_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${overlay_offset}" dd if="${overlay_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${overlay_offset}"
dd if="${data_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${data_offset}" dd if="${data_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${data_offset}"
# Fix boot # Set Hyprid partition
if [ "${BOOT_SYS}" == "hyprid" ]; then if [ "${BOOT_SYS}" == "hyprid" ]; then
_fix_disk_hyprid _fix_disk_hyprid
elif [ "${BOOT_SYS}" == "spl" ]; then fi
# Write SPL
if [ "${BOOT_SPL}" == "true" ]; then
_fix_disk_spl_gpt _fix_disk_spl_gpt
fi fi
} }
@ -255,8 +258,10 @@ function _create_disk_mbr() {
dd if="${overlay_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${overlay_offset}" dd if="${overlay_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${overlay_offset}"
dd if="${data_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${data_offset}" dd if="${data_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${data_offset}"
# Wripte SPL # Write SPL
if [ "${BOOT_SPL}" == "true" ]; then
_fix_disk_spl_mbr _fix_disk_spl_mbr
fi
} }

View File

@ -23,7 +23,7 @@ function create_ota_update() {
cp -f "${kernel}" "${rauc_folder}/kernel.ext4" cp -f "${kernel}" "${rauc_folder}/kernel.ext4"
cp -f "${boot}" "${rauc_folder}/boot.vfat" cp -f "${boot}" "${rauc_folder}/boot.vfat"
cp -f "${rootfs}" "${rauc_folder}/rootfs.img" cp -f "${rootfs}" "${rauc_folder}/rootfs.img"
cp -f "${BR2_EXTERNAL_HASSOS_PATH}/misc/rauc-hook" "${rauc_folder}/hook" cp -f "${BR2_EXTERNAL_HASSOS_PATH}/ota/rauc-hook" "${rauc_folder}/hook"
( (
echo "[update]" echo "[update]"
@ -41,7 +41,7 @@ function create_ota_update() {
) > "${rauc_folder}/manifest.raucm" ) > "${rauc_folder}/manifest.raucm"
# SPL # SPL
if [ "${BOOT_SYS}" == "spl" ]; then if [ "${BOOT_SPL}" == "true" ]; then
cp -f "${spl}" "${rauc_folder}/spl.img" cp -f "${spl}" "${rauc_folder}/spl.img"
( (

View File

@ -27,7 +27,7 @@ function _write_rauc_boot() {
) >> "${TARGET_DIR}/etc/rauc/system.conf" ) >> "${TARGET_DIR}/etc/rauc/system.conf"
# SPL # SPL
if ! [[ "${BOOT_SYS}" =~ (spl|mbr) ]]; then if ! [ "${BOOT_SPL}" == "true" ]; then
return 0 return 0
fi fi
@ -69,9 +69,9 @@ function write_rauc_config() {
function install_rauc_certs() { function install_rauc_certs() {
if [ "${DEPLOYMENT}" == "production" ]; then if [ "${DEPLOYMENT}" == "production" ]; then
cp "${BR2_EXTERNAL_HASSOS_PATH}/misc/rel-ca.pem" "${TARGET_DIR}/etc/rauc/keyring.pem" cp "${BR2_EXTERNAL_HASSOS_PATH}/ota/rel-ca.pem" "${TARGET_DIR}/etc/rauc/keyring.pem"
else else
cp "${BR2_EXTERNAL_HASSOS_PATH}/misc/dev-ca.pem" "${TARGET_DIR}/etc/rauc/keyring.pem" cp "${BR2_EXTERNAL_HASSOS_PATH}/ota/dev-ca.pem" "${TARGET_DIR}/etc/rauc/keyring.pem"
fi fi
} }