Make modules_install


The kernel module installation step was removed from the kernel build instruction of the recent L4T Linux developer guide revisions.

The Linux developer guide for L4T 32.6.1, has the following instruction for the kernel module installation. But the documents for the recent L4T revisions don’t have such step.

$ sudo make ARCH=arm64 O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=<top>/Linux_for_Tegra/rootfs/

The r35.1 document says:
You can use the installed modules to provide the contents of /lib/modules/<kernel_version>/ on the target system. Before you run, make a copy of this archive to replace the one at this location on the target device

But, without the make modules_install, there isn’t lib/modules directory in Linux_for_Tegra/root_fs.

I’d like to know why the kernel module installation step was removed from the recent documents.


1 Like

Some knowledge on how modules are found and installed might help, so here is some general info…

The kernel Image itself determines the response from the command “uname -r”. It is a prefix of the code release version, and a suffix of the compile time string option “CONFIG_LOCALVERSION”. Usually “CONFIG_LOCALVERSION” is the string “-tegra”. Thus, if the kernel source is release 5.10.65, then “uname -r” is by default going to be “5.10.65-tegra”.

When the kernel looks for modules it will find them here:
/lib/modules/$(uname -r)/kernel

One has to be careful with the “modules_install” step in some cases. If no “INSTALL_MOD_PATH” is given the build will attempt to directly install or overwrite all modules at “/lib/modules/$(uname -r)/kernel”. However, documents normally are telling you how to cross compile on a second computer and not directly on the Jetson. It doesn’t make sense to install to the “/lib/...” of the PC, which is what you’d get naively using the PC install instead of the Jetson’s (you’re on the PC for cross compile documentation).

When you install to a custom “INSTALL_MOD_PATH”, then it goes to that alternate location, which implies some base directory plus “lib/...”. The modules are still in the source tree, but separating them out with install to a new “INSTALL_MOD_PATH” makes it easier to find what you are interested in. If you want that content to be available for a flash, then yes, it is good to set this to the “Linux_for_Tegra/rootfs/” location (which means they’d install to “Linux_for_Tegra/rootfs/lib/modules/$(uname -r)/kernel”). However, you don’t need to flash to add a kernel module. Installing to that location is in “rootfs/” is ok, but you could simply copy the one new module you’ve just created directly to the Jetson. Simply name any empty directory for the “INSTALL_MOD_PATH” and it is easy to find and manually copy whatever module you are interested in (e.g., with scp). Skip flashing.


Thank you very much for useful info.
Certainly, manual copy of module is easy if we just build the module only.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.