Initial Raspberry Pi 5 support (#2914)

* Add initial Raspberry Pi 5 buildroot config

* Add machine-id support via cmdline.txt

* Add new entry if entry is missing

* Don't overwrite cmdline.txt when adding machine-id

Use sed to append the new cmdline parameter to the first line.

* Skeleton script for RAUC custom bootloader interface

* Deploy kernel/device-tree into a RAUC slot specific directory

This allows us to use the os_prefix feature to switch between slot A and
B. Compared to the boot_partition option, this option allows to use a
shared config.txt and cmdline.txt, which makes it more like how HAOS
currently works on other Raspberry Pis.

* Deploy new kernel/device-tree to correct slot on installation

* Increase boot size to 128MB

This makes sure we can store up to three kernels (slot A, B and an
temporary one while installing the OTA update).

* Initial tryboot implementation using os_prefix

* Make sure to delete the old slot completely

* Add Busybox xargs for tryboot bootloader script

* Compare tryboot bootloader file silently

* Revert "Increase boot size to 128MB"

This reverts commit 7f2c69b58f.

* Use compressed kernel

* Address shellcheck

* Address shellcheck issue in rauc-hook

* Fix shellcheck for rpi-tryboot.sh

* Do not follow source - it gets checked separately

* Correctly set the slot to boot

* Apply suggestions from code review

Co-authored-by: Jan Čermák <sairon@users.noreply.github.com>

* Drop serial console from default cmdline.txt

* Resync rpi5_64_defconfig with rpi4_64_defconfig

* Improve machine-id match

Only match actual hexadecimal characters.

* Deploy firmware overlays to OS prefix directory

* Add Raspberry Pi 5 to documentation

* Bump buildroot

* buildroot fd1dc86f40...f13ad03408 (1):
  > linux: add in-tree device tree overlay support

* Install device tree overlays from Kernel sources

* Drop RPi RF modules for now

No Raspberry Pi 5 specific device tree overlays are  available, drop RPi
RF mod for now.

* Use Raspberry 5 specific identifiers for Supervisor/OS Agent

* Bump buildroot

* buildroot f13ad03408...07e08e01b2 (1):
  > linux: fix add in-tree device tree overlay support

* Revert "Drop RPi RF modules for now"

This reverts commit 46fc1701e4.

---------

Co-authored-by: Jan Čermák <sairon@users.noreply.github.com>
This commit is contained in:
Stefan Agner 2023-12-12 13:19:26 +01:00 committed by GitHub
parent ac089a2d8e
commit 8e1016dcaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 406 additions and 11 deletions

View File

@ -5,6 +5,7 @@
The following boards/devices are supported:
- Raspberry Pi
- Pi 5 ([4 GB](https://www.raspberrypi.com/products/raspberry-pi-5/?variant=raspberry-pi-5-4gb) and [8 GB](https://www.raspberrypi.com/products/raspberry-pi-5/?variant=raspberry-pi-5-8gb) model) 64-bit
- Pi 4 Model B ([1 GB](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-1gb), [2 GB](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-2gb), [4 GB](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-4gb) and [8 GB](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-8gb) model) 32-bit or 64-bit (recommended)
- [Pi 3 Model B](https://www.raspberrypi.com/products/raspberry-pi-3-model-b/) and [B+](https://www.raspberrypi.com/products/raspberry-pi-3-model-b-plus/) 32-bit or 64-bit (recommended)
- [Pi 2](https://www.raspberrypi.com/products/raspberry-pi-2-model-b/) (not recommended)
@ -39,6 +40,7 @@ Notes:
|Board|Build|Config|Docs|
|-----|----|------|----|
|Pi5 64-bit |`make rpi5_64` |[rpi5_64](../../buildroot-external/configs/rpi5_64_defconfig)|[raspberrypi](./raspberrypi/)|
|Pi4B 64-bit |`make rpi4_64` |[rpi4_64](../../buildroot-external/configs/rpi4_64_defconfig)|[raspberrypi](./raspberrypi/)|
|Pi4B 32-bit |`make rpi4` |[rpi4](../../buildroot-external/configs/rpi4_defconfig)|[raspberrypi](./raspberrypi/)|
|Pi3B 64-bit |`make rpi3_64` |[rpi3_64](../../buildroot-external/configs/rpi3_64_defconfig)|[raspberrypi](./raspberrypi/)|

View File

@ -8,6 +8,7 @@
| Raspberry Pi 2 B |2015 | not recommended | [rpi2](../../../buildroot-external/configs/rpi2_defconfig) |
| Raspberry Pi 3 B/B+ |2016/2018 | yes | [rpi3](../../../buildroot-external/configs/rpi3_defconfig) / [rpi3_64](../../../buildroot-external/configs/rpi3_64_defconfig) |
| Raspberry Pi 4 B |2019 | yes | [rpi4](../../../buildroot-external/configs/rpi4_defconfig) / [rpi4_64](../../../buildroot-external/configs/rpi4_64_defconfig) |
| Raspberry Pi 5 |2023 | yes (beta) | [rpi5_64](../../../buildroot-external/configs/rpi5_64_defconfig) |
## Serial console

View File

@ -11,6 +11,7 @@ Default Kernel tree: 6.1
| Raspberry Pi 2 | 6.1.63 |
| Raspberry Pi 3 | 6.1.63 |
| Raspberry Pi 4 | 6.1.63 |
| Raspberry Pi 5 | 6.1.63 |
| Home Assistant Yellow | 6.1.63 |
| Home Assistant Green | 6.1.67 |
| Tinker Board | 6.1.67 |

@ -1 +1 @@
Subproject commit fd1dc86f40662ddbcabbf55a27a26acefec0df41
Subproject commit 07e08e01b29933ea2370acb4a39c779a72e05c7d

View File

@ -0,0 +1 @@
zram.enabled=1 zram.num_devices=3 rootwait cgroup_enable=memory fsck.repair=yes console=tty1 root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro rauc.slot=A

View File

@ -0,0 +1,53 @@
# For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# Additional overlays and parameters are documented
# /boot/firmware/overlays/README
# Automatically load overlays for detected cameras
camera_auto_detect=1
# Automatically load overlays for detected DSI displays
display_auto_detect=1
# Automatically load initramfs files, if found
auto_initramfs=1
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1
# Run in 64-bit mode
arm_64bit=1
# Disable compensation for displays with overscan
disable_overscan=1
# Run as fast as firmware / board allows
arm_boost=1
# Use OS prefix for A/B slot (RAUC)
os_prefix=slot-A/
cmdline=/cmdline.txt
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]

View File

@ -0,0 +1,20 @@
#!/bin/bash
# shellcheck disable=SC2155
function hassos_pre_image() {
local BOOT_DATA="$(path_boot_dir)"
mkdir -p "${BOOT_DATA}/slot-A/"
cp "${BINARIES_DIR}"/*.dtb "${BOOT_DATA}/slot-A/"
gzip --stdout "${BINARIES_DIR}"/Image > "${BOOT_DATA}/slot-A/kernel_2712.img"
cp -r "${BINARIES_DIR}/overlays/" "${BOOT_DATA}/slot-A/"
cp "${BINARIES_DIR}"/*.dtbo "${BOOT_DATA}/slot-A/overlays/" 2>/dev/null || true
cp "${BOARD_DIR}/config.txt" "${BOOT_DATA}/config.txt"
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
}
function hassos_post_image() {
convert_disk_image_xz
}

View File

@ -0,0 +1,11 @@
BOARD_ID=rpi5-64
BOARD_NAME="RaspberryPi 5 64bit"
CHASSIS=embedded
BOOTLOADER=tryboot
KERNEL_FILE=Image
BOOT_SYS=gpt
BOOT_SIZE=64M
BOOT_SPL=false
BOOT_ENV_SIZE=0x4000
SUPERVISOR_MACHINE=raspberrypi5-64
SUPERVISOR_ARCH=aarch64

View File

@ -0,0 +1,25 @@
# shellcheck shell=sh
# Shell script functions to manipulate kernel cmdline
# Function to get the value of a key from a command line string
get_value() {
key="$1"
cmdline_string="$2"
# Split the command line string by whitespace and then by '=' using xargs
echo "$cmdline_string" | xargs -n1 | grep "^$key=" | cut -d= -f2-
}
# Function to set or update the value of a key in a command line string
set_value() {
key="$1"
new_value="$2"
cmdline_string="$3"
# Use sed to replace the value of the key if it exists, or add a new key-value pair
if echo "$cmdline_string" | grep -q "$key="; then
echo "$cmdline_string" | sed "s/$key=[^ ]*/$key=$new_value/"
else
echo "$cmdline_string $key=$new_value"
fi
}

View File

@ -0,0 +1,101 @@
#!/bin/sh
# shellcheck source=/dev/null # Our GitHub Actions tests this separately
. /usr/lib/rauc/cmdline.sh
# RAUC hook script for Raspberry Pi firmwaree tryboot
# Meant to be usesd as a RAUC bootloader-custom-backend script.
boot_dir="/mnt/boot"
root_slot_a="PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd"
root_slot_b="PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20"
case "$1" in
get-primary)
# Actions to be performed when getting the primary bootloader
# Example: Output the path to the current primary bootloader
echo "tryboot get-primary" >&2
cmdline=$(head -n1 "${boot_dir}/cmdline.txt")
get_value rauc.slot "${cmdline}"
;;
set-primary)
# Actions to be performed when setting the primary bootloader
# Example: Set the specified bootloader as the primary one
slot_bootname="$2"
echo "tryboot set-primary $slot_bootname" >&2
cmdline=$(head -n1 "${boot_dir}/cmdline.txt")
if [ "${slot_bootname}" = "A" ]; then
cmdline=$(set_value root "${root_slot_a}" "${cmdline}")
elif [ "${slot_bootname}" = "B" ]; then
cmdline=$(set_value root "${root_slot_b}" "${cmdline}")
else
exit 1
fi
cmdline=$(set_value rauc.slot "${slot_bootname}" "${cmdline}")
echo "${cmdline}" > "${boot_dir}/cmdline-tryboot.txt"
sed -e "s/^\(os_prefix=\)slot-[A-Z]\/$/\1slot-${slot_bootname}\//" \
-e "s/^\(cmdline=\).*$/\1\/cmdline-tryboot.txt/" \
"${boot_dir}/config.txt" > "${boot_dir}/tryboot.txt"
# Use tryboot to try booting the new primary on reboot
echo "0 tryboot" > /run/systemd/reboot-param
;;
get-state)
# Actions to be performed when getting the bootloader state
# Example: Output the current state of the bootloader
# You need to implement logic to determine the state (good or bad) based on the slot.bootname
slot_bootname="$2"
echo "tryboot get-state $slot_bootname" >&2
if [ -f "${boot_dir}/slot-${slot_bootname}/.good" ]; then
echo "returning good" >&2
echo "good"
else
echo "returning bad" >&2
echo "bad"
fi
;;
set-state)
# Actions to be performed when setting the bootloader state
# Example: Set the specified state for the bootloader
slot_bootname="$2"
new_state="$3"
echo "tryboot set-state $slot_bootname $new_state" >&2
if [ "${new_state}" = "good" ]; then
touch "${boot_dir}/slot-${slot_bootname}/.good"
else
rm -f "${boot_dir}/slot-${slot_bootname}/.good"
exit 0
fi
# It seems we call set-state in any case. Use this to "commit" tryboot
# state...
# Check if tryboot is active
if ! cmp -s -n 4 /proc/device-tree/chosen/bootloader/tryboot /dev/zero; then
cmdline_tryboot=$(head -n1 "${boot_dir}/cmdline-tryboot.txt")
tryboot_slot=$(get_value rauc.slot "${cmdline_tryboot}")
if [ "${tryboot_slot}" != "${slot_bootname}" ]; then
echo "tryboot doesn't reflect the expected boot slot, not committing." >&2
exit 1
fi
echo "Committing tryboot state to primary boot" >&2
mv "${boot_dir}/tryboot.txt" "${boot_dir}/config.txt"
mv "${boot_dir}/cmdline-tryboot.txt" "${boot_dir}/cmdline.txt"
fi
;;
get-current)
# We don't have a better detection then /proc/cmdline...
echo "Cannot reliably determine current slot with tryboot" >&2
exit 1
;;
*)
echo "Unknown operation: $1"
exit 1
;;
esac
exit 0

