其他分享
首页 > 其他分享> > Jetson Xavier/NX/Nano 采用SSD或SD卡为系统盘

Jetson Xavier/NX/Nano 采用SSD或SD卡为系统盘

作者:互联网

https://www.jianshu.com/p/045df333042e

 

NVMe SSD硬盘仅作为系统盘(rootfs和用户区),系统的启动引导依然是通过SD卡或EMMC,比如升级设备树dtb 还是在SD卡或EMMC中。

步骤一、准备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
    •  

       



 

 

 

步骤二、复制系统文件到SSD或SD卡 (有两种方案,默认建议方案一)

方案一、 Jetsonhacks rootOnNVMe方法 (M.2 Key M SSD)

步骤一、

git clone https://github.com/jetsonhacks/rootOnNVMe.git
cd rootOnNVMe
./copy-rootfs-ssd.sh

  步骤二、

./setup-service.sh

  步骤三、

reboot 

  

如果是SD卡,比如/dev/mmcblk1 , 需修改如下文件中的ssd路径为SD卡路径/dev/mmcblk1:
copy-rootfs-ssd.sh
setup-service.sh
data/setssdroot.sh
data/setssdroot.service

  方案二、JetPack4.4 概率性失败(目前不建议采用了)

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

  1. 下载JetsonHacksNano脚本
cd $HOME
git clone https://github.com/JetsonHacksNano/rootOnUSB
cd rootOnUSB

  

2.创建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

$vi /etc/initramfs-tools/hooks/usb-firmware
'修改并替换/etc/initramfs-tools/hooks/usb-firmware文件中
tegra21x_xusb_firmware 为 tegra19x_xusb_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 进行启动并排查问题 
  2. 选项1 为SSD启动
  3. $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
    

      

  4. 选项2 为内置EMMC启动
    上述启动该选项可接串口到电脑端,在启动过程中通过连接UART DEBUG 时进行输入选择,由于Jetson Ubuntu未提供开机选项画面固只能通过DEBUG UART 开机时按键进行选择开机启动方式
  5.  
    $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
    

      



 

标签:Nano,firmware,boot,dev,NX,etc,initramfs,SSD,卡为
来源: https://www.cnblogs.com/gooutlook/p/15632427.html