I have successfully built & installed a kernel with the default config. Now I’d like to change the config to enable one driver. In .config, I change this:
# CONFIG_VIDEO_IMX219 is not set
to this:
CONFIG_VIDEO_IMX219=y
But when I build using my script, the .config file is overwritten:
$ my_kernel_build.bash
MY_INSTALL_PATH=/home/clyde/projects/my_l4t_install_path
MY_KERNEL_SOURCE=/home/clyde/projects/my_l4t_install_path/Linux_for_Tegra/source
CROSS_COMPILE=/home/clyde/projects/vc-jetson-driver-release/aarch64--glibc--stable-2022.08-1/bin/aarch64-buildroot-linux-gnu-
KERNEL_HEADERS=/home/clyde/projects/my_l4t_install_path/Linux_for_Tegra/source/kernel/kernel-jammy-src
INSTALL_MOD_PATH=/home/clyde/projects/my_l4t_install_path/Linux_for_Tegra/rootfs/
make: Entering directory '/home/clyde/projects/my_l4t_install_path/Linux_for_Tegra/source/kernel'
================================================================================
Building kernel-jammy-src sources
================================================================================
make \
ARCH=arm64 \
-C /home/clyde/projects/my_l4t_install_path/Linux_for_Tegra/source/kernel/kernel-jammy-src \
LOCALVERSION=-tegra \
defconfig
make[1]: Entering directory '/home/clyde/projects/my_l4t_install_path/Linux_for_Tegra/source/kernel/kernel-jammy-src'
*** Default configuration is based on 'defconfig'
#
# configuration written to .config
How can I make my .config change stick?
Thanks!
Edit: I’m running L4T 36.4 (JP 6.1) for a Jetson Orin Nano.
It looks like Linux_for_Tegra/source/kernel/kernel-jammy-src/kernel/config_data is being copied over .config by the Makefile. Should I edit that file?
Somewhat different problem: when I run cd source/kernel/kernel-jammy-src && make menuconfig to create a config, it creates a very different config (x86, etc.) Is this tool useful for producing a config for the Orin Nano? If so, how should I run it?
please refer to developer guide, Kernel Customization to rebuild the kernel manually.
besides,
here’re steps to rebuild our OOT drivers for your reference, sudo mkdir -p /usr/src/nvidia-jetson-1.0 cd /usr/src/nvidia-jetson-1.0 sudo tar xf /tmp/kernel_oot_modules_src.tbz2 sudo tar xf /tmp/nvidia_kernel_display_driver_source.tbz2 sudo chown -R ${USER}:${USER} /usr/src/nvidia-jetson-1.0 export KERNEL_HEADERS="/usr/src/linux-headers-5.15.122-tegra-ubuntu22.04_aarch64/3rdparty/canonical/linux-jammy/kernel-source" make ARCH=arm64 -j8 clean make ARCH=arm64 -j8 modules sudo make ARCH=arm64 -j8 modules_install
I have successfully built and tested the nv_imx219 oot driver, source at source/nvidia-oot/drivers/media/i2c/nv_imx219.c
I am trying to build and test the in-kernel imx219 driver, source at source/kernel/kernel-jammy-src/drivers/media/i2c/imx219.c, which I believe is controlled by the CONFIG_VIDEO_IMX219 flag.
Ah! I have successfully built imx219.c. Here is how I did it:
I ran these commands to run menuconfig, loading the previous configuration from .config:
source my_setup.bash
cd $MY_KERNEL_SOURCE
make \
ARCH=arm64 \
-C kernel/kernel-jammy-src \
LOCALVERSION=-tegra \
menuconfig oldconfig
I drilled into Drivers > Multimedia > Ancillary > Sensors > IMX219, which I set to M. (I was not able to set it to Y due to some constraint that I have not tracked down yet, but this is OK, as I can test the imx219.c code in a kernel module.) I saved the new configuration into .config.
Then I ran these commands to build – there magic here is “oldconfig”:
source my_setup.bash
cd $MY_KERNEL_SOURCE
make KERNEL_DEF_CONFIG=oldconfig -C kernel
I see that imx219.c was compiled into a loadable module:
CC [M] drivers/media/i2c/imx219.o
MODPOST modules-only.symvers
GEN Module.symvers
CC [M] drivers/media/i2c/imx219.mod.o
LD [M] drivers/media/i2c/imx219.ko
just an FYI.
according to r36.4 release note, the camera and sensor drivers are now by default configured as loadable modules; you may see-also [4.2. Device Registration] for the steps to create a device tree overlay (DTB overlay or .dtbo) file to register the camera module.