View File

@ -480,7 +480,7 @@ CONFIG_GREP=y
# CONFIG_EGREP is not set
# CONFIG_FGREP is not set
# CONFIG_FEATURE_GREP_CONTEXT is not set
# CONFIG_XARGS is not set
CONFIG_XARGS=y
# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set

View File

@ -0,0 +1,145 @@
BR2_aarch64=y
BR2_cortex_a76=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_DL_DIR="/cache/dl"
BR2_CCACHE=y
BR2_CCACHE_DIR="/cache/cc"
BR2_OPTIMIZE_2=y
BR2_ENABLE_LTO=y
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_HASSOS_PATH)/patches $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/patches"
BR2_SSP_REGULAR=y
BR2_TARGET_GENERIC_HOSTNAME="homeassistant"
BR2_TARGET_GENERIC_ISSUE="Welcome to Home Assistant"
BR2_INIT_SYSTEMD=y
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_HASSOS_PATH)/rootfs-overlay $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rootfs-overlay $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi5-64/rootfs-overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi5-64 $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi5-64/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/stable_20231123.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2712"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support-wireless.config $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/kernel.config"
BR2_LINUX_KERNEL_LZ4=y
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2712-rpi-5-b"
BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
BR2_LINUX_KERNEL_INSTALL_INTREE_OVERLAYS=y
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_HASSOS_PATH)/busybox.config"
BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y
BR2_PACKAGE_V4L2LOOPBACK=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_JQ=y
BR2_PACKAGE_CIFS_UTILS=y
BR2_PACKAGE_DOSFSTOOLS=y
BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_E2FSPROGS_E2IMAGE=y
BR2_PACKAGE_NFS_UTILS=y
# BR2_PACKAGE_NFS_UTILS_RPC_NFSD is not set
BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI=y
BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI_BT=y
BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI_WIFI=y
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_QUALCOMM_6174A_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX_BT=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_6003=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_6004=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_7010=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9170=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271=y
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XX=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_SD8787=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_SD8797=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8797=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8801=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_SD8887=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_SD8897=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8897=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7610E=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT76X2E=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_RTW88=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_815X=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y
BR2_PACKAGE_DBUS_BROKER=y
BR2_PACKAGE_GPTFDISK=y
BR2_PACKAGE_GPTFDISK_SGDISK=y
# BR2_PACKAGE_LVM2_STANDARD_INSTALL is not set
BR2_PACKAGE_NVME=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_USB_MODESWITCH_DATA=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_LIBDNET=y
BR2_PACKAGE_LIBCGROUP=y
BR2_PACKAGE_LIBCGROUP_TOOLS=y
BR2_PACKAGE_BLUEZ5_UTILS=y
BR2_PACKAGE_BLUEZ5_UTILS_CLIENT=y
BR2_PACKAGE_BLUEZ5_UTILS_TOOLS=y
BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_AUDIO=y
BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_HID=y
BR2_PACKAGE_DHCP=y
BR2_PACKAGE_DHCP_CLIENT=y
BR2_PACKAGE_DROPBEAR=y
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_IPTABLES_NFTABLES=y
BR2_PACKAGE_IPTABLES_NFTABLES_DEFAULT=y
BR2_PACKAGE_NETWORK_MANAGER=y
BR2_PACKAGE_NETWORK_MANAGER_CLI=y
BR2_PACKAGE_RPCBIND=y
BR2_PACKAGE_WIRELESS_REGDB=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_WEXT=y
BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y
BR2_PACKAGE_WPA_SUPPLICANT_DBUS=y
BR2_PACKAGE_WPA_SUPPLICANT_DBUS_INTROSPECTION=y
BR2_PACKAGE_APPARMOR=y
BR2_PACKAGE_APPARMOR_PROFILES=y
BR2_PACKAGE_TINI=y
BR2_PACKAGE_DOCKER_CLI=y
BR2_PACKAGE_DOCKER_ENGINE=y
BR2_PACKAGE_PROCPS_NG=y
BR2_PACKAGE_RAUC=y
BR2_PACKAGE_RAUC_DBUS=y
BR2_PACKAGE_RAUC_NETWORK=y
BR2_PACKAGE_SYSTEMD_JOURNAL_REMOTE=y
BR2_PACKAGE_SYSTEMD_COREDUMP=y
# BR2_PACKAGE_SYSTEMD_HWDB is not set
BR2_PACKAGE_SYSTEMD_LOGIND=y
# BR2_PACKAGE_SYSTEMD_NETWORKD is not set
BR2_PACKAGE_SYSTEMD_RANDOMSEED=y
BR2_PACKAGE_UTIL_LINUX_LOGIN=y
BR2_PACKAGE_UTIL_LINUX_NOLOGIN=y
BR2_PACKAGE_UTIL_LINUX_PARTX=y
BR2_PACKAGE_UTIL_LINUX_SULOGIN=y
BR2_PACKAGE_UTIL_LINUX_ZRAMCTL=y
BR2_TARGET_ROOTFS_SQUASHFS=y
BR2_TARGET_ROOTFS_SQUASHFS4_LZ4=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_E2FSPROGS=y
BR2_PACKAGE_HOST_GPTFDISK=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_RAUC=y
BR2_PACKAGE_GASKET=y
BR2_PACKAGE_HASSIO=y
BR2_PACKAGE_HASSIO_ARCH="aarch64"
BR2_PACKAGE_HASSIO_MACHINE="raspberrypi5-64"
BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_OS_AGENT_BOARD="RaspberryPi5"
BR2_PACKAGE_PI_BLUETOOTH=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y

