5

I've spent hours, if not days figuring out how to cross compile Linux for AArch64.

I'm using Ubuntu in a VM to do this, however all guides I managed to find didn't work completely. Most of them assumed the end-user had Debian, and things are named differently there. Once I was able to get a configuration profile to be made, but I couldn't get it to be used. when I typed in make, I got a questionnaire for x86-based systems, despite I've saved the config file with menuconfig. Then I specified the ARCH and CROSS_COMPILE parameters, then I get yet another questionnaire, with skipping a lot of things that would've been essential for my build target.

Then my Ubuntu VM needed to be reinstalled, so I'm back at almost square zero, with no idea what I needed to install to get the cross-compilation to work, or how I did specify the CROSS_COMPILE parameter. I've installed the compiler (took hours to figure out how it's called under Ubuntu), but it has a different name when needed to be specified for cross-compilation. Maybe I've skipped something.

Yes, I've googled it multiple times, and most guides assumed the user knew a lot of quite obscure stuff. Many of them were even more than a decade old.

1 Answer 1

7

To cross-compile a kernel for AArch64 on Ubuntu, you need to install gcc-aarch64-linux-gnu, and run the build as

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- ...

Thus

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig

to configure, and

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- all

to build the kernel and modules.

If you can’t find an option you’re expecting, use / in menuconfig to look for it; that will tell you what else needs to be enabled.

(These are the same instructions as for Debian; the core cross-compiler packages are named the same in Debian and Ubuntu nowadays.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .