许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  Jetson Xavier NX模块将系统迁移到NVMe存储教程

Jetson Xavier NX模块将系统迁移到NVMe存储教程

阅读数 4
点赞 0
article_banner

       大家好,我是虎哥,最近完成了自己设计的第一个Xavier NX  的载板设计和打样,虽然还有一些小的不完善的地方,但是可以正常使用,这里记录和分享一下我自己设计的载板上如何实现系统迁移。

       我自己使用SDK Manager 安装了所有的支持库后,16G的板载EMMC就耗光了,所以我必须将系统转移到NVME存储上。


一、Jetson Xavier NX 系列介绍

       NVIDIA® Jetson Xavier™ NX通过外形小巧的模组系统(SOM)将超级计算机的性能带到了边缘端。 高达21 TOPS的加速计算能力可并行运行现代神经网络并处理来自多个高分辨率 传感器  的数据,这是完整AI系统的要求。

1.1 Xavier 般的性能,Nano 般的大小

       Jetson Xavier NX 只有 70 毫米 x 45 毫米,可以将 NVIDIA Xavier SoC 的强大性能封装到 Jetson Nano™ 大小的模组中。这个外形小巧的模组将出色性能和功耗优势与一组丰富的 IO(从高速 CSI 和 PCIe 到低速 I2C 和 GPIO)相结合。利用小巧的外形、传感器众多的接口和出色性能,为您的所有嵌入式 AI 和边缘系统带来新功能。

1.2 适用于重要嵌入式应用

       Jetson Xavier NX 适用于无人机、便携式医疗设备、小型商业机器人、智能摄像头、高分辨率传感器、自动光学检测、智能工厂和其他 IoT 嵌入式系统等高性能 AI 系统。


1.3 强大的 21 TOPS AI 性能

       Jetson Xavier NX 可提供高达 21 TOPS 的性能,是嵌入式和边缘系统中高性能计算和 AI的理想之选。您可以获得384 个 NVIDIA CUDA® Cores、48 个 Tensor Cores、6 块 Carmel ARM CPU 和两个 NVIDIA 深度学习 加速器 (NVDLA) 引擎所带来的性能。再加上超过 59.7GB/s 的显存带宽、视频编码和解码等特性,使得 Jetson Xavier NX 成为能够并行运行多个现代神经网络,并同时处理来自多个传感器的高分辨率数据的首选平台。

1.4、模块参数



二、Jetson Xavier NX 载板N100介绍


        N100 载板是我自己设计的,完全兼容官方系统的硬件系统。主要配置的资源有:DB9接口引出了RS232接口,DB9接口引出了CAN接口,千兆网口1路,使用HUB芯片,扩展了4路USB3.0机接口,以及我们常用的HDMI接口和NVME存储接口,和M.2的WIFI网卡接口。

三、N100 软件环境说明

系统我烧写了JetPack 4.6.3

3.1 系统版本

nvidia@nvidia-desktop:~$ sudo lsb_release -a[sudo] password for nvidia: No LSB modules are available.Distributor Ihttps://www.gofarlic.com UbuntuDescription:    Ubuntu 18.04.6 LTSRelease:    18.04Codename:   bionic

3.2查看Jetson TX2 L4T版本

head -n 1 /etc/nv_tegra_release​# R32 (release), REVISION: 7.3, GCIhttps://www.gofarlic.com 31982016, BOARhttps://www.gofarlic.com t186ref, EABI: aarch64, DATE: Tue Nov 22 17:32:54 UTC 2022

说明使用R32.7.3的系统版本


四、N100 软件环境说明

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

4.1 准备 SSD 并格式化为 GPT

#新存储接入系统后,查看存储情况$ sudo fdisk -l

这里我们主要关注NVMe 存储。

看到类似信息,说明这块盘还没有格式分区表。接下来,我们手动格式化存储和建立分区表。


#分区: /dev/nvme0n1 是之前查出来的$ sudo fdisk /dev/nvme0n1

出现如下 命令行  。先用m,看看帮助信息


Command (m for help): m​Help:​  DOS (MBR)   a   toggle a bootable flag   b   edit nested BSD disklabel   c   toggle the dos compatibility flag​  Generic   d   delete a partition   F   list free unpartitioned space   l   list known partition types   n   add a new partition   p   print the partition table   t   change a partition type   v   verify the partition table   i   print information about a partition​  Misc   m   print this menu   u   change display/entry units   x   extra functionality (experts only)​  Script   I   load disk layout from sfdisk script file   O   dump disk layout to sfdisk script file​  Save & Exit   w   write table to disk and exit   q   quit without saving changes​  Create a new label   g   create a new empty GPT partition table   G   create a new empty SGI (IRIX) partition table   o   create a new empty DOS partition table   s   create a new empty Sun partition table

