How to generate the recovery kernel and dtb file?

Platform: Jetpack 5.1.1 for the AGXI
Hello,I’m trying to modify the recovery kernel and dtb. In DeveloperGuide, we can find how to compile the normal kernel and dtb. But there is no reference about how to generate recovery kernel and dtb. I also want to know the real name of ‘RECFILE’.


Is there any suggestions for that?

Kind regards
Bryan

Hi Bryan_Zhong,

Are you using the devkit or custom board for AGX Xavier Industrial?

May I know what’s your use case to modify the recovery kernel and dtb?

You could find more details in flash.sh. They should be generated through ota_make_recovery_img and ota_make_recovery_dtb during flash.

Please share your full flash log for further check.

I find that the recovery kernel and dtb is what I need. The final use case is as follow topic:

For now it is the devkit , but it will be used on custom board in the final.

Thanks,I will check it . This message is very useful.

Hi, KevinFFF:
Do you know where I can find the source code of l4t_initrd.img or initrd? I mean the busybox code or buildroot code. I have known that how to modify the initrd .
image

but I want to add some other tools into initrd , such as ‘lsmod’, ‘insmod’ and ‘rmmod’. and also I want to add some driver.ko into initrd.
I have tried to use busybox or buildroot to rebuild a roofs.cpio. but there are always some problem during the building process. so if I can find the source code that build initrd. it would be more easier for me to add driver into initrd.

Thanks.

Sorry that the source code for generating l4t_initrd.img is not public.
Please refer to the following steps for your use case.

$ cp l4t_initrd.img l4t_initrd.img.gz
$ gzip -d l4t_initrd.img.gz
$ mkdir initrd_temp
$ cd initrd_temp
$ sudo cpio -i < ../l4t_initrd.img
(user actions: copy binary and driver.ko in initrd_temp)
$ sudo find . |  cpio -H newc --create  | gzip -9 > ../l4t_initrd.img.new

The problem has been solved.
After trying a lot of way and solving problem one by one . I can use the rootfs.cpio that built with busybox or buildroot. Now it is convenient to add utils into the rootfs.

To build roofs.cpio with busybox or buildroot, there is a key step that is to add ‘init’ in the directory ‘/’ .

Don’t copy the init file in the l4t_initrd.img to ‘/’, it will cause kernel panic.
Don’t copy the init file in the l4t_initrd.img to ‘/’, it will cause kernel panic.
Don’t copy the init file in the l4t_initrd.img to ‘/’, it will cause kernel panic.

The right way is create a soft link of ‘sbin/init’ to ‘/init’.
In the directory ‘/’ , execute the follow command:

ln -s sbin/init init

Thanks.

2 Likes

Trivia: For a few years now on Ubuntu init is a symbolic link to systemd. You can also put a statically linked bash in with an argument of what to start executing (via symbolic link as init), which is typical of an initrd, but not typical of an o/s other than perhaps if panic is detected and you go into a rescue mode.

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