in ,

Building a 64-bit aarch64 kernel and userspace for the Raspberry Pi 4, Hacker News


Building a 64 -bit aarch 64 kernel and userspace for the Raspberry Pi 4

I’ve recently been tinkering around with using a Raspberry Pi as a desktop computer. The Pi 4 is fairly powerful; very sufficient for web browsing, audio, video, and terminal use for programming.

I use Arch Linux on most of my machines, so it was only natural to use Arch on the RPi. There’s a community port athttps://archlinuxarm.org. One problem – only the 32 -bit port is available.

Easy, I thought; we’ll just recompile the kernel and userspace for 64 – bit.

Turns out there’s a bit more to it!

There are a few ways to skin this cat, such as cross compiling, but the easiest method I found was as follows:

This will form the initial 32 – bit environment that will run on the Pi.

This will be the 64 – bit environment we chroot into and build the kernel within.

This will be used later in order to enable the use of an aarch 64 chroot on x 86 _ 64.

  • Extract the aarch 64 image, and usesystemd-nspawn -D / path / to / aarch 64 - rootin order to gain root

I suggest changing MAKEFLAGS in/ etc / makepkg.conf

at this point in order to reflect the number of cores on your build system.

Installation will take some time here as it’s a full kernel build. For reference, on my 12 C / (t Threadripper 1920 x the build took(a standard build or cross compile takes about 3 minutes, for reference).

Copy out the finished packages - both the kernel and headers.

  • Extract the armv7h image, and usesystemd-nspawn -D / path / to / aarch 64 - rootin order to gain root

Copy your built aarch 64 kernel into the chroot.

Follow the instructions athttps://wiki.archlinux.org/index.php/Migrating_between_architectures

in order to migrate from armv7h to aarch 64.

Roughly:

pacman -S pacman-contrib # for pactree sed -i /etc/pacman.conf "s / armv7h / aarch 64 / '' -Syy pacman pacman -Sw $ (pacman -Qqn) pactree -l pacman | pacman -S - pacman -Qqn | pacman -S -

With a bit of luck, this all worked. You should now be able to install your built aarch 64 kernel into the chroot. Once all of that is done, copy over the completed filesystem to an SD card in the standard way, and you should be there! Seehttps://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4 (for reference.)

Happy tinkering!

esotericnonsense (Daniel Edgecumbe)[email protected]

November 16, 2019

Brave Browser
Read More
Payeer

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

Bolton flats blaze: students 'confused as alarms go off daily' – BBC News, BBC News

Bolton flats blaze: students 'confused as alarms go off daily' – BBC News, BBC News

Google One, Hacker News