我们是要建立GPT partition table,和进行格式化存储。

#使用g建立分区表Command (m for help): gCreated a new GPT disklabel (GUIhttps://www.gofarlic.com 8ED2D809-5D3A-DC45-8CFA-A4DA8124D705).The old ext4 signature will be removed by a write command.​Command (m for help): 

使用N命令新增一个分区,除了分区写1,其它都是默认即可

Command (m for help): nPartition number (1-128, default 1): 1First sector (2048-500118158, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-500118158, default 500118158): ​Created a new partition 1 of type 'Linux filesystem' and of size 238.5 GiB.

使用W命令进行保存

Command (m for help): wThe partition table has been altered.Syncing disks.

保存之后就会主动退出,这个时候我们再查看一次存储。

$ sudo fdisk -l

这样的分布说明我们完成了分区的建立。然后我们格式化这个分区


sudo mkfs -t ext4 /dev/nvme0n1p1

一路默认回车即可。

nvidia@nvidia-desktop:~$ sudo mkfs -t ext4 /dev/nvme0n1p1mke2fs 1.44.1 (24-Mar-2018)Discarding device blocks: done                            Creating filesystem with 62514513 4k blocks and 15630336 inodesFilesystem UUIhttps://www.gofarlic.com 87471bb3-2a48-4cb7-80bc-40b3bede09c6Superblock backups stored on blocks:     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,     4096000, 7962624, 11239424, 20480000, 23887872​Allocating group tables: done                            Writing inode tables: done                            Creating journal (262144 blocks): doneWriting superblocks and filesystem accounting information:          done​nvidia@nvidia-desktop:~$ 

这个时候你在你的命令行查看存储分布还看不到存储,是因为没有挂载。

nvidia@nvidia-desktop:~$ df -hlFilesystem      Size  Used Avail Use% Mounted on/dev/mmcblk0p1   14G   13G   37M 100% /none            3.5G     0  3.5G   0% /devtmpfs           3.8G   40K  3.8G   1% /dev/shmtmpfs           3.8G   38M  3.8G   1% /runtmpfs           5.0M  4.0K  5.0M   1% /run/locktmpfs           3.8G     0  3.8G   0% /sys/fs/cgrouptmpfs           777M   12K  777M   1% /run/user/120tmpfs           777M  132K  777M   1% /run/user/1000

这个时候,你登录到桌面系统,在左侧菜单图标栏找到对应存储双击打开一下既可以看到了。

至此我们就完成了存储的准备工作。


4.2 命令行迁移系统

https://github.com/jetsonhacks大佬工具集合访问地址。这个地址发现有很多工具,可以帮我们方便的实现迁移。

在终端中想办法执行。

git clone https://github.com/jetsonhacks/rootOnNVMe.gitcd rootOnNVMe./copy-rootfs-ssd.sh./setup-service.shsudo reboot

#执行拷贝脚本./copy-rootfs-ssd.sh

nvidia@nvidia-desktop:~/Downloads/rootOnNVMe-master$ ./setup-service.sh ==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===Authentication is required to reload the systemd state.Authenticating as: nvidia,,, (nvidia)Password: ==== AUTHENTICATION COMPLETE ===Created symlink /etc/systemd/system/default.target.wants/setssdroot.service → /etc/systemd/system/setssdroot.service.Service to set the rootfs to the SSD installed.Make sure that you have copied the rootfs to SSD.Reboot for changes to take effect.

执行设置脚本后,重启系统看看。

根目录已经成功的替换成了NVME,所以验证这个方法是可行的。

4.3 手动迁移系统

由于我们安装的是JetPack4.6.3的系统,所以迁移我们是可以参考之前TX1个TX2的方法来的。官方主板 Jeston TX1 TX2 ubuntu 18.04 迁移系统至固态SSD_jeston tx2_机器人虎哥的博客-CSDN博客这个是我们之前的方法。其步骤是。

手动将EMMC系统内容拷贝到NVME存储上。

1、查看存储位置

nvidia@nvidia-desktop:~$ df -hlFilesystem      Size  Used Avail Use% Mounted on/dev/mmcblk0p1   14G   13G   37M 100% /none            3.5G     0  3.5G   0% /devtmpfs           3.8G   40K  3.8G   1% /dev/shmtmpfs           3.8G   38M  3.8G   1% /runtmpfs           5.0M  4.0K  5.0M   1% /run/locktmpfs           3.8G     0  3.8G   0% /sys/fs/cgrouptmpfs           777M   12K  777M   1% /run/user/120tmpfs           777M  128K  777M   1% /run/user/1000/dev/nvme0n1p1  234G   61M  222G   1% /media/nvidia/87471bb3-2a48-4cb7-80bc-40b3bede09c6

2、进入NVME存储

cd /media/nvidia/87471bb3-2a48-4cb7-80bc-40b3bede09c6/

3、拷贝全部文件至NVME存储

sudo cp -ax / ./

4、修改NVME存储上的系统启动文件

刚拷贝后,进入NVME系统的boot目录

#进入目录cd /media/nvidia/87471bb3-2a48-4cb7-80bc-40b3bede09c6/#进入boot目录cd /boot/extlinux

#备份和修改启动引导文件sudo cp extlinux.conf extlinux.conf_bak#修改extlinux.conf

原始文件内容

TIMEOUT 30DEFAULT primary​MENU TITLE L4T boot options​LABEL primary      MENU LABEL primary kernel      LINUX /boot/Image      INITRD /boot/initrd      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 nv-auto-config​# When testing a custom kernel, it is recommended that you create a backup of# the original kernel and add a new entry to this file so that the device can# fallback to the original kernel. To do this:## 1, Make a backup of the original kernel#     sudo cp /boot/Image /boot/Image.backup## 2, Copy your custom kernel into /boot/Image## 3, Uncomment below menu setting lines for the original kernel## 4, Reboot​# LABEL backup#   MENU LABEL backup kernel#   LINUX /boot/Image.backup#   INITRD /boot/initrd#   APPEND ${cbootargs}

修改后的内容:

TIMEOUT 30DEFAULT nvmessd​MENU TITLE L4T boot options​LABEL nvmessd      MENU LABEL primary kernel      LINUX /boot/Image      INITRD /boot/initrd      APPEND ${cbootargs} quiet root=/dev/nvme0n1p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 nv-auto-config LABEL emmc      MENU LABEL internal Emmc      LINUX /boot/Image      INITRD /boot/initrd      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 nv-auto-config

4、手动烧写系统至NVME启动

打开虚拟机上的终端。

手动控制模块进入recovery模式

开始烧写EMMC启动系统

#更新DTB和内核文件,设置NVME启动sudo ./flash.sh -r -d kernel/dtb/tegra194-p3668-all-p3509-0000.dtb -K kernel/Image jetson-xavier-nx-devkit-emmc nvme0n1p1#内核文件,设置NVME启动sudo ./flash.sh -r -K kernel/Image jetson-xavier-nx-devkit-emmc nvme0n1p1​#以下做为参考#重新生成系统,烧写至EMMCsudo ./flash.sh jetson-xavier-nx-devkit-emmc mmcblk0p1#使用以有的系统镜像,烧写至EMMCsudo ./flash.sh -r jetson-xavier-nx-devkit-emmc mmcblk0p1

至此烧写完毕。系统重启后我们可以看到存储信息

nvidia@nvidia-desktop:~$ df -hlFilesystem      Size  Used Avail Use% Mounted on/dev/nvme0n1p1  234G   13G  209G   6% /none            3.5G     0  3.5G   0% /devtmpfs           3.8G   40K  3.8G   1% /dev/shmtmpfs           3.8G   22M  3.8G   1% /runtmpfs           5.0M  4.0K  5.0M   1% /run/locktmpfs           3.8G     0  3.8G   0% /sys/fs/cgrouptmpfs           777M   12K  777M   1% /run/user/120tmpfs           777M  120K  777M   1% /run/user/1000/dev/mmcblk0p1   14G  5.0G  8.1G  39% /media/nvidia/a0cb2694-3e4c-4a67-9e05-92f278444e97

说明也成功了。

五、总结

       4.2中提供了一种方法和4.3中提供的方法,显然4.2的要简单自由很多,所以我个人也是很倾向使用4.2,这里大神们的开源精神,特别值得我们学习。4.3做为之前TX1和TX2上我自己常用的方法,在这里也可以使用,感觉纪念一下之后就要被淘汰了。不过我接下来会对两种方法设置的系统进行长期的使用对比,来最终决定使用哪种方法。希望你喜欢今天的分享。

免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删

相关文章
技术文档
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空