英伟达Xavier NX 开发系列之如何烧录l4t_initrd.img
修复开机时文件系统无法挂载的问题: “ERROR: mmcblk0p1 mount fail” boot up error
因为Nvidia jetson系列定位为嵌入式产品,设计上很多都不是带电池的,有不少产品在关机的时候都是直接断电,时间长了容易在开机的时候出现,“ERROR: mmcblk0p1 mount fail”文件系统无法正常挂载的问题,那么如何修复此问题呢?
解决方案:在l4t_initrd.img加入e2fsck, 通过e2fsck实现e2fsck /dev/mmcblk0p1文件系统的校验,使系统能正常boot up
先科普几个说明:
l4t_initrd.img: 初始 RAM 磁盘(initrd)映像,
l4t_initrd_flash.sh: 是一个用于烧录 Nvidia Jetson 设备的脚本, 烧录初始 RAM 磁盘(initrd)映像到 Jetson 设备的脚步,用于恢复初始 RAM 磁盘(initrd)
README_initrd_flash.txt: 通常是伴随着 Nvidia Jetson 系列设备的一个文本文件,它包含了关于如何使用 l4t_initrd_flash.sh
那么正常的nvidia系统l4t_initrd.img中是没有自带e2fsck,需要做的是往l4t_initrd.img加入e2fsck,具体操作如下:
如何修改l4t_initrd.img,并且打包l4t_initrd.img映像:
Modifying Jetson RAM Disk
Use the following procedure to modify the default configuration of a Jetson device’s RAM disk.
To modify RAM disk
1.Unpack your initrd:
$ sudo su
$ cp /boot/initrd /tmp
$ mkdir /tmp/temp
$ cd /tmp/temp
$ gunzip -c /tmp/initrd | cpio -i
2.Modify your initrd content in the tmp/temp/ folder:
3.Package your initrd:
$ sudo su
$ cd /tmp/temp
$ find . | cpio -H newc -o | gzip -9 -n > ../initrd
4.Replace the initrd with your customized initrd:
$ cp /tmp/initrd /boot/initrd
$ cp /tmp/initrd /boot/initrd
实操demo:
将旧的l4t_initrd.img备份,新的my_l4t_initrd.img重命名替换旧的,然后将之烧录jetson设备上
那么下一步如何烧录l4t_initrd.img?
实际:yahboom@yahboom-vm:~/jetsonNX_r32.7.2/Linux_for_Tegra$ ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --initrd --showlogs jetson-xavier-nx-devkit-emmc mmcblk0p1
备注: --flash-only //Flash using existing images //烧录存在l4t_initrd.img 不重新编译
--initrd //Stop after device boot into initrd. //进入recovery模式后,停止设备进入 initrd
--showlogs // Spawn gnome-terminal to show individual flash process logs. Applicable
// for --massflash only. 显示一些log信息信息
相关信息:
yahboom@yahboom-vm:~/jetsonNX_r32.7.2/Linux_for_Tegra$ ./tools/kernel_flash/l4t_initrd_flash.sh --help
Usage: ./tools/kernel_flash/l4t_initrd_flash.sh <options> <board-name> <rootdev>
Where,
-u <PKC key file> PKC key used for odm fused board.
-v <SBK key file> SBK key used for encryptions
-p <option> Pass options to flash.sh when generating the image for internal storage
-k <target_partition> Only flash parition specified with the label <target_partition>
<board-name> Indicate which board to use.
<rootdev> Indicate what root device to use
--no-flash Generate the flash images
--flash-only Flash using existing images
--external-device <dev> Generate and/or flash images for the indicated external storage
device. If this is used, -c option must be specified.
--external-only Skip generating internal storage images
--usb-instance Specify the usb port where the flashing cable is plugged (i.e 1-3)
--sparse Use sparse image to flash instead of tar image.
-c <config file> The partition layout for the external storage device.
-S <size> External APP partition size in bytes. KiB, MiB, GiB short hands are allowed,
for example, 1GiB means 1024 * 1024 * 1024 bytes. (optional)
--massflash [<max_devices>] Flash multiple device. Receive an option <count> argument to indicate the
maximum number of devices supported. Default is 10 if not specified in board config file
--showlogs Spawn gnome-terminal to show individual flash process logs. Applicable
for --massflash only.
--reuse Reuse existing working environment kept by --keep option.
--keep Keep working environment instead of cleaning up after flashing
--erase-all Delete all storage device before flashing
--initrd Stop after device boot into initrd.
--network <netargs> Flash through Ethernet protocal using initrd flash. <netargs> can be "usb0" to flash through the USB Flashing cable
or "eth0:<target-ip>/<subnet>:<host-ip>" to flash through the LAN cable
For examples:
--network usb0
--network eth0:192.168.0.17/24:192.168.0.21
--append Only applicable when using with --no-flash --external-only option. This option is parts of
the three steps flashing process to generate images for internal device and external device seperately
and flash them together.
For examples:
1. sudo ./tools/kernel_flash/l4t_initrd_flash.sh --no-flash jetson-xavier internal
2. sudo ./tools/kernel_flash/l4t_initrd_flash.sh --no-flash --external-device nvme0n1p1 -S 5120000000 -c flash_enc.xml --external-only --append jetson-xavier internal
3. sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only jetson-xavier internal
With --external-device options specified, the supported values for <dev> are
nvme0n1
sda
Examples:
Both external and internal flash
sudo <BSP_TOOLS_DIR>/./tools/kernel_flash/l4t_initrd_flash.sh -c ~/Downloads/flash_l4t_nvme.xml -S 10240000000 --external-device nvme0n1 jetson-xavier-nx-devkit-emmc external
Internal only
sudo <BSP_TOOLS_DIR>/./tools/kernel_flash/l4t_initrd_flash.sh jetson-xavier-nx-devkit-emmc mmcblk0p1
External only:
sudo <BSP_TOOLS_DIR>/./tools/kernel_flash/l4t_initrd_flash.sh --external-only -c ~/Downloads/flash_l4t_nvme.xml -S 10240000000 --external-device nvme0n1 jetson-xavier-nx-devkit-emmc external
因篇幅问题不能全部显示,请点此查看更多更全内容