NVIDIA Jetson working

Jetson Xavier NX采用M.2 Key M SSD为

2020-05-09  本文已影响0人  童年雅趣

如下所有步骤全部在Jetson Xavier NX上进行操作

步骤一、准备SSD 并格式化为 GPT

  1. 准备M.2 Key M SSD
    《本例采用的是WD PC SN520 型号SSD》
    • 打开Ubuntu18.04自带 Disks 工具,'Ctrl+F' 或点击右上角选择‘Format Disk' 并将其格式化为GPT 格式
    • 格式化时必须选择“Ext4”, 等待完成后,点击下方 '三角按钮',mount 到固定目录如/media/nvidia/xxxx
    • 参考下图:
格式化选项.png 格式化并选择Ext4 .png 结果.png

步骤二、复制当前emmc中的镜像到ssd 中,并制作启动盘

  1. 下载JetsonHacksNano脚本
cd $HOME
git clone https://github.com/JetsonHacksNano/rootOnUSB
cd rootOnUSB
  1. 创建RAMFS 并确认SSD设备/dev/nvme0n1p1

若是Xavier NX 必须修改此文件,否则USB 会无法使用
修改并替换/etc/initramfs-tools/hooks/usb-firmware 文件中tegra21x_xusb_firmware 为 tegra19x_xusb_firmware

$sudo cp ./data/usb-firmware /etc/initramfs-tools/hooks
$cd /etc/initramfs-tools/hooks
$sudo chmod +x /etc/initramfs-tools/hooks/usb-firmware
$sudo mkinitramfs -o /boot/initrd.img-4.9.140-tegra  
或者
$sudo mkinitramfs -o /boot/initrd.img-$(uname -r)

#等待会出现类似如下提示信息
Warning: couldn't identify filesystem type for fsck hook, ignoring.
I: The initramfs will attempt to resume from /dev/zram3
I: (UUID=873c4af2-cf87-4ddc-921a-6a6c9392dde6)
I: Set the RESUME variable to override this.
/sbin/ldconfig.real: Warning: ignoring configuration file that cannot be opened: /etc/ld.so.conf.d/aarch64-linux-gnu_EGL.conf: No such file or directory
/sbin/ldconfig.real: Warning: ignoring configuration file that cannot be opened: /etc/ld.so.conf.d/aarch64-linux-gnu_GL.conf: No such file or directory
  1. 运行copyRootToUSB脚本,将原本的系统copy至/dev/nvme0n1p1设备中
$ cd $HOME/rootOnUSB       #注意此处路径为clone的路径
$ ./copyRootToUSB.sh -p /dev/nvme0n1p1
  1. 修改/boot/extlinux/extlinux.conf文件,添加SSD启动项,之所以添加2个启动项是为了防止SSD 启动失败后还可以选择EMMC 进行启动并排查问题
  • 选项1 为SSD启动
  • 选项2 为内置EMMC启动
    上述启动该选项可接串口到电脑端,在启动过程中通过连接UART DEBUG 时进行输入选择,由于Jetson Ubuntu未提供开机选项画面固只能通过UART 进行选择
$sudo vi /boot/extlinux/extlinux.conf 

TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
    MENU LABEL primary ssd boot
    LINUX /boot/Image
    INITRD /boot/initrd.img
    APPEND ${cbootargs} pci=nomsi root=/dev/nvme0n1p1 quiet

LABEL emmc_boot
    MENU LABEL primary emmc boot 
    LINUX /boot/Image
    INITRD /boot/initrd.img
    APPEND ${cbootargs} rootfstype=ext4 root=/dev/mmcblk0p1 rw rootwait
boot option.png
  1. 修改开机挂载SSD设备 /etc/fstab
$sudo vi  /etc/fstab
/dev/root            /                     ext4           discard,noatime,errors=remount-ro            0 1
/dev/mmcblk0p1       /mnt/mmc              ext4           discard,noatime,errors=remount-ro            0 2
  1. 以上步骤保存后退出,重启Nano即可
 $sudo reboot
  1. 待Nano正常开机,通过mount/df 等命令查看当前根目录是否默认挂载SSD 为Boot disk
$df 
$mount 
df-mount.png

参考文档:
[1] https://devtalk.nvidia.com/default/topic/1061883/jetson-nano/jetson-nano-boot-from-nvme-via-m-2-pcie-fails/post/5392151/#5392151
[2] https://www.jetsonhacks.com/2019/09/17/jetson-nano-run-from-usb-drive/
[3] https://github.com/JetsonHacksNano/rootOnUSB
[4] https://www.ubuntubuzz.com/2020/02/how-to-format-disk-drive-as-gpt-on-ubuntu.html
[5] https://www.jianshu.com/p/fa7360d14a44

上一篇下一篇

猜你喜欢

热点阅读