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`:
- efi
- hyprid
- spl
- mbr
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.
`BOOT_SPL`:
- true
- false
Enable SPL update handling.
`BOOTLOADER`:
- uboot
- barebox

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ function size2sectors() {
function get_boot_size() {
if [ "${BOOT_SYS}" == "spl" ]; then
if [ "${BOOT_SPL}" == "true" ]; then
echo "${BOOT_SIZE[1]}"
else
echo "${BOOT_SIZE[0]}"
@ -138,7 +138,7 @@ function _create_disk_gpt() {
# Partition layout
# SPL
if [ "${BOOT_SYS}" == "spl" ]; then
if [ "${BOOT_SPL}" == "true" ]; then
sgdisk -j 16384 "${hdd_img}"
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="${data_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${data_offset}"
# Fix boot
# Set Hyprid partition
if [ "${BOOT_SYS}" == "hyprid" ]; then
_fix_disk_hyprid
elif [ "${BOOT_SYS}" == "spl" ]; then
fi
# Write SPL
if [ "${BOOT_SPL}" == "true" ]; then
_fix_disk_spl_gpt
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="${data_img}" of="${hdd_img}" conv=notrunc bs=512 seek="${data_offset}"
# Wripte SPL
_fix_disk_spl_mbr
# Write SPL
if [ "${BOOT_SPL}" == "true" ]; then
_fix_disk_spl_mbr
fi
}

View File

@ -23,7 +23,7 @@ function create_ota_update() {
cp -f "${kernel}" "${rauc_folder}/kernel.ext4"
cp -f "${boot}" "${rauc_folder}/boot.vfat"
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]"
@ -41,7 +41,7 @@ function create_ota_update() {
) > "${rauc_folder}/manifest.raucm"
# SPL
if [ "${BOOT_SYS}" == "spl" ]; then
if [ "${BOOT_SPL}" == "true" ]; then
cp -f "${spl}" "${rauc_folder}/spl.img"
(

View File

@ -27,7 +27,7 @@ function _write_rauc_boot() {
) >> "${TARGET_DIR}/etc/rauc/system.conf"
# SPL
if ! [[ "${BOOT_SYS}" =~ (spl|mbr) ]]; then
if ! [ "${BOOT_SPL}" == "true" ]; then
return 0
fi
@ -69,9 +69,9 @@ function write_rauc_config() {
function install_rauc_certs() {
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
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
}
@ -87,6 +87,6 @@ function install_bootloader_config() {
# Fix MBR
if [ "${BOOT_SYS}" == "mbr" ]; then
mkdir -p "${TARGET_DIR}/usr/lib/udev/rules.d"
cp -f "${BR2_EXTERNAL_HASSOS_PATH}/misc/mbr-part.rules" "${TARGET_DIR}/usr/lib/udev/rules.d/"
cp -f "${BR2_EXTERNAL_HASSOS_PATH}/misc/mbr-part.rules" "${TARGET_DIR}/usr/lib/udev/rules.d/"
fi
}