User Tools

Site Tools


kernel_build

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 

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 :

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* 
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-)

go to source tree folder :

Change localversion in file localversion-rt

 change -rt56 to -inmusic-2023-01-18-rt56 

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 as “.config” name.

go to source tree to build menuconfig

 make menuconfig 

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 rt56.

     this option is only available after patching with rt56 patch. 

dnttalo.cluster029.hosting.ovh.net_pictures_kernel_menuconfig_generalsetup.jpg dnttalo.cluster029.hosting.ovh.net_pictures_kernel_menuconfig_premptionmodel.jpg 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 which are not. To test kernel, 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

dnttalo.cluster029.hosting.ovh.net_pictures_kernel_joystickmodule.jpg

Just put a M like below , then save & Exit menuconfig

Now when your back in source tree type

 make modules_prepare 

then go to your module folder in source tree. For joystick it's in /src/builddemo/linux-5.15/drivers/input

and launch :

 ~/src/builddemo/linux-5.15/drivers/input$ make -C ~/src/builddemo/linux-5.15/ M=$PWD 

Make detect you have check joystick device as module in kernel config, so it compile 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

 depmod 
kernel_build.1737498137.txt.gz · Last modified: 2025/01/21 23:22 by ounsatn

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki