** 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 )
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/KernelSourceFile.JPG}}
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 :
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/KernelFilesList.JPG}}
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 8-)
__stay in source tree folder :__
Change localversion in file localversion-rt
change -rt56 to -inmusic-2023-01-18-rt56
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/localversion_change.JPG}}
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
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/Make_menuconfig.JPG}}
.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 ...)
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/Menuconfig_generalsetup.JPG}}
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/Menuconfig_Premptionmodel.JPG}}
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/Menuconfig_CheckRTl.JPG}}
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
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/JoystickModule.JPG}}
Now when your back in source tree folder type :
make modules_prepare
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/make_module_prepare.JPG}}
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 M=$PWD
so i do :
~/src/builddemo/linux-5.15/drivers/input$ make -C ~/src/builddemo/linux-5.15/ M=$PWD
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/Make_module.JPG}}
Make detects that you have checked joystick device as module in kernel config, so it compiles the associated module source file.
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/Make_module_2.JPG}}
Then you have your module.
you can check version in module with command
grep -a inm joydev.ko
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/grep_inmusic.JPG}}
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 :
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/lsmod_before.JPG}}
do modprobe joydev
Issue it again, tadaaaa it's there.
{{http://dnttalo.cluster029.hosting.ovh.net/Pictures/Kernel/modprobe_joydev.JPG}}