Can't package kernel: No rule to make target 'dtbs_install'

Hi all,

I cloned the kernel sources and applied all diffs as per jetsonhacks/buildJetsonTX2Kernel1. However, instead of actually building the kernel with makeKernel.sh I executed make bindeb-pkg so my kernel is packaged in a nice, redistributable .deb package.

However this doesn’t work on a Jetson TX2, the following message can be seen from the output:
make2: *** No rule to make target ‘dtbs_install’. Stop.
scripts/package/Makefile:97: recipe for target ‘bindeb-pkg’ failed
make1: *** [bindeb-pkg] Error 2
Makefile:1261: recipe for target ‘bindeb-pkg’ failed
make: *** [bindeb-pkg] Error 2

The full output is available in Pastebin2 (I guess only the last lines are relevant). I didn’t introduce any custom code in the kernel, only enabled some modules that I need (openvswitch, some netfilter features, etc.) Any idea of what could be going on here?

You would simply find the “.dtb” file which you are interested in in the kernel build area. The kernel source has no idea how to install dtb files on something with special requirements like this. Once you have the file you can flash just the file. Specific instructions depend on which L4T version you use (R28.2? “head -n 1 /etc/nv_tegra_release”).

From your kernel build output location something like this:

find . -name '*.dtb'

Earlier releases simply copied the file to “/boot”, newer releases require flashing to a partition (this doesn’t hurt the rootfs).

Yes, I’m on 28.2 at the moment.

nvidia@jetson-0:/boot$ head -n 1 /etc/nv_tegra_release 
# R28 (release), REVISION: 2.0, GCID: 10567845, BOARD: t186ref, EABI: aarch64, DATE: Fri Mar  2 04:57:01 UTC 2018

Current releases do this too. I flash the Jetson’s TX2 root filesystem with flash.sh script.

nvidia@jetson-0:/boot$ ls -l
total 21340
-rw-r--r-- 1 root root 20431088 Apr 24 11:23 Image
drwxr-xr-x 2 root root     4096 Apr 24 10:40 dtb
drwxr-xr-x 3 root root     4096 May  3  2016 efi
drwxr-xr-x 2 root root     4096 Apr 24 10:40 extlinux
-rw-r--r-- 1 root root        0 Apr 24 10:40 initrd
-rw-r--r-- 1 root root   278955 Mar  2 04:55 tegra186-quill-p3310-1000-a00-00-base.dtb
-rw-r--r-- 1 root root   279172 Apr 24 10:40 tegra186-quill-p3310-1000-c03-00-base.dtb
-rw-r--r-- 1 root root   279176 Mar  2 04:55 tegra186-quill-p3310-1000-c03-00-dsi-hdmi-dp.dtb
-rw-r--r-- 1 root root   275906 Mar  2 04:55 tegra186-quill-p3489-1000-a00-00-ucm1.dtb
-rw-r--r-- 1 root root   275906 Mar  2 04:55 tegra186-quill-p3489-1000-a00-00-ucm2.dtb
nvidia@jetson-0:/boot$

I now know why the .deb packages can’t be built out of the box. In scripts/package/builddeb, where the following line can be found:

if grep -q dtbs_install "${srctree}/arch/$SRCARCH/Makefile"; then

Which matches the --help message in arch/arm64/Makefile. The option dtbs_install is listed despite that target is not defined in the Makefile. Removing that line makes everything work. I verified the package and it works! \o/

The file in “/boot” could be removed for this particular release…it is an artifact of being left in the script. Actual dtb in this release is from a partition as binary data rather than as a file. You will need to skip the dtbs_install and manually add device tree.