View File

@ -12,7 +12,8 @@ hooks=install;
[image.kernel]
filename=kernel.img
{{- if eq (env "BOOTLOADER") "grub" }}
{{- $bootloader := (env "BOOTLOADER") }}
{{- if or (eq $bootloader "grub") (eq $bootloader "tryboot") }}
hooks=post-install;
{{- end }}

View File

@ -2,6 +2,12 @@
set -o errexit
# shellcheck disable=SC2317 # Being usesd in trap which shellcheck can't follow
cleanup_boot() {
umount "${BOOT_NEW}"
rm -rf "${BOOT_TMP}" "${BOOT_NEW}"
}
install_boot() {
BOOT_TMP=/tmp/boot-tmp
BOOT_NEW=/tmp/boot-new
@ -15,21 +21,24 @@ install_boot() {
systemctl start mnt-boot.mount
fi
mount "${RAUC_IMAGE_NAME}" "${BOOT_NEW}"
trap cleanup_boot EXIT
# Avoid stale/old overlays
rm -f "${BOOT_MNT}"/overlays/* || true
# Backup boot config
cp -f "${BOOT_MNT}"/*.txt "${BOOT_TMP}/" || true
# Update
cp -rf "${BOOT_NEW}"/* "${BOOT_MNT}/"
if [ "$RAUC_SYSTEM_COMPATIBLE" = "haos-rpi5-64" ]; then
rm -rf "${BOOT_MNT}/slot-default"
cp -r "${BOOT_NEW}/slot-A" "${BOOT_MNT}/slot-default"
else
# Backup boot config
cp -f "${BOOT_MNT}"/*.txt "${BOOT_TMP}/" || true
# Restore boot config
cp -f "${BOOT_TMP}"/*.txt "${BOOT_MNT}/" || true
cp -rf "${BOOT_NEW}"/* "${BOOT_MNT}/"
umount "${BOOT_NEW}"
rm -rf "${BOOT_TMP}" "${BOOT_NEW}"
# Restore boot config
cp -f "${BOOT_TMP}"/*.txt "${BOOT_MNT}/" || true
fi
}
install_spl() {
@ -91,6 +100,12 @@ post_install_kernel() {
cp -f "${BOOT_MNT}/EFI/BOOT/grubenv-${RAUC_SLOT_BOOTNAME}" "${BOOT_MNT}"/EFI/BOOT/grubenv
echo "Copied default GRUB environment grubenv-${RAUC_SLOT_BOOTNAME} as grubenv."
fi
# Copy new OS to appropriate directory
if [ "$RAUC_SYSTEM_COMPATIBLE" = "haos-rpi5-64" ]; then
rm -rf "${BOOT_MNT}/slot-${RAUC_SLOT_BOOTNAME}"
mv "${BOOT_MNT}/slot-default" "${BOOT_MNT}/slot-${RAUC_SLOT_BOOTNAME}"
fi
}
##

View File

@ -2,7 +2,11 @@
compatible={{ env "ota_compatible" }}
mountprefix=/run/rauc
statusfile=/mnt/data/rauc.db
{{- if eq (env "BOOTLOADER") "tryboot" }}
bootloader=custom
{{- else }}
bootloader={{ env "BOOTLOADER" }}
{{- end }}
{{- if eq (env "BOOTLOADER") "grub" }}
{{- if eq (env "BOOT_SYS") "efi" }}
grubenv=/mnt/boot/EFI/BOOT/grubenv
@ -11,6 +15,11 @@ grubenv=/mnt/boot/grubenv
{{- end }}
{{- end }}
{{- if eq (env "BOOTLOADER") "tryboot" }}
[handlers]
bootloader-custom-backend=/usr/lib/rauc/rpi-tryboot.sh
{{- end }}
[keyring]
path=/etc/rauc/keyring.pem

View File

@ -27,4 +27,14 @@ elif [ -e /usr/bin/grub-editenv ]; then
echo "[INFO] machine-id is okay"
fi
else
if ! grep -q "systemd.machine_id=${MACHINE_ID}" /mnt/boot/cmdline.txt; then
echo "[INFO] set machine-id to ${MACHINE_ID}"
if sed -i "s/systemd.machine_id=[0-9a-fA-F]*/systemd.machine_id=${MACHINE_ID}/" /mnt/boot/cmdline.txt; then
sed -i "1 s/$/ systemd.machine_id=${MACHINE_ID}/" /mnt/boot/cmdline.txt
fi
else
echo "[INFO] machine-id is okay"
fi
fi