Skip to content
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

Support for rpi_5 #7978

Open
etenzy opened this issue Nov 22, 2023 · 56 comments
Open

Support for rpi_5 #7978

etenzy opened this issue Nov 22, 2023 · 56 comments

Comments

@etenzy
Copy link

etenzy commented Nov 22, 2023

When i try to start the rpi_generic version i get the following output:

Raspberry Pi 5 - 8GB
bootloader: 30de0ba5 2023/10/30
update-ts: 1699955031

board: d04170 797932e d8:3a:dd:xx:xx:xx
boot: mode USB-MSD 4 order f41 retry 0/128 restart 0/-1
SD: card detected 00035344534433324785594c22760176
part: 0 mbr [Oxee:00000001 0x00:00000000 0x00:00000000 0x00:000000001
power: supply: USB-PD 3000 mA CC1 PHIC: reset normal 0x0 usb_over_current=0
net: down ip: 0.0.0.0 sn: 0.0.0.0 gw: 0.0.0.0
tftp: 0.0.0.0 00:00:00:00:00:00
display: DISPO: HDMI HPD=1 EDID=ok #2 DISP1: HPD=0 EDID=none #0

usb_max_current_enable default 0 max-current 3000
Device-tree file "bcm2712-rpi-5-b.dtb" not found.

The installed operating system (OS) does not indicate support for Raspberry Pi 5
Update the OS or set os_check=0 in config.txt to skip this check.
Trying partition: 0
type: 32 1ba: 2048 'mkfs.fat' ' EFI • clusters 201618 (1)
Trying partition: 0
type: 32 1ba: 2048 'mkfs.fat' • EFI • clusters 201618 (1)
Read config.txt bytes 576 hnd 0x19759
usb_max_current_enable default 0 max-current 3000
Device-tree file "bcm2712-rpi-5-b.dtb" not found.

The installed operating system (OS) does not indicate support for Raspberry Pi 5
Update the OS or set os_check=0 in config.txt to skip this check.
Boot mode: USB-MSD (04) order f
@wurmr
Copy link

wurmr commented Dec 9, 2023

In the latest beta build v1.6.0-beta.1 it doesn't even get this far.

On a 4GB Pi 5 it never gets to the step of reading config.txt and keeps looping forever on the line type: 32 1ba: 2048 'mkfs.fat' • EFI • clusters 201618 (1)

@rothgar
Copy link
Member

rothgar commented Feb 6, 2024

I just booted 1.6.4 and get the same error about os_check=0.

Based on the post here it might have to wait for 6.8 kernel to be supported.

@AlexanderSkrock
Copy link

AlexanderSkrock commented Mar 19, 2024

Hi there,

as the mentioned Linux version 6.8 is released now, I would like to take the opportunity to ask whether there are any plans to support the Rasberry Pi 5 in the near future. I would be excited to get my newly purchased Rasberry Pi 5 up and running using Talos.

Kind regards
Alexander Skrock

@frezbo
Copy link
Member

frezbo commented Mar 19, 2024

There is no u-boot support yet, so it seems way far ahead

@Toasterson
Copy link

Any updates since? I am going with k3s at the moment but would love to testdrive Talos once it's ready.

@rothgar
Copy link
Member

rothgar commented May 31, 2024

Based on some email list conversations I read it looks like uboot 2024.04 adds support for raspberry pi 5 booting from SD card (no USB or nvme)

If someone wants to try it out you would have to update the uboot version here https://github.com/siderolabs/sbc-raspberrypi/blob/main/Pkgfile#L12-L14 and build a docker image and push it to a registry

Then you can follow these steps to use imager to create a custom image that you should be able to dd to an SD card. https://www.talos.dev/v1.7/talos-guides/install/boot-assets/#example-raspberry-pi-overlay-with-imager

I'm leaving for vacation soon so I don't have time to try it but would love to hear back from anyone that does.

@githubcdr
Copy link

I tried compiling u-boot but it didn't work, the nvme patches seem to be required for compiling.

@rothgar
Copy link
Member

rothgar commented Jun 13, 2024

The uboot patch says it only supports sd card right now. Did you try that?

@githubcdr
Copy link

I tried compiling without any patch and with patches, both failed for me.

@githubcdr
Copy link

38.13 make[1]: *** [scripts/Makefile.host:112: tools/image-sig-host.o] Segmentation fault (core dumped)
38.13 make[1]: *** Deleting file 'tools/image-sig-host.o'
38.13 make[1]: *** Waiting for unfinished jobs....
41.22 make[1]: *** [scripts/Makefile.host:112: tools/imx8image.o] Error 139
41.22 make[1]: *** Deleting file 'tools/imx8image.o'
41.22 make: *** [Makefile:1859: tools] Error 2

@githubcdr
Copy link

Good news! I have been able to boot Talos on rpi 5 using manually compiled uboot 2024.4, the ethernet port does not seem to be detected, probably some config.txt issues..

@ruryx00
Copy link

ruryx00 commented Jun 18, 2024

Good news! I have been able to boot Talos on rpi 5 using manually compiled uboot 2024.4, the ethernet port does not seem to be detected, probably some config.txt issues..

I'm trying also could you explain better how you were able to do it. thanks

@githubcdr
Copy link

githubcdr commented Jun 19, 2024

I first tried to build it via the bldr tool, but for some reason that gave me segfaults. What I did instead was manually compile uboot 2024.4 from source on a arm64 machine (rpi4) and then just place u-boot.bin file in the /boot partition :)

But as mentioned this will not work since the rpi firmware and the talos kernel must match if I understand correctly..

@Maikusan
Copy link

Maikusan commented Jul 31, 2024

Are there any news regarding raspi 5 support?

@pocket-pc
Copy link

Should this be moved to siderolabs/sbc-raspberrypi for task tracking?

@mooneydude
Copy link

Good news! I have been able to boot Talos on rpi 5 using manually compiled uboot 2024.4, the ethernet port does not seem to be detected, probably some config.txt issues..

i also just got Talos to boot on Pi 5 but hangs on 'talos failed looking up time.cloudflare.com'? Any progress with the ethernet port?

@philipgeraldtaylor
Copy link

A couple of Kiwis with @mooneydude same issue bump this.

@attilaolah
Copy link

attilaolah commented Nov 11, 2024

We were planning to bring up a small lab cluster with 3 Pi 5s and bumped into the same issue.

Boot hangs as it can't reach the NTP server, sad thing is it never goes further. There is no Ethernet signal so my best guess is that the Ethernet driver is not loaded at all, or if loaded then not configured, but our clunky setup with the Pi booting makes it hard to even capture dmesg.

I would invest a little time here maybe to try and push this a little further, for starters I think building a custom image with a modified config would be sufficient, what I'd be interested in is:

  • How to configure a TTY in order to capture the boot log from a USB serial adapter?
  • Is there a way to configure a limit for the NTP lookup? It would be helpful if Talos would at least boot up so that we'd be able to scroll the console with the keyboard to allow for further debugging, e.g. whether the Ethernet driver was loaded, check the network config tab, etc.

EDIT: There is also some discussion over at siderolabs/sbc-raspberrypi#23.

@rothgar
Copy link
Member

rothgar commented Nov 11, 2024

Has anyone tried adding the usb modem system extension and using a USB Ethernet adapter?

@attilaolah
Copy link

attilaolah commented Nov 11, 2024

I'd be up to try that tomorrow when I have both the Pis and USB ethernet adapter at one place. It wouldn't be a long-term solution as I only have one adapter but if it gets us far enough to apply configs with a custom installer at least it might be easier to experiment or try loading the right ethernet module.

@attilaolah
Copy link

attilaolah commented Nov 12, 2024

I started with the following schematic:

overlay:
  name: rpi_generic
  image: siderolabs/sbc-raspberrypi
customization:
  extraKernelArgs:
  - ip=:::::eth1:dhcp
  systemExtensions:
    officialExtensions:
    - siderolabs/usb-modem

…to get the schematic ID 3c84f43bf6579424d25b9c6239410028868946757ce84edc08378ed0f1726061, and tried running https://factory.talos.dev/image/3c84f43bf6579424d25b9c6239410028868946757ce84edc08378ed0f1726061/v1.9.0-alpha.2/metal-arm64.raw.xz on the Pi, with a USB Ethernet adapter that identifies itself as:

0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet

I verified with Raspberry Pi OS that the USB enhernet adapter works and left it in the same USB slot. No luck, same output: Ethernet adapter is off, Talos stuck at NTP lookup failure.

Then I tried schematic 3e9f701c9714396a76061cf7069322f4188cd7428f9b1516c93a5c5bea47dada with the following congif:

overlay:
  image: siderolabs/sbc-raspberrypi
  name: rpi_generic
  options:
    configTxtAppend: |-
      dtoverlay=disable-bt-pi5
      dtoverlay=disable-wifi-pi5
customization:
  extraKernelArgs:
  - net.ifnames=0
  - ip=:::::eth1:dhcp
  systemExtensions:
    officialExtensions:
    - siderolabs/usb-modem-drivers

