Home | Projects | Notes > Linux Device Drivers > Linux Kernel Source Update

Linux Kernel Source Update

 

Linux Kernel Source Update

  1. Clone the kernel source from BBB official GitHub repository (https://github.com/beagleboard/linux) This will clone the master branch of the repository. You will need to checkout a specific branch (i.e., kernel source version).

    • 4.14 is used for this project

      In the workspace/source/ directory:

    • cd to linux_bbb_4.14/ and run git checkout 4.14.

  2. Compile and generate the kernel image from the downloaded kernel image directory (workspace/source/linux_bbb_4.14/)

    • Step 1:

      Removes all the temporary folder, object files, images generated during the previous build.

      Also, deletes the .config file if created previously.

    • Step 2:

      Creates a .config file by using default config file given by the vendor (Default config file can be found in workspace/source/linux_bbb_4.14/arch/arm/configs/)

    • Step 3 (Optional):

      Run this command only if you want to change some kernel settings before compilation.

    • Step 4: Compile kernel source

      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:

      1. scripts/selinux/genheaders/genheaders.c comment out #include <sys/socket/h>

      2. scrpts/selinux/mdp/mdp.c comment out #include <sys/socket.h>

      3. security/selinux/include/classmap.h add #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:

    • Step 5: Build kernel modules

      Builds and generates in-tree loadable(M) kernel module (.ko).

    • Step 6:

      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.

  3. Update the µSD with the new kernel image, dtb and kernel modules

    • To update the kernel image and dtb in the µSD:

      • Copy workspace/source/linnux_bbb_5.10/arch/arm/boot/uImage to /mdeia/klee/BOOT/ (µSD card).

      • Copy workspace/source/linnux_bbb_5.10/arch/arm/boot/dts/am335x-boneblack.dtb to /mdeia/klee/BOOT/ (µSD card).

        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 the µSD card.

    • To update the kernel modules in the µSD:

      • Copy newly installed kernel modules /lib/modules/4.14.108+/ to /media/klee/ROOTFS/lib/modules/ (µSD card).

      Run sync to flush left-over contents in the buffer to the media

  4. Boot the board from the updated µSD card.

  5. Check the kernel version after login:

    It should display the updated kernel version. (4.14.108+ in my case)