Banana pi R2 linux headers

Hii Team ,

We are facing Linux-headers issue in our BananapiR2 box while installing wire guard . We have browsed so many sites , but unable to fetch the best one . Please advise for the same .

apt search linux-headers-$(uname -r) Sorting… Done Full Text Search… Done [email protected]:~$ uname -r 4.4.70-BPI-R2-Kernel [email protected]:~$ sudo apt upgrade --fix-missing [sudo] password for pi: ^Csudo: 1 incorrect password attempt [email protected]:~$ sudo apt upgrade --fix-missing [sudo] password for pi: Reading package lists… Done Building dependency tree
Reading state information… Done Calculating upgrade… Done The following packages have been kept back: docker-ce 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. [email protected]:~$ apt install linux-headers-$(uname -r) E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? [email protected]:~$ sudo apt install linux-headers-$(uname -r) Reading package lists… Done Building dependency tree
Reading state information… Done E: Unable to locate package linux-headers-4.4.70-BPI-R2-Kernel E: Couldn’t find any package by glob ‘linux-headers-4.4.70-BPI-R2-Kernel’ E: Couldn’t find any package by regex ‘linux-headers-4.4.70-BPI-R2-Kernel’ [email protected]:~$ cd /usr/src [email protected]:/usr/src$ ls linux-headers-4.4.0-198 linux-headers-4.4.0-198-generic wireguard-1.0.20201112 [email protected]:/usr/src$ uname -r 4.4.70-BPI-R2-Kernel

Thanks & regards Sachin Bansal

Mostly kernel on arm is not installed via paketmanager. And providing the package to apt it needs a apt repo for it.

Source is on github,but this can be tricky to get it on the board so that install-script can use it.

You can install newer kernel (imho 5.4 already includes wireguard if activated) from my repo. Afair it is not enabled,so you cannot use the precompiled kernels so you have to compile yourself

Just clone,import defconfig,add wireguard and compile.

By default linux from 5.6 has wireguard included,but my repo has it added to 5.4

But not newest version…but for a first try you can use it…

can you please provide me the iso image or any github link of you 5.4 repo .So that I can easily use that image with bpi-copy toolchain.

You can use your existing image,only install new kernel

  • clone repo to host pc,r2 is slow for compiling
  • ./build.sh importconfig
  • ./build.sh config #to add wireguard
  • ./build.sh #compile and choose install when finished (sdcard with your image inserted in your host)
  • change uEnv.txt (kernel) to match your new kernel filename

Edit: As you move from 4.4 you need to adjust your network-config as 4.4 uses both phy and 4.14+ use dsa driver (each port have own interface and eth0 is gmac between soc and switch). See my wiki for details. Or maybe try one of my images as base…they already have that config…only need to adjust to your network (and of course replace lernel with wireguard support)

Actually I am new on embedded Can you please provide me the steps , that how to compile the kernel source code 5.6 , with cross compiler . I didn’t find any defconfig in kernel source code .

OR

Please provide me the precompiled .img image . So that I can use it and run the wireguard .

Thanks in Advance Sachin Bansal

use a image based on new kernel like this one (dsa-configuration):

then clone my repo (linux host pc, because compiling is faster on it than on r2)

git clone https://github.com/frank-w/BPI-R2-4.14.git
git checkout 5.10-main #optional (you can also use default 5.4-main, as i had integrated wireguard there, but older version)
./build.sh importconfig
./build.sh config #search (/) wireguard here and select it
./build.sh #start compiling (insert sdcard of the new image before install prompt,and select here "install to sdcard")

you will be prompted after install to open uenv.txt, copy filename of your kernel and edit the uenv-file by adding

kernel=yourfilename

build-script asks for umounting, do it if you changed uenv.txt right, remove card and boot r2

i’ve seen i had wireguard already enabled on 5.4-main, so you can use a precompiled kernel, just unpack tar.gz contents to the partitions like folder names and change uenv.txt