Same result with Talos 1.9.0-alpha.2.

I'm not sure what's the correct incantation of kernel args to get it to work. I also don't know what would be the predictable interface name, I have the adapter in the blue USB 3 port next to the built-in network adapter, in the one closest to the board (lower one), which identifies itself as "Bus 002 Device 005".

I'll play with it a little more but any suggestions would be highly appreciated.


EDIT: And I verified the µSD card contents, the kernel params are properly set in grub/grub.cfg, and config.txt is properly updated with additional two lines.

@thielepaul
Copy link

thielepaul commented Nov 12, 2024

I think both the ethernet port as well as the usb connectors are behind the RP1 chip and are not supported in the mainline kernel 6.6 that talos is using. See also this thread: https://forums.raspberrypi.com/viewtopic.php?t=360653

I am wondering if it is possible to build a talos image using the kernel from raspberry pi instead of the mainline kernel? https://github.com/raspberrypi/linux

@attilaolah
Copy link

attilaolah commented Nov 12, 2024

Well, I tried to build the sbc-raspberrypi image yesterday with the latest firmware which includes 6.6.60, but the patches could not be applied cleanly, and ultimately my build failed, so I gave up.

In the meantime, I discovered that the USB adapter uses the ax88179_178a module. To be honest I'd rather stick to the mainline kernel and apply the patches necessary to build network adapter… or even just have the adapter as an overlay.


EDIT: I think it is unlikely that the uboot patches have anything to do with my build failure; uboot seems to be working as-is. But even with a recent firmware, I think in the end you may be right, it's best if I try to build the Raspberry Pi kernel that you linked…

@attilaolah
Copy link

I also attempted to build the kernel using github.com/siderolabs/pkgs and running make kernel PLATFORM=linux/arm64, and I end up with a segfaulting gcc :/

What I did was:

  • Update sources to refer to github.com/raspberrypi/linux as mentioned by @thielepaul
  • Update corresponding hashes in Pkgfile and slightly modify the kernel-prepare to unpack from .tar.gz instead of from .tar.xz
  • Run make kernel-olddefconfig, copy the generated config and then make kernel.

I tried with the latest 6.6.60, compiler segfaults.
I tried with the Raspberry Pi latest stable, 6.6.51, that then needs modifications to the hardening checker to ignore the two missing missing UBSAN configs which are apparently not present in that version yet. However, even after removing, the build fails.

My next attempt is going to be updating the Raspberry Pi os, loading configs, then extracting the config from the running kernel (which is the latest stable, 6.6.51), then import that config directly and try to build that in siderolabs/pkgs. The difference there is that Pi Os maintainers use a slightly different GCC but I'm hoping that wouldn't be much of an issue.

Apologies for spamming this ticket here, if I get it to work I'll make sure to write up the steps to reproduce; if not, at least someone might pick it up where I left off.

@attilaolah
Copy link

attilaolah commented Nov 12, 2024

EDIT: Nevermind; I eventually worked around the segfaulting gcc by setting up a native remote builder for buildx. That seems to work now but is quite slow so it will take a while to get to a working kernel, but should be possible.

Old comment below.


By any chance, could you give me the Toml config you use for setting up the buildx builder, for building the kernel package? I may be paranoid, but I'm beginning to think that my Buildx builder is misconfigured. I'm using Buildkit 0.17.1 with Docker 27.3.1 using the containerd image store.

I tried to build the kernel with:

  • Raspberry 6.6.51 sources with Talos 6.6.51 config, no luck.
  • Raspberry 6.6.51 sources with Raspberry 6.6.51 configs but with hardening flags applied, still no luck.
  • Raspberry 6.6.51 sources with Raspberry 6.6.51 configs as-is, but with hardening check disabled during build — still nothing.

My thinking is, it shouldn't be that easy to get GCC to segfault, and I have plenty of free RAM and cores so the one thing I can think of is the build environment somehow being different.

I used the config from make help:

[worker.oci]
  gc = true
  gckeepstorage = 50000

  [[worker.oci.gcpolicy]]
    keepBytes = 10737418240
    keepDuration = 604800
    filters = [ "type==source.local", "type==exec.cachemount", "type==source.git.checkout"]
  [[worker.oci.gcpolicy]]
    all = true
    keepBytes = 53687091200

@attilaolah
Copy link

I ended up building the Raspberry Pi kernel version 6.6.60 using configs from the Talos repo, modified by make kernel-olddefconfig. This still includes all the hardening flags so the hardening checks pass. I also built a new firmware overlay containing matching firmware for 6.6.60. Finally, I build the SD card image like so:

docker run --rm -it --privileged=true \
    -v /dev:/dev \
    -v $PWD/out:/out \
    attilaolah/talos-imager:v1.9.0-alpha.2-5-g9a02ecc49 \
    rpi_generic \
    --arch arm64 \
    --overlay-image attilaolah/talos-sbc-raspberrypi:v0.1.0-beta.2-2-gf2a59cd@sha256:f15b0f12082dfce081484c3957d1e7b8719c9da75dca2596da6d413b1477d74e \
    --overlay-name=rpi_generic \
    --extra-kernel-arg=net.ifnames=0 \
    --extra-kernel-arg=-console \
    --extra-kernel-arg=console=ttyS1

However the Pi 5 ends up in an endless boot loop. It gets past the u-boot screen and four raspberries show up where the tuxes would normally be, then I get a red LED for a moment and a reboot.

My guess is that the Talos kernel configs are not really compatible with the Raspberry kernel, so the next attempt would be to try with a config based on the current stable 6.6.51, but that would (a) definitely not pass hardening checks, which is OK for a lab setup, but (b) potentially miss important configs like EBPF which would be required for Cilium, so further tweaking would be necessary.

The config diff between Talos and Raspberry kernel configs is well over 6000 settings flags so I see little hope of finding a combination that both boots and is still usable by Talos :(

@attilaolah
Copy link

So building the Pi kernel with the Pi config leads to… interesting results:

PXL_20241113_203738608~2

Aside from the weird yellow screen, at least the bootloader is able to start the kernel, the USB hubs are registered, and it gets so far as to start the init binary, which then reboots because, hugepages are not enabled :(

So now, enabling CONFIG_HUGETLBFS, fixing up any config issues with olddefconfig, rebuilding the entire kernel (painfully slow), building a new imager, generating new boot artifacts, preparing the SD card… a long journey ahead still, I fear.

@thielepaul
Copy link

thielepaul commented Nov 13, 2024

Not sure if it helps, but here is a fork of the mainline kernel, where there seems to be active work ongoing to get the RP1 working: https://github.com/6by9/linux/commits/mainline_2712_integration/

Another project that might be interesting to test: https://github.com/worproject/rpi5-uefi
It neither has ethernet support, but at least USB should be working, so a usb-ethernet adapter should be working

@attilaolah
Copy link

attilaolah commented Nov 13, 2024

It is helpful, thanks! I knew about the rpi5-uefi project, but as far as I can see the onboard Ethernet adapter is not working there still; it would be an option with the USB Ethernet adapter, and the official Talos kernel + RPi overlay; I haven't tried that yet.

The other Kernel fork I haven't seen yet, I think that is also definitely worth a try. I'll give it a go when I have some more spare time.

In the end, I think that is the direction I need to take. Enabling CONFIG_HUGETLBFS did not get me any further; somehow I still end up with the same error.

So next up I'll try to flash the UEFI on one of the Pis, and maybe try that other kernel fork with another Pi.


For what it's worth, https://github.com/6by9/linux is building nicely so far, passes all hardening checks, but is a lot newer than both Talos and the Pi OS kernel apparently, currently identifying itself as 6.12-rc6.

@attilaolah
Copy link

I tried the kernel at https://github.com/6by9/linux/commits/mainline_2712_integration/, at commit 5c6ae15de0a27c7783818bd184233afac8bae011. Talos boots up and gets stuck at the usual NTP lookup error, neither the Ethernet port nor the USB port is loaded.

However, I haven't added any new modules to hack/modules-arm64.txt, I'm suspecting there is a module there that's needed to access these devices? Would it make sense to do an lsmod in Pi OS to try and figure out which one is responsible for the RP1, and then load that explicitly?

@thielepaul
Copy link

Unfortunately, I don't know the answers to your questions, but I guess 6by9 would be able to help you. You could ask him in the raspberrypi forum: https://forums.raspberrypi.com/viewtopic.php?p=2262592#p2262592

@attilaolah
Copy link

I asked on the forum for the configs that I might be missing. As for the modules, I took the sledgehammer approach and added them all to the image, and tried booting again — still no luck. Among others, ax88179_178a is now included in my image, which is needed for my USB Ethernet adapter.

I guess once I get the Ethernet to work in some way, I can fire up a privileged container and inspect all loaded modules to find out which ones are in use, and remove the unnecessary ones. But I'm guessing I'm also missing some configs to get there.

While waiting for the answer from the forum, I'm considering trying another build, taking the union of the Pi OS config and the Talos config, i.e. pick all configs that are set to whatever value in either one, and see if that gets me any further.

@attilaolah
Copy link

Apparently 6.12 has landed, with some more of the Pi 5 patches upstreamed — might be worth trying to rebuild from stock 6.12 and see how far that gets us. Although I expect some config-arm64 tweaking is still required.

In the meantime, response from the Pi forum was to try and merge with these configs:

I'm somewhat preoccupied these days but I'll give it another go soon. I've been using the scripts/kconfig/merge_config.sh script to merge configs with the ones that Talos used, in case anyone else wants to give it a try.

@attilaolah
Copy link

I tried to to merge the 16k pages config with both mainline 6.12 and the fork by 6by9, they both end up in a boot loop due to the missing loopback device, just like it was described in #3621 — but I don't see how the issue was resolved in that case, I'm sure I'm missing a module but there's no loop.ko in the generated image. Which makes sense since CONFIG_BLK_DEV_LOOP is =y not =m, and I also have CONFIG_BLK_DEV_LOOP_MIN_COUNT=8. I wonder if something special is needed to enable the loopback devices in the newer kernel?

@awillis
Copy link

awillis commented Nov 21, 2024

I'm completely new to Talos, trying to get up to speed and see where I can help.

I can build an SD card image

$ sudo podman run --rm -it \
-v $PWD/out:/secureboot:ro \
-v $PWD/out:/out \
-v /dev:/dev \
--privileged ghcr.io/siderolabs/imager:v1.8.3 metal \
--arch arm64 \
--extra-kernel-arg=net.ifnames=0  \
--extra-kernel-arg=-console  \
--extra-kernel-arg=console=ttyS1

I pulled the latest 6.12 kernel and the kernel configs for bcm2711 and 2712, merged them into .config and compiled.

$ ./scripts/kconfig/merge_config.sh arch/arm64/configs/bcm2711_defconfig arch/arm64/configs/bcm2712_defconfig

IIUC, I need to create an overlay that includes this kernel image + mods and config.txt changes? I see the configuration for rpi_generic above, but I don't fully grok how they are created and applied. I have a USB ethernet adapter from J5 to help me work around the NTP issue, works pretty well on linux and fbsd.

I'm going to peruse the kernel config and read through the sbc-raspberrypi repo.

@attilaolah Could you drop me a hint on next steps?

@attilaolah
Copy link

My setup is a bit clunky but it might still give you some pointers.

I start with my fork of https://github.com/siderolabs/pkgs, which has the kernel package.

If you modified the Kernel config (e.g. after merging), you can clean it up by running make kernel-olddefconfig in the repo root. When you merge configs, it makes sense to revert a few of them, like CONFIG_LOCALVERSION back to -talos, and CONFIG_CMDLINE, since the Pi config hard-codes the root fs there.

Then build the kernel. I use namespace.so since I don't have a decent host for building arm64 binaries, emulation takes forever (or just fails due to bad Qemu settings or whatever), plus the folks at Namespace Labs really like it when folks use their arm builders to compile the Linux kernel. It makes their day. 😸

So I set the registry:

export REGISTRY="$(nsc workspace describe --output=json | jq -r .registry_url)"

Make Docker buildx is configured to use Namespace:

nsc docker buildx setup --background --use

And finally compile the kernel:

make kernel REGISTRY=$REGISTRY PLATFORM=linux/arm64 PUSH=true

Obviously this takes forever, but at least the compilation isn't happening locally. When done, the image is pushed to the nscr.io registry. You can skip the Namespace part and build locally, the image will be left in the build cache if you omit PUSH=true, or you can just use Docker Hub or sign in to ghcr.io with your GitHub token (but then change USERNAME to your GitHub user since you can't push to siderolabs/…).

Once this is done, I can pull the image, alternatively tag it (but not necessary), then the next step is to build the imager. Do this from the https://github.com/siderolabs/talos repo.

For the imager, I first want to look at the kernel modules within the kernel container, so I do something like this:

crane export attilaolah/talos-kernel:v1.9.0-alpha.0-54-gcbb968d --platform=linux/arm64 | tar tf - | grep '^lib/modules/.*\.ko$' | sed 's:.*-talos/::' >> hack/modules-arm64.txt

Then I take a look at hack/modules-arm64.txt and remove the duplicates (:sort u in vim), check whether required modules are there, do a git diff maybe, and finally build the imager, referencing the kernel package from the previous step:

make imager REGISTRY="$REGISTRY" PKG_KERNEL=tag-fromskernel-image-from-previous-step PUSH=true INSTALLER_ARCH=arm64 PLATFORM=linux/arm64

Notice that I'm building from PLATFORM=linux/arm64? That's because I haven't figured out how to build an amd64 imager for only the linux/arm64 target. When I try to build the imager for amd64, it tries to pull the kernel for the linux/amd64 platform, which I don't have, since in the previous step I only compiled for linux/arm64.

Anyway, I build the imager and then, since it is an arm64 build, I SSH into my trusty Pi 5 running Pi OS, and, on the Pi itself, run the imager using Docker/Podman, similarly to your comment, but with these differences:

  • Instead of running ghcr.io/siderolabs/imager:v1.8.3, I run the imager that I've built.
  • Instead of metal, I use rpi_generic. Using Metal seems to create an EFI loader and I haven't flashed my Pi with any EFI boot loader so it still uses uboot, which works if I use the rpi_generic target.

The only overlay I use is the sbc-raspberrypi, there I didn't change much, I just picked the one that was available at the time:

--overlay-image ghcr.io/siderolabs/sbc-raspberrypi:v0.1.0-beta.2@sha256:900bfd99ae1ed13e8fc1ba2d130c80d3c4730370fbc0f2c8330dab91471991bc
--overlay-name=rpi_generic

Then I decompress the generated compressed image (maybe there's a flag to skip compression? Dunno.) Then I dd the raw image to a second SD carad on the Pi, using a USB SD card adapter. Power off, swap cards, power on, cross fingers and wait.

There's probably more efficient ways of doing this but this works well enough.

@pl4nty
Copy link

pl4nty commented Nov 23, 2024

Haven't touched this in over 6 months, but in case it's useful - here's the CI setup I had to build pkgs for a different SBC. At one point I built an amd64 imager targeting arm64, then discarded it because the patchset was too large for frequent rebases and I had an Ampere VM anyway. Nico has a pretty nice CI too, with image build/upload

pkgs with namespace.so
only build kernel/U-Boot pkgs
talos with namespace.so
override kernel/U-Boot

@awillis
Copy link

awillis commented Nov 23, 2024

Looks like the raspberry pi kernel is up to 6.6.62 as is the current siderolabs/pkgs repo as of 5 days ago

raspberrypi/linux@c1036e4
siderolabs/pkgs@a5530cf

I'm going to point my pkgs repo at this version of the raspberry pi kernel and see what I get. The mainlined patches to 6.12.x do not include RP1 support, which is pretty critical for RPi5 support.

I have a SolidRun HoneyComb (lx2160a) box that I use for my kids' minecraft servers. Going to use it to build kernels while they are sleeping :o)

@christianhuening
Copy link

how did it go @awillis ?
I just ran into this. Is there a solution meanwhile before I start digging?

@awillis
Copy link

awillis commented Dec 8, 2024

@christianhuening @attilaolah

Sorry for the delayed update. I was stuck on thie error:

ERROR: failed to solve: failed to solve LLB for platform linux/arm64 and target kernel: requested experimental feature mergeop  has been disabled on the build server: only enabled with containerd image store backend

Which was resolved by enabling experimental docker build features (just needed to read the Makefile)

docker buildx create --name local --use

Currently running make kernel-olddefconfig. Will update again before the end of the night.

Working out of https://github.com/awillis/siderolabs-pkgs/tree/rpi_5_6.6.62

@awillis
Copy link

awillis commented Dec 8, 2024

Last error before bedtime:

alan@carver:~/projects/siderolabs-pkgs$ make -j4 kernel PLATFORM=linux/arm64 PUSH=true
<snip>
 => ERROR linux/arm64 kernel-build:build-0                                                        1.4s
------
 > linux/arm64 kernel-build:build-0:
1.325                  option name                 | desired val | decision |       reason
1.325 ===========================================================================================
1.325 CONFIG_ARM_SMMU                              |      y      |defconfig |  self_protection
1.325 CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT    |      y      |defconfig |  self_protection
1.325 CONFIG_ARM_SMMU_V3                           |      y      |defconfig |  self_protection
1.325 CONFIG_RANDOM_KMALLOC_CACHES                 |      y      |   kspp   |  self_protection
1.325 CONFIG_SLAB_MERGE_DEFAULT                    | is not set  |   kspp   |  self_protection
1.325 CONFIG_BUG_ON_DATA_CORRUPTION                |      y      |   kspp   |  self_protection
1.325 CONFIG_SLAB_FREELIST_HARDENED                |      y      |   kspp   |  self_protection
1.325 CONFIG_SLAB_FREELIST_RANDOM                  |      y      |   kspp   |  self_protection
1.325 CONFIG_SHUFFLE_PAGE_ALLOCATOR                |      y      |   kspp   |  self_protection
1.325 CONFIG_FORTIFY_SOURCE                        |      y      |   kspp   |  self_protection
1.325 CONFIG_DEBUG_SG                              |      y      |   kspp   |  self_protection
1.325 CONFIG_INIT_ON_ALLOC_DEFAULT_ON              |      y      |   kspp   |  self_protection
1.325 CONFIG_SCHED_CORE                            |      y      |   kspp   |  self_protection
1.325 CONFIG_SECURITY_LOCKDOWN_LSM                 |      y      |   kspp   |  self_protection
1.325 CONFIG_SECURITY_LOCKDOWN_LSM_EARLY           |      y      |   kspp   |  self_protection
1.325 CONFIG_LIST_HARDENED                         |      y      |   kspp   |  self_protection
1.325 CONFIG_DEBUG_NOTIFIERS                       |      y      |   kspp   |  self_protection
1.325 CONFIG_KFENCE                                |      y      |   kspp   |  self_protection
1.325 CONFIG_KFENCE_SAMPLE_INTERVAL                |     100     |   kspp   |  self_protection
1.325 CONFIG_HARDENED_USERCOPY                     |      y      |   kspp   |  self_protection
1.325 CONFIG_HARDENED_USERCOPY_FALLBACK            | is not set  |   kspp   |  self_protection
1.325 CONFIG_HARDENED_USERCOPY_PAGESPAN            | is not set  |   kspp   |  self_protection
1.325 CONFIG_GCC_PLUGIN_LATENT_ENTROPY             |      y      |   kspp   |  self_protection
1.325 CONFIG_MODULE_SIG                            |      y      |   kspp   |  self_protection
1.325 CONFIG_MODULE_SIG_ALL                        |      y      |   kspp   |  self_protection
1.325 CONFIG_MODULE_SIG_SHA512                     |      y      |   kspp   |  self_protection
1.325 CONFIG_MODULE_SIG_FORCE                      |      y      |   kspp   |  self_protection
1.325 CONFIG_RESET_ATTACK_MITIGATION               |      y      |   kspp   |  self_protection
1.325 CONFIG_UBSAN_BOUNDS                          |      y      |   kspp   |  self_protection
1.325 CONFIG_UBSAN_LOCAL_BOUNDS                    |      y      |   kspp   |  self_protection
1.325 CONFIG_UBSAN_SANITIZE_ALL                    |      y      |   kspp   |  self_protection
1.325 CONFIG_DEFAULT_MMAP_MIN_ADDR                 |    65536    |   kspp   |  self_protection
1.325 CONFIG_GCC_PLUGIN_STACKLEAK                  |      y      |   kspp   |  self_protection
1.325 CONFIG_STACKLEAK_METRICS                     | is not set  |   kspp   |  self_protection
1.325 CONFIG_STACKLEAK_RUNTIME_DISABLE             | is not set  |   kspp   |  self_protection
1.325 CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT       |      y      |   kspp   |  self_protection
1.325 CONFIG_PAGE_TABLE_CHECK                      |      y      |   kspp   |  self_protection
1.325 CONFIG_PAGE_TABLE_CHECK_ENFORCED             |      y      |   kspp   |  self_protection
1.325 CONFIG_DEBUG_WX                              |      y      |   kspp   |  self_protection
1.325 CONFIG_ARM64_SW_TTBR0_PAN                    |      y      |   kspp   |  self_protection
1.325 CONFIG_SHADOW_CALL_STACK                     |      y      |   kspp   |  self_protection
1.325 CONFIG_KASAN_HW_TAGS                         |      y      |   kspp   |  self_protection
1.325 CONFIG_SECURITY_YAMA                         |      y      |   kspp   |  security_policy
1.325 CONFIG_SECURITY_LANDLOCK                     |      y      |   kspp   |  security_policy
1.325 CONFIG_STRICT_DEVMEM                         |      y      |defconfig | cut_attack_surface
1.325 CONFIG_SECURITY_DMESG_RESTRICT               |      y      |   kspp   | cut_attack_surface
1.325 CONFIG_LEGACY_TIOCSTI                        | is not set  |   kspp   | cut_attack_surface
1.325 CONFIG_DEVMEM                                | is not set  |   kspp   | cut_attack_surface
1.325 CONFIG_IO_STRICT_DEVMEM                      |      y      |   kspp   | cut_attack_surface
1.325 CONFIG_LDISC_AUTOLOAD                        | is not set  |   kspp   | cut_attack_surface
------
ERROR: failed to solve: process "/toolchain/bin/bash -c set -eou pipefail\ncd /src\npython3 /toolchain/kernel-hardening-checker/bin/kernel-hardening-checker -c .config -m json | python3 /pkg/scripts/filter-hardened-check.py ${CARCH}\n" did not complete successfully: exit code: 1
make[2]: *** [Makefile:155: target-kernel] Error 1
make[2]: Leaving directory '/home/alan/projects/siderolabs-pkgs'
make[1]: *** [Makefile:170: docker-kernel] Error 2
make[1]: Leaving directory '/home/alan/projects/siderolabs-pkgs'
make: *** [Makefile:187: kernel] Error 2

I take it that these are the kernel config items I need to change to make the kernel hardening checker happy. Or maybe the checker script needs to have its configuration changed. Will tackle it next session.

On another note, I setup a RPi5 as a backup build box and got the same results. Only much faster :)

@awillis
Copy link

awillis commented Dec 9, 2024

I picked a newer ref for the raspberrypi/linux repo, merged the configs and built. This resulted in fewer complaints from the kernel hardening script. Once those were resolved, the resultant build went for an hour and a half (on an RPi5).

EDIT: I was missing the pahole utility. Ran docker buildx prune after adding it to my build box. Currently the build is hanging at BTF .btf.vmlinux.bin.o. If it doesn't resolve in a bit, I will find a beefier build box.

@awillis
Copy link

awillis commented Dec 10, 2024

Finally dawned on me that I didn't need to use an ARM64 box.

Imager is based off of v1.9.0-alpha.0(-dirty) using kernel 6.6.63. I haven't had a chance to try it yet, will do later today.

@rothgar
Copy link
Member

rothgar commented Dec 10, 2024

Do these boot with network support?

@awillis
Copy link

awillis commented Dec 10, 2024

Haven't tried it yet, but I expect that they will. The raspberry pi kernel sources were used with RP1 support enabled, which should make the onboard Ethernet adapter usable.

@rothgar
Copy link
Member

rothgar commented Dec 11, 2024

Do you have the raw .img and initram files?

@awillis
Copy link

awillis commented Dec 11, 2024

Here is the raw image.

The images were generated as rpi_generic and with v0.1.0 of the sbc-raspberrypi overlay as @attilaolah demonstrated in a previous post. The bootloader os check failed. Going to hunt around and figure out why the device tree blob isn't included.

The kernel and initramfs assets are also provided.

@Sense545
Copy link

Ignoring the kernel and talos image for now, I tried compiling u-boot with the patchwork from here https://patchwork.ozlabs.org/project/uboot/list/?series=391659&state=*, but when in the u-boot cmd line (using UART debugger) it does not detect any pci buses. Has anyone got u-boot to find the pci-buses?

@Sense545
Copy link

Looks like there are some new patches here https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=913710, but not sure how to merge those into u-boot...

@awillis
Copy link

awillis commented Dec 12, 2024

I believe you can introduce u-boot patches into the sbc-raspberrypi overlay

https://github.com/siderolabs/sbc-raspberrypi/tree/main/artifacts/u-boot/patches

@Sense545
Copy link

Tried your image @awillis. Also used worproject/rpi5-uefi and the dtb file from raspberrypi's repo (did not use u-boot).

Got this error while booting talos:
mrecovered from: early boot failed: error mounting "/dev/loop0": error mounting: 1 error(s) occurred: no such device

Did anyone manage to build talos using official or patched raspberrypi linux kernel?

@awillis
Copy link

awillis commented Dec 18, 2024

@Sense545 The kernel and imager in my repo is derived from a pre release version of talos and the raspberry pi kernel. The image I generated is missing dtbs, need to figure that out next.

@samip5
Copy link

samip5 commented Dec 23, 2024

@Cyclonit
Copy link

Hi,
has there been any progress on this? I have three Pi 5 waiting to become a small cluster and I'd love to use Talos right from the start.

@samip5
Copy link

samip5 commented Jan 10, 2025

Hi,

has there been any progress on this? I have three Pi 5 waiting to become a small cluster and I'd love to use Talos right from the start.

Support depends on Pi5 support level on mainline kernel which is barebones. More details on the siderolabs/sbc-raspberrypi repos issues.

@samip5
Copy link

samip5 commented Jan 18, 2025

There's a discussion about the whole kernel thing: siderolabs/overlays#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests