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
@@ -54,11 +54,7 @@ sha256sums=('675243522bf991f3bf6fafa2ff1271bffae4ec514f5fbbf350571cf3f0617e05'
-if [ "$(uname -m)" = "riscv64" ]; then
-  _target=""
-  _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