Update kernel configuration in Yocto Project

The kernel configuration file is important for building the kernel image. If you wish to include MTD SPI NAND device support in the image, you should append the CONFIG_MTD_SPI_NAND configuration to the default configuration file. The following method can be followed to enable MTD SPI NAND support on the Raspberry Pi board.

  1. Checkout Kernel Recipe Directory
    • Within the meta-raspberry layer, you can find the kernel recipe at the following location:
      poky/meta-raspberrypi/recipes-kernel/linux.
    • For those using a custom BSP layer, navigate to the directory where the kernel recipe is present.
  2. Configure fragment file
    • Create a new fragment file with .cfg extension to add a new configuration.
      # Create mdt cfg file at poky/meta-raspberrypi/recipes-kernel/linux/files
      # Add CONFIG_MTD_SPI_NAND=y to mdt.cfg
      $ cat mdt.cfg
      CONFIG_MTD_SPI_NAND=y
        
  3. Update Kernel Recipe
    • Add mdt.cfg into the kernel recipe using SRC_URI variable.
      # Adding cfg file to kernel recipe
      SRC_URI += file://mdt.cfg
      
  4. Build image
    • Run bitbake command to build the image which recompiles the kernel with the updated configuration.
    • After completing the build, examine the .conf file in the workspace to ensure the correct configurations are applied.
      /tmp/work/raspberrypi4-poky-linux-gnueabi/linux-raspberrypi/<kernel_version>/linux-raspberrypi4-standard-build/.conf
    • Validate the configuration on the target by using the following command.
      # Read kernel configuration
      $ zcat /proc/config.gz | grep -i CONFIG_MTD_SPI_NAND
      

Add comment


Security code
Refresh