-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Initial Raspberry Pi 5 support #2914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
895fdbe
e810552
5d03e05
59d55d4
ff1b3bf
3260b08
a7d2cad
38bdab4
d6c6f5e
f6efd8d
8adb1dc
a0340ae
d3f1392
2475841
7542412
43a3f92
be15f28
e0fbd55
1d4d2dc
9da239e
dac5a03
dde3ec0
4bb5089
d9c488a
a23c36b
ad12f4e
5c404c8
46fc170
cb11ece
ced4a12
ec716c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need Moreover, there should be almost always some overlays (at least in HAOS) - and this currently just fails because the target directory doesn't exist, so even the rpi-rf-mod overlays don't get copied. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the rpi-rf-mod overlays need testing first? 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I've added now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That being said, I wonder if we should do this differently: IMHO either we consider device tree and device tree overlays firmware, and we should both take from there, or we should build both and deploy our builds 🤔 .. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have to pick from those two options, then I vote for using self-built DTBs and overlays. We have to build and supply DTB for Yellow anyway and having the rest built from sources is IMHO more flexible and easier for maintenance than using those from the RPi repo. Anyway it's been like this for ages and there's no urgency for changing that, but good point. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So far we build and supply extra overlays through the IMHO, the current situation is bad, as we mix the device tree from kernel source and overlays from the firmware. Technically, the device tree is supposed to be provided by the machine's firmware. Like in the x86 world the ACPI tables are part of the BIOS. So there is definitely an argument to make that we should deploy device tree and kernel from the Raspberry Pi provided directory. However, in the Arm world the boards are much more diverse, and quite often firmware (or part of the firmware) is bundled with the OS. That is also the case in Home Assistant OS: We deploy machine firmware along with the OS (and not just the device trees and overlay, but also Raspberry Pi's Deploying our own builds gives us more flexibility and proves to be less confusing/error-prone (as often the newer Linux kernel benefits from a newer/matching device tree). So with this in mind, I agree let's deploy overlays from our build. It seems that Buildroot doesn't support that use case yet. But it is a fairly simple extension for the Buildroot build system: home-assistant/buildroot#18. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, but didn't follow the discussions closely enough. So what is the exact issue with the
I am not really sure if this is exactly the case for the RaspberryPi stuff. In fact, AFAIK even for RaspberryPiOS the makers are not directly using the in-tree device tree overlay stuff but rather uses the pre-build rpi-firmware dtbo files from their repository. So I am quite unsure if this would not construct an additional issue here if you guys would now switch to using the dtbo files from the kernel tree rather than pulling them from the rpi-firmware package. And again. why is disabling/removing the rpi-rf-mod.dtbo required ATM? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ok, I wasn't aware that this got tested already, so we can re-enable it if it's known to be working. However, with just these two set:
I noticed that Btw, you typically find the rationals behind a change in the individual commits (46fc170 in this case). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jens-maus any thought on the rpi1 mod file? It came in with this commit 9582183. I am fine re-adding the two config symbols above, but I think we should cleanup the rpi-rf-mod package. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's re-add them before merging and eventually address the rf-mod issues in another PR. |
||
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 | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Uh oh!
There was an error while loading. Please reload this page.