-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Initial Raspberry Pi 5 support #2914
Conversation
Have you noticed/checked the relatively new Perhaps this can be used as an alternative to waiting for U-Boot to be compatible with RaspberryPi5? Or is there already some early patchset for U-Boot which I am not aware of since I would also prefer to continue with using U-Boot as it is still more flexible... |
Yes I've noticed tryboot, and started to look into it. I think it can be done with tryboot, although it will need quite some adjustment. A second question would be if we would then stick with that (essentially supporting another bootloader) or move to U-Boot when available. If the second, then the question is if the above mentioned adjustment still would allow that. I hope I have a better idea once I've (tried) implementing it) I am not aware of any progress on U-Boot side. A couple days back I reached out to some folks previously working on Raspberry Pi support for U-Boot, but no progress from what I've heard. |
So this implementation has a custom bootloader integration for RAUC using a script. I am deploying kernel and device-tree to the boot partition, maintaining two slots in a separate directory and using What I am not happy about currently is 7f2c69b. It also changes the data layout. The only reason is the kernel size, but it should possible to use gzip compressed kernels instead, then we should get away with a 64MB boot partition. Changing partition layout is a bit tricky. On one hand can (and do) make board specific partition layout. But we probably should increase regular kernel and rootfs partition as well... But then, does it help if we only do it for RPi 5? 🤔 🤷♂️ |
Some notes wrt tryboot mechanism: To activate tryboot mechanism a reboot parameter must be passed (see the relevant Raspberry Pi documentation). By default, the However, with Supervisor installing the update, the reboot command is invoked through D-Bus by the Supervisor. We could modify Supervisor to pass
This means that the new slot only gets booted when reboot is being used. This is a limitation of how tryboot works. 🤷♂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good and the changes are still quite sustainable, nice work!
There's bunch of minor issues I spotted on the first sight, see the comments in code. I will do some more testing here but so far the rest looks fine from the overall perspective 👍
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 "${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 comment
The reason will be displayed to describe this comment to others. Learn more.
We need BR2_PACKAGE_RPI_FIRMWARE=y
in the board config, otherwise there will be no DT overlays, as we use those from that package.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I've added now BR2_PACKAGE_RPI_FIRMWARE=y
and an appropriate copy command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
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.
So far we build and supply extra overlays through the rpi-rf-mod
package, which is Homematic specific (speaking of which, maybe we should make that more clear in that package name 🤔 ). But other than that we do not supply overlays from the main Linux kernel source tree so far.
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 start4.elf
, or U-Boot which on some boards can be seen as firmware). Now where the individual components of the "firmware" come from are almost implementation detail: The Raspberry Pi device trees and overlays are maintained in their Linux kernel source tree anyway. It is only a matter of do we deploy their pre-built one or do we deploy our own builds.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
So far we build and supply extra overlays through the
rpi-rf-mod
package, which is Homematic specific (speaking of which, maybe we should make that more clear in that package name 🤔 ). But other than that we do not supply overlays from the main Linux kernel source tree so far.
Sorry, but didn't follow the discussions closely enough. So what is the exact issue with the rpi-rf-mod
since I noticed that you removed its CONFIG options from the rpi5 config file? In fact, it perfectly builds and runs with a rpi5 and the device tree overlay is working nicely AFAICS.
IMHO, the current situation is bad, as we mix the device tree from kernel source and overlays from the firmware.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, it perfectly builds and runs with a rpi5 and the device tree overlay is working nicely AFAICS.
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:
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
I noticed that rpi-rf-mod-rpi1.dtbo
gets deployed (besides rpi-rf-mod.dtbo
), which I think is just wrong for Raspberry Pi 5? This might be just a config issue, not sure.
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 comment
The 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 comment
The 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.
buildroot-external/board/raspberrypi/rpi5-64/rootfs-overlay/usr/lib/rauc/rpi-tryboot.sh
Outdated
Show resolved
Hide resolved
Use sed to append the new cmdline parameter to the first line.
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.
This makes sure we can store up to three kernels (slot A, B and an temporary one while installing the OTA update).
This reverts commit 7f2c69b.
Co-authored-by: Jan Čermák <[email protected]>
Only match actual hexadecimal characters.
* buildroot fd1dc86f40...f13ad03408 (1): > linux: add in-tree device tree overlay support
No Raspberry Pi 5 specific device tree overlays are available, drop RPi RF mod for now.
* buildroot f13ad03408...07e08e01b2 (1): > linux: fix add in-tree device tree overlay support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough (or even better!) for beta testing - let's merge it to dev to make testing easier 🎉
This reverts commit 46fc170.
Shall we have a Christmas present? 🎁 Great work everyone 🎊 |
Hello everyone, Two things first:
Buuuuut I've been a very enthusiastic HA user for a very long time and would be happy to make my modest little contribution: :) Tried to get the beta running on my RPI5: attached is the log. Maybe this will help someone? Let me know if I've done something wrong or can do something else for you! Best wishes Kay |
Thanks for using Home Assistant 😄 Make sure to change to the beta or dev channel first. There is quite some discussions around it in the Community post e.g. #2844 (comment). |
This produces a bootable system image. Currently no U-Boot is being used, the Home Assistant OS kernel is directly deployed onto the Raspberry Pi boot partition. System update support and A/B partition is not yet functional.