How to modify initrd ?

I decompress and compress l4t_initrd.img but not modify any file. After flash the new l4t_initrd.img system, the system fails to start.

decompress:
#cp bootloader/l4t_initrd.img ~/initrd/
#cd ~/initrd/
#gzip -cd l4t_initrd.img | cpio -imd --quiet
#rm l4t_initrd.img
compress:
#find . | cpio --quiet -H newc -o | gzip -9 -n > ~/l4t_initrd.img
#cp ~/l4t_initrd.img bootloader/

flash the kernel:
flash.sh -r -k kernel jetson-xavier mmcblk0p1

The rebot failed log:
[ 8.130818] tegradc 15220000.nvdisplay: probed
[ 8.182066] hpd: hpd_switch 0
[ 8.182072] tegradc 15220000.nvdisplay: fb registered
[ 8.185333] hpd: state 7 (Takeover from bootloader), hpd 0, pending_hpd_evt 1
[ 8.185336] hpd: switching from state 7 (Takeover from bootloader) to state 0 (Reset)
[ 8.185342] hpd: state 0 (Reset), hpd 0, pending_hpd_evt 0
[ 8.187769] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[ 8.187809] tegra-asoc: sound: snd_soc_register_card failed (-517)
[ 8.189808] Freeing unused kernel memory: 8576K
[ 8.228791] hpd: switching from state 0 (Reset) to state 1 (Check Plug)
[ 8.228796] tegradc 15220000.nvdisplay: blank - powerdown
[ 8.228805] hpd: state 1 (Check Plug), hpd 0, pending_hpd_evt 0
[ 8.228810] hpd: switching from state 1 (Check Plug) to state 3 (Disabled)
[ 8.253819] extcon-disp-state external-connection:disp-state: cable 44 state 0 already set.
[ 8.253822] Extcon DP: HPD disabled
[ 8.253824] hpd: hpd_switch 0
[ 8.253826] hpd: switching from state 0 (Reset) to state 1 (Check Plug)
[ 8.253846] hpd: state 1 (Check Plug), hpd 0, pending_hpd_evt 0
[ 8.253850] hpd: switching from state 1 (Check Plug) to state 3 (Disabled)
[ 11.836599] Wake76 for irq=199
[ 11.836696] Wake77 for irq=199
[ 11.836756] Wake78 for irq=199
[ 11.836816] Wake79 for irq=199
[ 11.836875] Wake80 for irq=199
[ 11.836931] Wake81 for irq=199
[ 11.836986] Wake82 for irq=199
[ 11.837072] tegra-xusb 3610000.xhci: Upgrade port 0 to USB3.0
[ 11.837175] tegra-xusb 3610000.xhci: Upgrade port 1 to USB3.0
[ 11.839770] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[ 11.839953] tegra-asoc: sound: snd_soc_register_card failed (-517)
[ 11.940508] usb usb2: usb_suspend_both: status 0
[ 14.524088] tegra-xusb 3610000.xhci: entering ELPG
[ 14.529796] tegra-xusb 3610000.xhci: entering ELPG done
[ 177.052348] random: crng init done

reboot_failed_log.txt (86.8 KB)

Hi yinghua.ma,

Not sure if can help, but please refer to below thread to see if any idea:
https://devtalk.nvidia.com/default/topic/1056706/jetson-agx-xavier/how-to-modify-l4t-initrd-for-xavier-/post/5359337/#5359337

I also found this topic at the time.

flash.sh -I newinitrd.img
It seems that the option -I doesn’t work. So I replace the bootloader/l4t_initrd.img.

Thanks.

I followed this topic to decompress and compress l4t_initrd.img without modifying any files in bootloader/l4t_initrd.img. The strange thing is that the system can’t start.

Root permission problem. Must be decompressed and compressed as root.

Hi,

I also would like to modify l4t_init script.
So it must modify zop unzip using root ?
And Xavier default is running initrd ?

Thanks

Decompress:
#bootloader/l4t_initrd.img ~/initrd/
#cd ~/initrd/
#sudo su
#gzip -cd l4t_initrd.img | cpio -imd --quiet
#rm l4t_initrd.img

Compressed
#find . | cpio --quiet -H newc -o | gzip -9 -n > ~/l4t_initrd.img

The initrd is merged to boot.img with kernel. And it is loaded by cboot as the ramdisk.

Hi yinghua:

So after generated l4t_initrd.img, how to flash it in to devices ?
“sudo ./flash.sh -k kernel jetson-xavier mmcblk0p1” just flash kernel and it will be merged to kernel ?

Yes. Just flash the kernel.

Hi yinghua:

       do you modify flash.sh, because i didn't see any l4t_initrd.img message print out to console, it seems didn't combine initrd to kernel .

Thanks.

Don’t need modify flash.sh.
Need replace the bootloader/l4t_initrd.img.

but i have to modify flash.sh to let kernelinitrd=l4t_initrd.img, and it will combine to the
kernel.
but i still can’t see initrd init script echo message ?

and what do you mean replace "bootloader/l4t_initrd.img " ? in which file ?
and do you only using “flash.sh -r -k kernel jetson-xavier mmcblk0p1” command to do it ?

YES.