Compiling WireGuard (and other things requiring linux-headers) on Debian+Mate
#2
Finally got this working.

The kernel is arm64 and the userland is armhf, so anything to do with the kernel has to be cross-compiled.

First compile the aarch64 cross-compiling binutils & gcc from source, as they're not available in Debian stretch for armhf.
Follow this howto: https://www.tal.org/tutorials/raspberry-...bit-kernel
(Add any other packages it needs; I needed texinfo.)

Next get the source for your running kernel.
$ uname -a
Code:
Linux Debian-Desktop 4.4.213 #1 SMP Fri Feb 7 13:03:55 EST 2020 aarch64 GNU/Linux

Look at https://github.com/mrfixit2001/rockchip-...elease-4.4 and find the corresponding commit.
Currently that's 209da1a which is 15th from the top.

$ mkdir kernel-out
$ gunzip -c /proc/config.gz | sed s/CONFIG_LOCALVERSION_AUTO=y/CONFIG_LOCALVERSION_AUTO=n/ > kernel-out/.config

Make the output directory & copy the config from the running kernel into it ("As a generated output, the .config file must be in $KBUILD_OUTPUT") with one change. The change is necessary to get the kernel version number to exactly line up so the module can be loaded.

Now we get the kernel sources.
$ git clone --depth=15 https://github.com/mrfixit2001/rockchip-kernel.git
$ cd rockchip-kernel
$ git checkout 209da1a

It only needs modules_prepare, we don't need to build the whole kernel.
(See: https://www.kernel.org/doc/html/latest/k...dules.html)
$ LOCALVERSION="" make -j6 O=../kernel-out ARCH=arm64 CROSS_COMPILE=/opt/aarch64/bin/aarch64-linux-gnu- modules_prepare

Create the symlink that the linux-headers package normally does.
$ sudo ln -s /home/rock/build-area/kernel-out/ /lib/modules/$(uname -r)/build

(Using the actual pathname of your output directory.)

Now get the WireGuard source & build it according to the usual instructions, with one change.
https://www.wireguard.com/compilation/

The kernel module needs to be cross-compiled:
$ make -C wireguard-linux-compat/src -j$(nproc) ARCH=arm64 CROSS_COMPILE=/opt/aarch64/bin/aarch64-linux-gnu-

The rest of the make lines are the same.


Messages In This Thread
RE: Compiling WireGuard (and other things requiring linux-headers) on Debian+Mate - by Dendrocalamus64 - 04-02-2020, 07:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Debian on Pinebook Pro u974615 7 826 03-31-2024, 10:11 AM
Last Post: u974615
  Attempting to install Void Linux, boots into a black screen 9a3eedi 0 309 02-18-2024, 08:54 AM
Last Post: 9a3eedi
  install debian on pbp jsch 7 3,977 11-22-2023, 04:22 PM
Last Post: TRS-80
  How to mainline kernel on daniel thompson's debian installer? hellojack 14 7,265 09-07-2023, 09:38 PM
Last Post: Der Geist der Maschine
  Would a Pinebook Pro be good for a Linux newbie? cassado10 6 1,448 08-08-2023, 04:58 AM
Last Post: moobythegoldensock
  Unable to install Debian Bullseye because of missing wifi firmware Pino64 7 3,968 07-15-2023, 02:58 PM
Last Post: u974615
  Kali Linux for Pinebook Pro - stuck on the login screen owaspfap 0 646 07-13-2023, 05:21 PM
Last Post: owaspfap
  Kali Linux for Pinebook Pro Luke 100 158,355 05-03-2023, 06:10 AM
Last Post: dachalife
Question Debian (Vanilla) no output on display after Kernel update (6.0.8-1) as365n4 1 1,252 12-09-2022, 12:43 PM
Last Post: as365n4
  Unsuccessful using danielt's unofficial Debian installer on the PBP joeDoe 2 2,301 12-09-2022, 05:04 AM
Last Post: ndp

Forum Jump:


Users browsing this thread: 1 Guest(s)