Posts: 2
Joined: Sat Jul 13, 2019 6:15 pm

Cross compile 64 Bit Kernel for Pi4

Sat Jul 13, 2019 7:45 pm

Hey guys,

I read different stuff on the web and finally, thus having absolutely no clue about compiling, cross compiling, arm, etc. I managed to cross-compile the 64 bit kernel and created my image. However if I start my pi using my kernel8.img file I only see the 1 second screen full of colors and then my pi simly stops at a black screen. I am using linux mint as OS to cross-compile. Can someone help me out? This is what I did so far:

Code: Select all

sudo apt-get update && sudo apt-get install -y libssl-dev bc build-essential gcc-aarch64-linux-gnu git unzip
git clone --depth=1 -b rpi-5.1.y https://github.com/raspberrypi/linux.git
cd linux
nano arch/arm64/configs/bcm2711_defconfig
	#CONFIG_VIDEO_BCM2835=m  commented this line, see https://github.com/raspberrypi/linux/issues/3031
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig
make -j 15 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
wget -O raspbian.zip https://downloads.raspberrypi.org/raspbian_lite_latest
unzip raspbian.zip
fdisk -l 2019-07-10-raspbian-buster-lite.img
sudo mount -o loop,offset=276824064 2019-07-10-raspbian-buster-lite.img /mnt
sudo mount -o loop,offset=4194304,sizelimit=268435968 2019-07-10-raspbian-buster-lite.img /mnt/boot
cp arch/arm64/boot/Image /mnt/boot/kernel8.img
cp arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb /mnt/boot/
sudo echo arm_64bit=1 >> /mnt/boot/config.txt
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=/mnt modules_install
sudo umount /mnt/boot && sudo umount /mnt

User avatar
Posts: 3172
Joined: Wed Aug 28, 2013 3:31 am

Re: Cross compile 64 Bit Kernel for Pi4

Sun Jul 14, 2019 7:03 am

Not many people have done this.

Might be clues here.
https://www.raspberrypi.org/forums/view ... r+Gentoo64
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Posts: 35381
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Cross compile 64 Bit Kernel for Pi4

Sun Jul 14, 2019 11:25 pm

Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Advanced users”