Building the Kernel for Arch Linux Image on *x86_64* PC

Back to the “native compile” instead of docker topic. With some very small changes I managed it to build the kernel directly on my machine. The only thing you need to change is the _target in the PKGBUILD because it is then riscv64 in every case.

diff --git a/PKGBUILD b/PKGBUILD
index 869d582..d4874e4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -54,11 +54,7 @@ sha256sums=('675243522bf991f3bf6fafa2ff1271bffae4ec514f5fbbf350571cf3f0617e05'
             '5393644e15324d5254868a6e41e19baa63c1ab940887aee18e9e93037575b67b'
             '3d65589915b56de000ae7c93f5d7fbc9cf747891a45b69559ed92e03b95f692b')
 
-if [ "$(uname -m)" = "riscv64" ]; then
-  _target=""
-else
-  _target="--target=riscv64"
-fi
+_target="--target=riscv64"
 
 prepare() {
   cd $_srcname

After that you can simply build by

makepkg --config docker/makepkg.conf

If you want to use a different core/job count, perhaps adjust the “-j” parameter in the makepkg.conf before building.

For other packages I build on the VisionFive 2 because it is fast enough (well, perhaps things like Libreoffice or other huge packages might be a pain tho :wink: )

1 Like