You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A first step would be to align the USE flags and related things of the package setup to be equal on or independent of both architectures.
The SDK bootstrap needs a seed tar ball with a compiler – I guess the arm64 developer container can be used for that.
So I managed to get it working with the arm64 developer container as a base, however I would not recommend trying that a second time: the developer container has the wrong profile and CHOST, making the process trickier than necessary to begin with. After that it's all about keywords and fixing x86 specific assumptions.
I believe most of the changes necessary to get the bootstrap working (starting from a reasonable seed) can be merged, I'll submit the PRs in the next weeks.
Currently the SDK sets up QEMU process emulation for arm64 and now you would need to set up the reverse direction because during compilation of some packages the build system has to run some amd64 binaries.
The key action is setting up QEMU_LD_PREFIX and the rest can actually be removed because the normal Debian/Fedora packing of qemu-user loads the qemu binary into RAM on boot and we don't need to set it up from the SDK with dynamic loading which does not cover all cases.
It doesn't look like it's going to be as "easy" as crosscompiling arm64 from amd64 though, because some programs that are called from the SDK for image building (syslinux, x86-specific parts of grub) can't be built for arm64 natively.
My first objective is to get arm64 -> arm64 working, and get us into a state where we can support the SDK infrastructure on our servers. Without that, it's a pain to use.
In general it looks good.
Following @jepio's instruction, I was able to create an arm64 SDK on an arm64 host. (actually an arm64 VM on Mac M1)
From that tarball, I created another flatcar-sdk environment.
Inside that, I was able to successfully build an arm64 qemu image, with fantastic speed.
However some hacks or tweaks are needed.
I am just listing all, probably some of them are just my testing failure.
mantle/cork needed code change to skip verifying gpg signature. Not sure why.
mantle/cork needed code change to skip downloading SDK tarballs, because arm64 tarballs are not on flatcar-linux.net yet.
build_image failed with ERROR : Required WHITE_LIST items ld-linux-x86-64.so.2 not found!!!. That's because WHITELIST has only x86_64 linker. I am not sure how we should support multi-arch there.
After creating an qemu image, running flatcar_production_qemu_uefi.sh fails, because the script simply assumes the host is x86_64. e.g. accel=kvm.
For the last point: the script already checks for an arm64 host but it assumes that KVM is available, maybe you can enable nested virtualization for the host VM?
@dongsupark are you using qemu for virtualization? You could try to adapt the script to get it working when ran from the host. Probably some of the helper tools are not available, and instead of accel=kvm you need accel=hvf.
are you using qemu for virtualization? You could try to adapt the script to get it working when ran from the host. Probably some of the helper tools are not available, and instead of accel=kvm you need accel=hvf.
I am using UTM, basically a wrapper around qemu.
UTM is already passing accel=hvf as expected.
Still inside the guest Linux VM, the Flatcar script fails.
Anyway don't worry, that's not super critical, I could find out other options for testing qemu images. ;-)
@chewi: if we're switching to catalyst4 then it would be a good idea to switch for amd64 sdk first, validate that everything is still correct and then go for arm64. i can also get you access to a shiny Azure Cobalt instance for building
I hit an issue cross-building a native toolchain for amd64: cet support in the toolchain (enabled by amd64 hardened profile) has a build dependency on binutils[cet]. cet is only unmasked for amd64 profiles. I would ignore cross-compiling from amd64->arm64, there is no usecase for it and it's not something anyone has thought of doing in the oss world.
Yeah, switching to 4 first might be best before any official arm64 SDK release, but the result of this should be good enough to kick off an entirely native build once we've done that.
I believe CET refers to some possibly amd64-specific CPU feature. From a Gentoo perspective, I'd like cross-compiling with CET to work, so I'll look into avoiding the mask when using crossdev.
Good news on this front. Reworking the Dracut bits was the main blocker here. With that done, I was able to take my branch of now relatively small changes and use it to build a fresh arm64 SDK. I was even able to use the Gentoo systemd stage3 as a seed without any issues, thanks to other changes we've made along the way. Making this official requires a little more work as the naming and usage of our current SDK assumes a single build architecture. A multi-platform container would probably make sense, although I think it would need to be pulled together from multiple CI jobs, as we can't cross-compile the SDK, and we certainly don't want to build it with QEMU.
Nearly there now with the building side of things. See flatcar/scripts#3678. Just waiting on a weekly update to pull in some of my recent Gentoo fixes before we merge that.
Activity
pothos commentedon Jan 18, 2021
A first step would be to align the USE flags and related things of the package setup to be equal on or independent of both architectures.
The SDK bootstrap needs a seed tar ball with a compiler – I guess the arm64 developer container can be used for that.
jepio commentedon Jul 16, 2021
So I managed to get it working with the arm64 developer container as a base, however I would not recommend trying that a second time: the developer container has the wrong profile and CHOST, making the process trickier than necessary to begin with. After that it's all about keywords and fixing x86 specific assumptions.
The built SDK can be fetched from
https://jepio.blob.core.windows.net/flatcar-arm64/stage4-arm64-2920.0.0+2021-07-13-1007.tar.bz2https://jepio.azureedge.net/flatcar-arm64/2942.0.0/flatcar-sdk-arm64-2942.0.0+2021-07-27-0724.tar.bz2. The binary packages, intermediate stages and my hacked up developer container can be found in the same bucket (https://jepio.blob.core.windows.net/flatcar-arm64?restype=container&comp=list).I believe most of the changes necessary to get the bootstrap working (starting from a reasonable seed) can be merged, I'll submit the PRs in the next weeks.
vbatts commentedon Jul 23, 2021
@jepio that's awesome! that was the path I began, but abandoned when I was trying from my pinebook. Looking forward to it being an option
jepio commentedon Jul 23, 2021
Here's a bit more instructions for how to use this @dongsupark:
pothos commentedon Jul 23, 2021
Currently the SDK sets up QEMU process emulation for arm64 and now you would need to set up the reverse direction because during compilation of some packages the build system has to run some amd64 binaries.
The key action is setting up
QEMU_LD_PREFIXand the rest can actually be removed because the normal Debian/Fedora packing of qemu-user loads the qemu binary into RAM on boot and we don't need to set it up from the SDK with dynamic loading which does not cover all cases.jepio commentedon Jul 27, 2021
I agree.
It doesn't look like it's going to be as "easy" as crosscompiling arm64 from amd64 though, because some programs that are called from the SDK for image building (syslinux, x86-specific parts of grub) can't be built for arm64 natively.
My first objective is to get arm64 -> arm64 working, and get us into a state where we can support the SDK infrastructure on our servers. Without that, it's a pain to use.
dongsupark commentedon Aug 11, 2021
In general it looks good.
Following @jepio's instruction, I was able to create an arm64 SDK on an arm64 host. (actually an arm64 VM on Mac M1)
From that tarball, I created another flatcar-sdk environment.
Inside that, I was able to successfully build an arm64 qemu image, with fantastic speed.
However some hacks or tweaks are needed.
I am just listing all, probably some of them are just my testing failure.
build_imagefailed withERROR : Required WHITE_LIST items ld-linux-x86-64.so.2 not found!!!. That's because WHITELIST has only x86_64 linker. I am not sure how we should support multi-arch there.flatcar_production_qemu_uefi.shfails, because the script simply assumes the host is x86_64. e.g. accel=kvm.pothos commentedon Aug 11, 2021
For the last point: the script already checks for an arm64 host but it assumes that KVM is available, maybe you can enable nested virtualization for the host VM?
jepio commentedon Aug 11, 2021
Nested virt is not available on M1 right now.
@dongsupark are you using qemu for virtualization? You could try to adapt the script to get it working when ran from the host. Probably some of the helper tools are not available, and instead of
accel=kvmyou needaccel=hvf.dongsupark commentedon Aug 12, 2021
I am using UTM, basically a wrapper around qemu.
UTM is already passing
accel=hvfas expected.Still inside the guest Linux VM, the Flatcar script fails.
Anyway don't worry, that's not super critical, I could find out other options for testing qemu images. ;-)
dongsupark commentedon Aug 12, 2021
As for the multi-arch issue in generate_au_zip, I ended up writing a PR like that: flatcar/scripts#141
jepio commentedon Apr 12, 2022
I think this is what was needed to create a "seed" from a development container https://gist.github.com/jepio/7ee539b768f7a33953d137d0ff7c6abe.
9 remaining items
jepio commentedon May 29, 2024
@chewi: if we're switching to catalyst4 then it would be a good idea to switch for amd64 sdk first, validate that everything is still correct and then go for arm64. i can also get you access to a shiny Azure Cobalt instance for building
jepio commentedon May 29, 2024
I've pushed two sdk container images:
ghcr.io/jepio/flatcar-sdk-arm64/flatcar-sdk-arm64:3941.0.0-2024-05-29-1223
ghcr.io/jepio/flatcar-sdk-arm64/flatcar-sdk-tarball:3941.0.0-2024-05-29-1223 <- catalyst output
I hit an issue cross-building a native toolchain for amd64: cet support in the toolchain (enabled by amd64 hardened profile) has a build dependency on binutils[cet]. cet is only unmasked for amd64 profiles. I would ignore cross-compiling from amd64->arm64, there is no usecase for it and it's not something anyone has thought of doing in the oss world.
chewi commentedon May 29, 2024
Yeah, switching to 4 first might be best before any official arm64 SDK release, but the result of this should be good enough to kick off an entirely native build once we've done that.
I believe CET refers to some possibly amd64-specific CPU feature. From a Gentoo perspective, I'd like cross-compiling with CET to work, so I'll look into avoiding the mask when using crossdev.
chewi commentedon May 29, 2024
Bah, it failed quite late on with sys-block/thin-provisioning-tools. Seems like some broken CoreOS Rust/cargo cross-compiling logic.
chewi commentedon Jul 5, 2024
I got it working. Closing in favour of flatcar/scripts#2093.
jepio commentedon Jul 8, 2024
This is the tracking issue, we keep it open until the PR lands.
chewi commentedon Apr 28, 2025
Good news on this front. Reworking the Dracut bits was the main blocker here. With that done, I was able to take my branch of now relatively small changes and use it to build a fresh arm64 SDK. I was even able to use the Gentoo systemd stage3 as a seed without any issues, thanks to other changes we've made along the way. Making this official requires a little more work as the naming and usage of our current SDK assumes a single build architecture. A multi-platform container would probably make sense, although I think it would need to be pulled together from multiple CI jobs, as we can't cross-compile the SDK, and we certainly don't want to build it with QEMU.
chewi commentedon Feb 4, 2026
Nearly there now with the building side of things. See flatcar/scripts#3678. Just waiting on a weekly update to pull in some of my recent Gentoo fixes before we merge that.
chewi commentedon May 20, 2026
The support is finally merged. Now we just need to build and publish regularly. There's now a little more interest in this than there previously was.