Cross compile aarch64 kenerl for rpi3 on arch linux host

This forum is for topics dealing with problems with software specifically in the AArch64 repo.

Cross compile aarch64 kenerl for rpi3 on arch linux host

Postby LPFaile » Mon Sep 04, 2017 4:51 pm

Hi,

I try to compile the kernel sources of aarch64 for rpi 3. I want to modify the kerenl sources to include a new system call. For raspbian i just find the kernel source and use a crosscompile toolchain on my X86 with ubuntu.
For Arch pi 3 i can not find the kernel sources. I found this https://archlinuxarm.org/packages/aarch64/linux-aarch64 and https://archlinuxarm.org/packages/aarch … 64-headers. I try to compile by using a ready toolchain for armv8 that i find here https://archlinuxarm.org/wiki/Distcc_Cross-Compiling. I just run at kernel source make ARCH=arm64 CROSS_COMPILE=/path to my crosscompile/ clean. some errors related with missing of folders are cachieved.
Someone can guide me on this?
I have see at this forum subject viewtopic.php?f=65&t=11690 that someone infront the problem by modify the configuration at PKGBUIL, but i think this is not enough for me because I need to modify the kernel sources before of compile it.

Thanksss
LPFaile
 
Posts: 2
Joined: Mon Sep 04, 2017 4:33 pm

Re: Cross compile aarch64 kenerl for rpi3 on arch linux host

Postby graysky » Mon Sep 04, 2017 6:02 pm

$this->bbcode_second_pass_quote('graysky', 'T')o my knowledge you cannot compile armv7h or aarch64 on x86_64 native. You can use distcc and the correct toolchain and initiate the compile on the ARM device using the x86_64 host as a slave. I do this all the time.

https://archlinuxarm.org/wiki/Distcc_Cross-Compiling
https://wiki.archlinux.org/index.php/Distcc
graysky
Developer
 
Posts: 1728
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: Cross compile aarch64 kenerl for rpi3 on arch linux host

Postby LPFaile » Wed Sep 06, 2017 5:27 pm

My error was:

$this->bbcode_second_pass_quote('', '
') HOSTCC scripts/basic/bin2c
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
drivers/ras/Kconfig:33: can't open file "arch/x86/ras/Kconfig"
make[3]: *** [scripts/kconfig/Makefile:39: silentoldconfig] Error 1
make[2]: *** [Makefile:547: silentoldconfig] Error 2
scripts/Makefile.clean:14: arch/arm64/crypto/Makefile: No such file or directory
make[1]: *** No rule to make target 'arch/arm64/crypto/Makefile'. Stop.
make: *** [Makefile:1307: _clean_arch/arm64/crypto] Error 2


Note that the same error i achieved if i compile the packadge from https://archlinuxarm.org/packages/aarch ... 64-headers on X86 using a croos compile and also directly on Raspberry. What i think is that this packadge does not containe the kernel source, contain a patch to add to the base kernel. I think this because does not exist a folder arch/arm64/crypto/Makefile that exist at the v4.x kernel.
LPFaile
 
Posts: 2
Joined: Mon Sep 04, 2017 4:33 pm

Re: Cross compile aarch64 kenerl for rpi3 on arch linux host

Postby sirspudd » Fri Sep 08, 2017 4:33 am

Top of the morning,

I actually cover this (on fedora, but I duplicated the effort for Arch, just grab the source) at the foot of:

http://www.chaos-reins.com/2016-08-20-q ... a-aarch64/

namely:

dnf download –source kernel-main (on Fedora image)
Copy this to a build machine
Extracted the rpm (using rpmextract.sh on Arch)
Unpacked the source
Copied the standing config from /proc/config.gz to .config
make ARCH=arm CROSS_COMPILE=/opt/arm-sirspuddarch-linux-gnueabihf/bin/arm-sirspuddarch-linux-gnueabihf- bcm2835_defconfig
make ARCH=arm64 CROSS_COMPILE=/opt/aarch64-rpi3-linux-gnueabi/bin/aarch64-rpi3-linux-gnueabi- menuconfig
Disabled CONFIG_ARM64_VA_BITS_48 and adjust kernel as necessary
make ARCH=arm64 CROSS_COMPILE=/opt/aarch64-rpi3-linux-gnueabi/bin/aarch64-rpi3-linux-gnueabi-
INSTALL_MOD_PATH=foobar make ARCH=arm64 CROSS_COMPILE=/opt/aarch64-rpi3-linux-gnueabi/bin/aarch64-rpi3-linux-gnueabi- modules_install
Copy across the module directory indicated above, and the generated kernel ./arch/arm64/boot/Image (aarch64 requires this new Image format which contains ARM64 magic)
Update extlinux.conf
sirspudd
 
Posts: 12
Joined: Tue Oct 30, 2012 8:46 pm


Return to ARMv8

Who is online

Users browsing this forum: No registered users and 9 guests