Make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig, not working while customizing kernel for jetson nano

Hello,
I m trying to customize kernel for jetson nano devkit. I m using latest version of L4T. But according to the steps to be followed, after the following command i m getting this error
Command: make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig
ERROR:
make[1]: Entering directory ‘/home/bmit/exp2/Linux_for_Tegra/kernel/kernel-4.9/TEGRA_KERNEL_OUT’
mkdir: cannot create directory ‘scripts’: Permission denied
HOSTCC scripts/basic/fixdep
…/scripts/basic/fixdep.c:449:1: fatal error: opening dependency file scripts/basic/.fixdep.d: No such file or directory
}
^
compilation terminated.
scripts/Makefile.host:101: recipe for target ‘scripts/basic/fixdep’ failed
make[2]: *** [scripts/basic/fixdep] Error 1
/home/bmit/exp2/Linux_for_Tegra/kernel/kernel-4.9/Makefile:463: recipe for target ‘scripts_basic’ failed
make[1]: *** [scripts_basic] Error 2
make[1]: Leaving directory ‘/home/bmit/exp2/Linux_for_Tegra/kernel/kernel-4.9/TEGRA_KERNEL_OUT’
Makefile:171: recipe for target ‘sub-make’ failed
make: *** [sub-make] Error 2

1 Like

It looks like you have a permission issue. Perhaps you made a mistake of unpacking the archive or building with sudo, and now try to run make without it. This is probably the reason why you get error cannot create directory ‘scripts’: Permission denied. Try running sudo chown -R $USER:$USER /home/bmit/exp2/Linux_for_Tegra (edit the path if Linux_for_Tegra is at different locatation) to assign ownership of all files in Linux_for_Tegra folder to your user and usergroup.

Basically the same as what @Lissanro is saying, but some additional comments…

Your build command is basically correct and valid, it is only the temporary content output location which is a problem. Normally you would build kernels via a non-root user, and this alternate output location from TEGRA_KERNEL_OUT would be owned by the user who actually performs the compile. If you created that location as root (or sudo), then you might need root (sudo) to change it back to your regular user’s ID.

One other note: If you are cross compiling you also need to provide the tool chain location. If you are not cross compiling, but are natively compiling, then you should skip the “ARCH=arm64”…this is used if cross compiling and won’t behave well when natively compiling.

Don’t forget to set CONFIG_LOCALVERSION if you are reusing old modules (in which case it should probably be CONFIG_LOCALVERSION="-tegra").

1 Like