I wish to compile the kernel module for a usb wifi dongle on my pi4 (as I do on my pi2 and pi3 [whose internal wifi died])
As pi4 kernel is aarch64 I figured I needed to install build-essential:arm64
but “apt-get install build-essential:arm64” fails saying there are 2 unsatisfied dependencies due to a package being in “hold” mode:
build-essential:arm64 : Dépend: make:arm64
Dépend: dpkg-dev:arm64 (>= 1.17.11)
E: Impossible de corriger les problèmes, des paquets défectueux sont en mode « garder en l'état ».
How do I get around this ?
Use the 64-bit tool chain instead.
To be installed on the pi4 itself or on my desktop/laptop (x86_64) ?
I tried installing on the pi4 itself, but the I’m getting
osmc@pi4:/opt/osmc-tc/aarch64-toolchain-osmc/usr/bin$ ./aarch64-linux-gnu-gcc-8 -v
-bash: ./aarch64-linux-gnu-gcc-8: Aucun fichier ou dossier de ce type
Suggesting it might not be meant to be installed on the pi4…
sudo apt-get install aarch64-toolchain-osmc
Thanks @sam for your tips which heped me figure it out and get my usb wifi dongle module compiled
For those interested:
prepare the chroot to get acces to directories needed for kernel module build
chROOT="/opt/osmc-tc/aarch64-toolchain-osmc"
mkdir -p $chROOT/home
mount --bind /home $chROOT/home #module source is in /home/osmc
mkdir -p $chROOT/usr/src #kernel source
mount --bind /usr/src $chROOT/usr/src
mkdir -p $chROOT/lib/modules #module makefiles refer to /lib/modules/$KVER/build
mount --bind /lib/modules $chROOT/lib/modules
and then instead of issuing
sudo make -j 4
I now do
SUDO make -j 4
with SUDO defined as such :
SUDO() {
sudo $chROOT bash -c "cd $PWD; $@"
}
@sam The only issue I had and circumvented was that bc
is not in the toolchain but required by one of the Makefiles I was using… Do you think bc
could make it into the aarch64 toolchain ?
No – it should be installed manually as it isn’t a common dependency.