1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2026-04-28 20:53:59 +01:00
Files
operating-system/buildroot-external/rootfs-overlay/usr/libexec/hassos-persists
Stefan Agner 8e1016dcaf 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 7f2c69b58f02f500d6aeee4f0a419046899b5e38.

* 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>
2023-12-12 13:19:26 +01:00

41 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
set -e
MACHINE_ID=$(cat /etc/machine-id)
###
# u-boot
if [ -e /usr/sbin/fw_setenv ]; then
# machine-id
if [ "$(fw_printenv -n MACHINE_ID)" != "${MACHINE_ID}" ]; then
echo "[INFO] set machine-id to ${MACHINE_ID}"
fw_setenv MACHINE_ID "${MACHINE_ID}"
else
echo "[INFO] machine-id is okay"
fi
###
# GRUB
elif [ -e /usr/bin/grub-editenv ]; then
GRUBENV_FILE="$(grep '^grubenv=' < /etc/rauc/system.conf | cut -d= -f2)"
# machine-id
if [ "$(/usr/bin/grub-editenv "$GRUBENV_FILE" list | grep '^MACHINE_ID=' | cut -d= -f2)" != "${MACHINE_ID}" ]; then
echo "[INFO] set machine-id to ${MACHINE_ID}"
/usr/bin/grub-editenv "$GRUBENV_FILE" set "MACHINE_ID=${MACHINE_ID}"
else
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