Home | Projects | Notes > Linux Device Drivers > Linux Kernel Source Update
Clone the kernel source from BBB official GitHub repository (https://github.com/beagleboard/linux)
4.14 is used for this project
In the workspace/source/
directory:
xxxxxxxxxx
11git clone https://github.com/beagleboard/linux.git linux_bbb_4.14
cd
to linux_bbb_4.14/
and run git checkout 4.14
.
Compile and generate the kernel image from the downloaded kernel image directory (workspace/source/linux_bbb_4.14/
)
Step 1:
xxxxxxxxxx
11make ARCH=arm distclean
Removes all the temporary folder, object files, images generated during the previous build.
Also, deletes the
.config
file if created previously.
Step 2:
xxxxxxxxxx
11make ARCH=arm bb.org_defconfig
Creates a
.config
file by using default config file given by the vendor (Default config file can be found inworkspace/source/linux_bbb_4.14/arch/arm/configs/
)
Step 3 (Optional):
xxxxxxxxxx
11make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
Run this command only if you want to change some kernel settings before compilation.
Step 4: Compile kernel source
xxxxxxxxxx
11make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage dtbs LOADADDR=0x80008000 -j4
Creates a kernel image
uImage
.Compiles all device tree source files, and generates
dtbs
.
#error New address family defined, please update secclass_map.
can be resolved by:
scripts/selinux/genheaders/genheaders.c
#include <sys/socket/h>
scrpts/selinux/mdp/mdp.c
#include <sys/socket.h>
security/selinux/include/classmap.h
#include <linux/socket.h>
fatal error: mpc.h: No such file or directory
error may arise, which is caused by the lack of multiple precision complex floating-point library development package libmpc-dev
. Resolve this error by running:
xxxxxxxxxx
11sudo apt install libmpc-dev
Step 5: Build kernel modules
xxxxxxxxxx
11make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules -j4
Builds and generates in-tree loadable(M) kernel module (
.ko
).
Step 6:
xxxxxxxxxx
11sudo make ARCH=arm modules_install
Installs all the generated
.ko
files in the default path of the computer (/lib/modules/<kernel_ver>
).
Now, you should be able to see /lib/modules/4.14.108+/
directory.
Update the
To update the kernel image and dtb in the
Copy workspace/source/linnux_bbb_5.10/arch/arm/boot/uImage
to /mdeia/klee/BOOT/
(
Copy workspace/source/linnux_bbb_5.10/arch/arm/boot/dts/am335x-boneblack.dtb
to /mdeia/klee/BOOT/
(
Don't forget update dtb! It will hang the boot process at 'Starting kernel ...'.
Select the dtb file whose name matches the one that is present in the
BOOT
partition of theSD card.
To update the kernel modules in the
Copy newly installed kernel modules /lib/modules/4.14.108+/
to /media/klee/ROOTFS/lib/modules/
(
Run sync
to flush left-over contents in the buffer to the media
Boot the board from the updated
Check the kernel version after login:
xxxxxxxxxx
11uname -r
It should display the updated kernel version. (4.14.108+
in my case)