-
Notifications
You must be signed in to change notification settings - Fork 59
[WIP] Enable Rockchip arch in kernel #2556
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
base: main
Are you sure you want to change the base?
[WIP] Enable Rockchip arch in kernel #2556
Conversation
@@ -5,6 +5,7 @@ CONFIG_ARCH_BCM2835=y | |||
CONFIG_ARCH_BCM_IPROC=y | |||
# CONFIG_ARCH_MEDIATEK is not set | |||
# CONFIG_ARCH_QCOM is not set | |||
CONFIG_ARCH_ROCKCHIP=y |
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.
CONFIG_ARCH_MULTI_V7 might be required too
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.
RK3566 is ARMv8-A (it has only 4 Cortex A-55, which are ARMv8.2-A) and CONFIG_ARCH_MULTI_V7
is for ARMv7 (if I understand correctly). So at first sight, it should not be required but if my real test fails, I'll try to add it.
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.
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.
Thanks, this is weird because it says it's for Rockchip Cortex-A9 so I'll try without it and if it doesn't work, I'll try to add it.
If I add it, I'll try to use the SDK container to build locally and make the change if it helps.
@sambonbonne the image was built, you can download it and try it from the github actions artifacts page. https://github.com/flatcar/scripts/actions/runs/12575139169?pr=2556 |
Build action triggered: https://github.com/flatcar/scripts/actions/runs/14925630539 |
The vmlinuz image increase is pretty big, by 3MB, which is more than the space allowed for the updates to work, that s why some of the tests failed. But as a PoC, you can try first the resulting image and see if it works. |
@ader1990 thank you! I had some problems when trying to edit the partition layout of my SD card with I understand 3MB is too big, unfortunately I don't know enough about "kernel things" to help on this so if I manage to have a working image, I hope we will be able to reduce the added size or find an alternative. |
@ader1990 I'm trying to use $ flatcar-install -d /dev/sdb -B arm64-usr -i /path/to/ignition.json -f /path/to/flatcar_production_image.bin -u
Using existing image: /path/to/flatcar_production_image.bin
Writing /path/to/flatcar_production_image.bin...
Running in chroot, ignoring request.
Running in chroot, ignoring request.
mount: /tmp/flatcar-install.77HskzhsAm/oemfs: WARNING: source write-protected, mounted read-only.
Installing Ignition config /path/to/ignition.json...
cp: cannot create regular file '/tmp/flatcar-install.77HskzhsAm/oemfs/config.ign': Read-only file system
Error: return code 1 from [[ -n "${IGNITION}" ]]
/dev/sdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/sdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
/dev/sdb: calling ioctl to re-read partition table: Success If you have any idea to help me, I will be very happy! |
@ader1990 I managed to fix my problem and to use But it seems the first partition, the EFI one, is not mountable when installed so I could not write the Anyway, the image does not seem to boot so I added Can you launch the pipeline so I can try a new image with the added kernel parameter? Otherwise, should I ask for help with the SDK container (if yes, where? The Matrix channel?)? Just FYI, here is the
|
@sambonbonne had to solve some conflicts, I did trigger a new build and you should be able to download the image artifact in a few hours, if all goes well. |
@ader1990 thanks! I hope the new image will boot. I'll give it a try when I'm able to. |
@ader1990 it seems I cannot set
See https://github.com/flatcar/scripts/actions/runs/12743950372/job/35527535677#step:7:4656. So I guess I can't enable the |
it seems that the newer kernel 6.12 does not need it anymore. You can push a new change and I can start the build. For building the kernel properly with Flatcar, I have the following notes for https://www.flatcar.org/docs/latest/reference/developer-guides/sdk-modifying-flatcar/#getting-started:
|
Hello @ader1990 and thanks for those details! I pushed a commit to remove the Speaking of, I tried to build again after removing this config, so I enter the SDK container with
I will try to run both I hope I don't ask for too much with all my questions, to be honest this is my first time building an entire distro, it's challenging and very instructive. |
What usually happens when trying to run When I have errors with the build process, I usually start with a very clean environment from scratch, as there might be leftovers or errors introduced by multiple builds. Being a dockerized environment, it is usually easy to create a new env, just remove the cloned repository, do a docker rm of the dangling containers and images, do a docker system prune for safety (of course, make sure you are not using that env for other work), and start over. Always start with a new cloned repo of flatcar/scripts, otherwise you can do a git reset, git clean -fxd, git rebase on flatcar/scripts main branch, and start the process from step 1: |
@sambonbonne image was built here: https://github.com/flatcar/scripts/actions/runs/12845716694 |
@ader1990 just wanted to tell you I'm still investigating the boot problem. I tried multiple Beside this, I managed to boot MicroOS with this simple
So I know U-Boot is capable of booting a working OS, I just don't know why it doesn't boot Flatcar. Edit: I just decided to order a serial cable to see if U-Boot logs message to the UART port, it may take some time to arrive but I still want to work on this. |
9ed0ab0
to
87bc1d5
Compare
Latest push is due to me rebasing this branch from |
Good news: I got my cable and I already have some things. Bad news: right now, it's still complicated to find why Flatcar doesn't boot. I can see the Grub menu through the serial port but after booting Flatcar, even by adding a
I also tried to boot the A partition directly (still from Grub menu) with the I think I miss a kernel configuration, I'm looking for it. Fortunately, Home Assistant provides a working image for Odroid M1S so I will try to find out what they use. I hope I'll be able to build locally this time, this would avoid multiple pipelines just to find out missing parameters. |
I see that the support has been there since the 6.12 torvalds/linux@10dc64f, so it should work. For the debug logs, I might suggest adding more kernel config params - mainly Thanks. |
My comment is a bit long so I tried to structure it two parts. DebugI tried different parameters for debug logs: the four Maybe I do it wrong but it's not my first time adding a temporary kernel parameter from Grub: I use Kernel configsAs a theoretically working kernel config, I have two sources for Odroid M1S:
Gentoo wiki configs tryI tried to add configs from Gentoo wiki but that's where I got some build error when running /build/arm64-usr/var/log/portage/app-containers:podman-5.3.0:20250212-102732.log
I built from a fresh environment (new clone and remove all Flatcar containers and images) so I don't understand how I can still face this kind of errors (I run the Is it possible to build a smaller set just to try the boot, without Podman for example? Home Assistant OS infoFor HAOSS (short for Home Assistant OS), it bootloops when installed on SD card so I may have to try to install it directly on eMMC and maybe I can find a way to copy the |
I managed to build with more parameters but still no luck. I created a PR on my repo for that and started a self-hosted runner with the required labels. Build working but image still not booting: sambonbonne@1eb4d0b Build failing: sambonbonne@98c0da9 (build log: https://github.com/sambonbonne/flatcar-scripts/actions/runs/13437246231/job/37542450165) My next try, when I have the time, will be to run the HAOSS image directly in eMMC (instead of SD) and see if the kernel config is available. 🤞 |
pahole: added a revamped patch to remove the parallel implementation kernel: use pahole 1.27 feature of reproducible builds
The out-of-tree nvidia driver requires symbols that are behind DRM_TTM_HELPER if DRM_FBDEV_EMULATION is enabled, but DRM_TTM_HELPER can't be selected unless we build more drm drivers (which is undesirable). To get out of this, disable DRM_FBDEV_EMULATION. Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
…_fcopy_uio_daemon See: torvalds/linux@82b0945ce2c2d636d5e893ad50210875c929f257wq Also fix hv tools build for arm64.
Remove CONFIG_AMD_IOMMU_V2, CONFIG_FB_ARMCLCD, CONFIG_MD_LINEAR, CONFIG_NET_ACT_IPT. Add CONFIG_MODULE_COMPRESS. See: torvalds/linux@5a0b11a linux: remove CONFIG_MD_LINEAR See: torvalds/linux@849d18e linux: remove CONFIG_NET_ACT_IPT See: torvalds/linux@86fe596 linux: add required CONFIG_MODULE_COMPRESS=y See: torvalds/linux@c7ff693 linux: remove CONFIG_FB_ARMCLCD See: torvalds/linux@dee56cc
So, today I discovered First the kernel stops with a Then I got I see I hope I'll be able to fix the clocks problem but what a relief to get to that point! |
Ah, good idea, should have thought of that. Those messages might be red herrings though. iscsi support certainly isn't mandatory. |
Well, added configs did not change anything but by reading more carefully, I found this in the logs:
It happens after the clock problem (when ignored with @chewi should I wait for the new Dracut version before retrying or it won't change anything? Because the ISCSI failure logs come from Dracut but as the |
Ah, so you are getting further than before. I thought it was still freezing before it even got to the initrd. Are you not able to get an emergency shell at this point? Then you could find out exactly why systemd-modules-load failed. Hard to guess why. Could be certain modules missing, the whole module directory being wrong, or some module just failing to load. I doubt the new Dracut will help here. If you're building from recent master, then you should have it already anyway. Otherwise, it will be in the next Alpha, which should be out very soon. |
I'm getting further when I boot the
How can I try? It fails and stop but maybe I could try some kernel parameter? I'm not sure it would work because everything is printed thanks to
Right now, I'm still based on the 6.12 kernel branch (as Odroid M1S mainline support has been added in Linux 6.12 only) and I didn't rebase for a long time. I wanted to wait for the 6.12 merge before rebasing on it on a more regular basis. |
Normally, it should either finish booting and reach the bash prompt or drop you to an emergency shell. You might not be seeing the latter. Then again, you might not be seeing the former either. Maybe it's actually booting? You can force an emergency shell with the
Ah yes, 6.12 isn't quite merged yet. Possibly waiting on feedback from, I'll get on that. The branch (currently f0479a5) does include the new Dracut though. |
I don't think so, here are the final logs. Kernel logs[ 3.804011] systemd[1]: Starting dracut-cmdline-ask.service - dracut ask for additional cmdline parameters... [ 3.810784] systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE [ 3.813810] systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'. [ 3.817288] systemd[1]: Failed to start systemd-modules-load.service - Load Kernel Modules. [ 3.824375] systemd-journald[220]: Collecting audit messages is disabled. [ 3.837866] systemd[1]: Starting systemd-sysctl.service - Apply Kernel Variables... [ 3.887785] systemd[1]: Finished systemd-tmpfiles-setup-dev.service - Create Static Device Nodes in /dev. [ 3.932308] systemd[1]: Started systemd-journald.service - Journal Service. [ 4.635221] scsi_transport_iscsi: version magic '6.12.20-flatcar SMP preempt mod_unload aarch64RANDSTRUCT_4c1878ebf69f0970b95d3a28dd0d6256599204b7fc7c4e9c913a3ff 975cebd24' should be '6.12.20-flatcar SMP preempt mod_unload aarch64RANDSTRUCT_4b2265eabc93dcbc1dc7f1aa2a6d6b3e44fdba91ec4a3be9063cfe0213443d79' [ 4.640048] dracut: FATAL: iscsiroot requested but kernel/initrd does not support iscsi [ 4.640987] dracut: Refusing to continue [ 4.822584] systemd-shutdown[1]: Syncing filesystems and block devices. [ 4.825414] systemd-shutdown[1]: Sending SIGTERM to remaining processes... [ 4.856711] systemd-journald[220]: Received SIGTERM from PID 1 (systemd-shutdow). [ 6.555001] random: crng init done [ 6.578620] systemd-shutdown[1]: Sending SIGKILL to remaining processes... [ 6.604126] systemd-shutdown[1]: Unmounting file systems. [ 6.608623] (sd-umount)[347]: Unmounting '/run/credentials/systemd-resolved.service'. [ 6.613167] (sd-umount)[348]: Unmounting '/run/credentials/systemd-tmpfiles-setup.service'. [ 6.617760] (sd-umount)[349]: Unmounting '/run/credentials/systemd-sysctl.service'. [ 6.622255] (sd-umount)[350]: Unmounting '/run/credentials/systemd-tmpfiles-setup-dev.service'. [ 6.626933] (sd-umount)[351]: Unmounting '/run/credentials/systemd-journald.service'. [ 6.631475] (sd-umount)[352]: Unmounting '/run/credentials/systemd-vconsole-setup.service'. [ 6.635995] (sd-remount)[353]: Remounting '/usr' read-only with options ''. [ 6.640223] (sd-remount)[354]: Remounting '/' read-only with options ''. [ 6.643166] systemd-shutdown[1]: All filesystems unmounted. [ 6.643776] systemd-shutdown[1]: Deactivating swaps. [ 6.644455] systemd-shutdown[1]: All swaps deactivated. [ 6.645061] systemd-shutdown[1]: Detaching loop devices. [ 6.646676] systemd-shutdown[1]: All loop devices detached. [ 6.647317] systemd-shutdown[1]: Stopping MD devices. [ 6.648458] systemd-shutdown[1]: All MD devices stopped. [ 6.649073] systemd-shutdown[1]: Detaching DM devices. [ 6.650159] systemd-shutdown[1]: All DM devices detached. [ 6.650733] systemd-shutdown[1]: All filesystems, swaps, loop devices, MD devices and DM devices detached. [ 6.653224] systemd-shutdown[1]: Syncing filesystems and block devices. [ 6.655495] systemd-shutdown[1]: Halting system. [ 6.657488] kvm: exiting hardware virtualization [ 6.658099] reboot: System halted I think the
Thank's, I'll give it a try when I'm able to.
Maybe I should rebase just to be sure I have latest Dracut version, I'll try to do that first. |
@sambonbonne I have these notes that might be helpful to make sure you are rebuilding correctly:
|
Thanks @ader1990, I think mines are more aggressive: sudo rm -rf sdk_container/.env sdk_container/.sdkenv sdk_container/.cache/ sdk_container/.config __build__/
sudo podman container rm $(sudo podman container ls -a | grep -F flatcar-sdk-arm64 | cut -d ' ' -f 1) So I may try yours to see if the rebuild is quicker. If I understand correctly, I have to run yours directly in the SDK container and it won't rebuild all packages, it seems better. |
This does suggest you're not getting a clean build. The version magic of this module does not match that of the kernel. At least I think that's what it means, I've rarely seen this error! This could be true for all the modules. |
This is strange but maybe my "cleanup" commands are wrong? Anyway, for this test I cloned Adrian's branch for 6.12 kernel in a new repo and just copied my arm64 kernel config before running the build. And the SDK image is more up to date than on my branch so it creates a new container. This should make a clean build. I didn't know this line was an error so thank you for pointing it to me, if I see it again I'll know it's a problem! |
Well, even with a clean build I get these errors:
I did as I said I would:
What can create this "version magic" error in these steps? |
I don't know exactly how version magic works. Given that Flatcar builds the modules first and then the kernel itself later, it must get stored somewhere, but I can't work out where. In short though, it just means that the kernel and the modules weren't built from the same... config or maybe environment? I doubt you are, but make sure that you're not installing coreos-modules or coreos-kernel from a binary package. |
I'm sorry for this stupid question but how can I make sure of that? |
I would make sure by having a git commit and cherry-pick instead of a copy paste for the changes that you have. Then to properly cleanup, make sure to wipe the scripts folder you have and do a fresh clone, or the alternative can be (I prefer it): |
0702293
to
9deb546
Compare
@ader1990 thanks! Edit: it seems it's starting to run on my repo (Flatcar fork), many thanks for this! |
9deb546
to
153a6e7
Compare
Great to hear that -> this is a working build, just in case you need a working example: https://github.com/ader1990/scripts/actions/runs/14442077036 |
Seems that the Now the This workflow does not work anymore given that a new bootengine commit id needs to be tested:
|
@chewi Seems that you did the following changes: and now the build path is then the coreos-kernel has this change:
Which means, now, to test the new bootengine commit, one needs to also clean and rebuild the coreos-modules:
|
I've just checked. The bootengine.cpio in coreos-modules at bootengine.cpio was only written to |
153a6e7
to
2940fb0
Compare
Set CONFIG_ARCH_ROCKCHIP
After some discussion on Matrix about Odroid M1S (based on RK3566), I made this PR to enable Rockchip arch in the kernel.
The goal is to test the generated aarch64 image on my hardware and to see if the initrd size is not increased to much before discussing about the possible inclusion of this configuration in Flatcar.
How to use
Installing the image in Odroid M1S requires U-Boot binaries and multiple steps. I will add testing commands if it works on my hardware and someone want to try it on real hardware.
Testing done
No testing for now. I plan to download the generated image (when it's generated) and install it on my hardware to test if it boots.
changelog/
directory (user-facing change, bug fix, security fix, update)/boot
and/usr
size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.