Rebuilding the Kernel Debian Package for TX2 and install

L4T:R32.4.3

According to the l4t manual, after the ota upgrade, the customized kernel, device tree, pinmux, etc. will be overwritten. This will cause my jetson device to not work properly.
My understanding of this problem is to use the rebuild l4t kernel package mentioned in BSP Customization to install and solve it. I don’t know if my understanding is correct.

According to the chapter Rebuilding the Kernel Debian Package on R32.4.3, I used the cross-compilation tool chain to recompile and generate the nvidia-l4t-kernel.deb file on the PC side. After copying it to jetson, I installed the deb file in dpkg i and restarted After that, it cannot be started, only the nvidia logo interface is displayed.

Try to pack the original Image to debian to verify if customization Image cause the problem.

Also make sure follow below doc to build kernel image.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html#

I used L4T to decompress the original nvidia-l4t-kernel.deb file in the directory, and the update can be installed normally. However, I changed it according to the L4T document and generated a new deb file. After installation, it cannot be started and stays at the nvidia icon. The deb generation process will have the following prompt:

dpkg-deb: building package 'nvidia-l4t-kernel' in '../nvidia-l4t-kernel_4.9.140-tegra-32.4.3- 
20210203172607_arm64.deb'.
dpkg-genbuildinfo --build=binary
dpkg-genchanges --build=binary >../nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20210203172607_arm64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
dpkg-source --after-build repack
dpkg-buildpackage: info: binary-only upload (no source included)

And the installation will have a waring prompt:

depmod:WARNING: could not open /lib/modules/4.9.140-tegra/modules.order: No such file or directory
depmod:WARNING: could not open /lib/modules/4.9.140-tegra/modules.builtin: No such file or directory

I copy the Image from Liunx_for_tegra/kernel/Image to the repack/boot/Image.
and copy the lib from Linux_for_tegra/kernel/lib to the repack/

Must all operations be in root mode?

Could you just try replace your Image with /boot/Image to confirm if it can boot normally by customized kernel image?

yes,it can boot normally with my kernel Image file.

I didn’t try it before, did you have reference to below doc?

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/getting_started.html#wwpID0E0IE0HA

Yes, I am based on the Rebuilding the Kernel Debian Package (NVIDIA Jetson Linux Developer Guide) in the chapter BSP Customization 32.4.3 Release) operation.

Thanks for confirm it. Will check it later.

What is kernel/lib? There is no such file by default. Did you create this by yourself?

This folder is generated by decompressing kernel_supplements.tbz2. Or use nvidia-l4t-kernel.dtb to unzip the file.

If you just decompressing the debian package from NV, and immediately repack it back, put it to device and run, will you see any problem?

I mean nothing is changed in this debian package. Just verify the steps of repacking.

The original deb file can be installed successfully. After decompressing according to the manual, the deb file cannot be regenerated from the last document in the guide document.

Which step gets wrong on your side?

I used the files decompressed from the original deb and followed the l4t rebuild debian package operation. Without changing the original decompressed files, the new deb files were regenerated, and it was also unable to install and start normally.

Could you post your steps one-by-one?

Dir:<my_pc>/Linux_for_Tegra/kernel

dpkg -x nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20200625213407_arm64.deb origin
dpkg -e nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20200625213407_arm64.deb origin/debian

mkdir -p repack/debian

vi repack/debian/rules 

content:

#!/usr/bin/make -f

.PHONY: binary

clean:
        dh clean

binary:
        dh binary

build:

override_dh_strip:
override_dh_shlibdeps:

Open control in a text editor and add these lines; save the file.

Source: nvidia-l4t-kernel

Section: kernel

Priority: standard

Maintainer: NVIDIA Corporation

Build-Depends: debhelper (>=9)

Standards-Version: 3.9.6

Homepage: http://developer.nvidia.com/jetson

Package: nvidia-l4t-kernel

Architecture: arm64

Pre-Depends: nvidia-l4t-core (>> 32.4-0), nvidia-l4t-core (<< 32.5-0)

Depends:

Recommends:

Description: NVIDIA Kernel Package

Copy these files from the original nvidia-l4t-kernel package to debian:

•postinst

•triggers

•copyright
Extract changelog from its archive:

$ gunzip -c origin/usr/share/doc/nvidia-l4t-kernel/changelog.Debian.gz > repack/debian/changelog

Open the change log in a text editor. Find the version number and change it, change the version to:20210203172607

Open install in a text editor. Add the following line, which specifies the location where files are to be installed, then save the file:

debian/out/* /

Open compat and replace its contents with the single digit ‘9’; save the file.

Open source/format in a text editor and add the following line; save the file.

3.0 (native)

To install the files needed to build the kernel Debian package in debian/out/, enter the command:

$ mkdir -p repack/debian/out/

cp -r origin/boot repack/
cp -r origin/lib repack/

Copy the kernel license file from the original Debian package:

$ mkdir -p repack/debian/out/usr/share/doc/nvidia-l4t-kernel/

$ gunzip -c origin/usr/share/doc/nvidia-l4t-kernel/LICENSE.kernel.gz > repack/debian/out/usr/share/doc/nvidia-l4t-kernel/LICENSE.kernel

Enter these commands to build the package:

cd repack
CC=aarch64-linux-gnu-gcc dpkg-buildpackage -uc -b -d -a arm64

There will be the above warning during the compilation process, and then a new deb file is generated,

dpkg-deb: building package 'nvidia-l4t-kernel' in '../nvidia-l4t-kernel_4.9.140-tegra-32.4.3- 
20210203172607_arm64.deb'.
dpkg-genbuildinfo --build=binary
dpkg-genchanges --build=binary >../nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20210203172607_arm64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
dpkg-source --after-build repack
dpkg-buildpackage: info: binary-only upload (no source included)

I copy it to the jetson device, and there will be the above warning during the installation process.

depmod:WARNING: could not open /lib/modules/4.9.140-tegra/modules.order: No such file or directory
depmod:WARNING: could not open /lib/modules/4.9.140-tegra/modules.builtin: No such file or directory

After the installation is complete, reboot, but can not start normally, and leave it at the nvidia icon.

1 Like

hello,Which deb file corresponds to pinmux (tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg)?

cp -r origin/boot repack/
cp -r origin/lib repack/

Could you share me how does your repack directory look like?