Jetson Nano 采用M.2 Key M SSD为启动盘
2020-04-28 本文已影响0人
童年雅趣
如下所有步骤全部在Jetson Nano 上进行操作
步骤一、准备SSD 并格式化为 GPT
- 准备M.2 Key M SSD
《本例采用的是WD PC SN520 型号SSD》- 打开Ubuntu18.04自带 Disks 工具,'Ctrl+F' 或点击右上角选择‘Format Disk' 并将其格式化为GPT 格式
- 格式化时必须选择“Ext4”, 等待完成后,点击下方 '三角按钮',mount 到固定目录如/media/nvidia/xxxx
- 参考下图:
步骤二、复制当前emmc中的镜像到ssd 中,并制作启动盘
- 下载JetsonHacksNano脚本
cd $HOME
git clone https://github.com/JetsonHacksNano/rootOnUSB
cd rootOnUSB
- 创建RAMFS 并确认SSD设备/dev/nvme0n1p1
$ 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 #等待会出现类似如下提示信息
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
- 运行copyRootToUSB脚本,将原本的系统copy至/dev/nvme0n1p1设备中
$ cd $HOME/rootOnUSB #注意此处路径为clone的路径
$ ./copyRootToUSB.sh -p /dev/nvme0n1p1
- 修改/boot/extlinux/extlinux.conf文件,添加SSD启动项
$sudo vi /boot/extlinux/extlinux.conf
TIMEOUT 30
DEFAULT primary
MENU TITLE L4T boot options
LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
APPEND ${cbootargs} pci=nomsi root=/dev/nvme0n1p1 quiet
LABEL emmc_boot
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
APPEND ${cbootargs} rootfstype=ext4 root=/dev/mmcblk0p1 rw rootwait
- 修改开机挂载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
- 以上步骤保存后退出,重启Nano即可
$sudo reboot
- 待Nano正常开机,通过mount/df 等命令查看当前根目录是否默认挂载SSD 为Boot disk
$df
$mount
image.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