This is an old revision of the document!
Objectives of this tuto is to build module compatible with current AKF kernel
Kernel version of the force is 5.15.89-inmusic-2023-01-18-rt56
To build same kernel/module as force you'll need :
- Arm processor to build source, you can cross compile but it is easier to do it on an arm processor ( so you can use raspberry pi, arm chromebook etc.., on my side i use an ARM chromebook with a RK3288; same chip as akaiforce.
- Linux kernel source version 5.15 https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.tar.xz
- Linux kernel patch version 5.15.86 https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-5.15.86.xz
- Linux incremental patch 5.15.86-87 https://cdn.kernel.org/pub/linux/kernel/v5.x/incr/patch-5.15.86-87.xz
- Linux incremental patch 5.15.87-88 https://cdn.kernel.org/pub/linux/kernel/v5.x/incr/patch-5.15.87-88.xz
- Linux incremental patch 5.15.88-89 https://cdn.kernel.org/pub/linux/kernel/v5.x/incr/patch-5.15.88-89.xz
- Linux realtime ( RT ) patch 5.15.86-rt56 https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/older/patches-5.15.86-rt56.tar.gz
- dos2unix tool (apt-get)
- config file from AKF kernel.
Extract kernel source 5.15 with
tar -xf linux-5.15.tar.xz
it will create a folder linux-5.15, this is what i call source tree ( or kernel source )
Unzip all patches
unxz patch-5.15.86.xz unxz patch-5.15.86-87.xz unxz patch-5.15.87-88.xz unxz patch-5.15.88-89.xz tar xvzf patches-5.15.86-rt56.tar.gz
You should have something like this :
apply dos2unix on each patches, and in folder patches ( extracted from patches-5.15.86-rt56)
dos2unix patch-5* cd patches dos2unix *.patch
Go to kernel source and patch like below
cd linux-5.15 /linux-5.15$ patch -p1 < ../patch-5.15.86 /linux-5.15$ cat ../patches/*.patch | patch -p1 /linux-5.15$ patch -p1 < ../patch-5.15.86-87 /linux-5.15$ patch -p1 < ../patch-5.15.87-88 /linux-5.15$ patch -p1 < ../patch-5.15.88-89
Order is : 5.15.86, Rtpatch 5.15.86-rt56 , 5.15.86-87 , 5.15.87-88 , 5.15.88-89
Now we have 5.15.89-rt56
stay in source tree folder :
Change localversion in file localversion-rt
change -rt56 to -inmusic-2023-01-18-rt56
Get kernel config from AkaiForce kernel : this file is named config.gz and we can find it in /proc/ (on AKF ) unzip the file with gunzip
gunzip config.gz
It gives a file named “config”
Copy this file in source tree folder as “.config” name.
go to source tree folder to build menuconfig
make menuconfig
.config taken from force has features like :
- General Setup / Local version string, now it's empty (let it empty )
- General Setup / Preemption model ⇒ Fully Preemptible Kernel ( Real-Time ) : this give the rt features.
this option is only available after patching with rt56 patch.
( and of course other features …)
As we have the kernel configuration, you can see what features are already in the kernel, and whiches are not. To test kernel viability, i will compile a module which is not there by default , I will do it with “Joystick Interface” :
It's in : DeviceDrivers » Input device support » Joystick Interface
Just put a M like below , then save & Exit menuconfig
Now when your back in source tree folder type :
make modules_prepare
Then go to your module folder in source tree. For joystick module we've checked in kernel config, it's located in /src/builddemo/linux-5.15/drivers/input
and launch :
syntax is : make -C <path_to_kernel_dir> M=$PWD so i do : ~/src/builddemo/linux-5.15/drivers/input$ make -C ~/src/builddemo/linux-5.15/ M=$PWD
Make detects that you have checked joystick device as module in kernel config, so it compiles the associated module source file.
Then you have your module.
you can check version in module with command
grep -a inm joydev.ko
Now it's time to copy module on your force.
On AKF :
remount / partition in rw :
mount remount / -o rw,exec,remount
copy module file to /usr/lib/modules/5.15.89-inmusic-2023-01-18-rt56/kernel/drivers/input
Each time i copy a module, i try to respect the source tree path, so if you don't have drivers/input folder, create it and put module inside. then do command depmod to says system new module is there.
depmod
Issue command lsmod to see current loaded modules :
do modprobe joydev