大家好,欢迎来到IT知识分享网。
前要:买的米文动力工控机,系统内存太小,只有60g,开发不够,想着添加一个新硬盘,从新硬盘启动,以便反复刷机,反正测试,系统崩溃,找了很多资料,没成功,最后寻求米文技术支持解决。
1.把copy_rootfs.sh文件copy到设备中
2. chmod +x给脚本文件添加可执行权限
3. sudo mkfs -t ext4 /dev/xxx,格式化外部存储设备
4. ./copy_rootfs_3_in_1 /dev/xxx,xxx为外部存储设备
5. 把nvme_config.sh文件copy到设备中
6. chmod +x给脚本文件添加可执行权限
7. 执行sudo ./nvme_config.sh
8. 重启设备
9. 系统启动后后,执行df -h观察/目录是否在外部存储介质中
copy_rootfs.sh
#!/bin/bash parted_dev="" mount_dev="" umount_dev="" function Usag() { echo "usag: " echo " copy_rootfs.sh /dev/sda" echo " copy_rootfs.sh /dev/nvme0n1" echo " copy_rootfs.sh /dev/mmcblk0" } if [ $# -ne 1 ];then Usag exit fi if [[ $1 =~ "/dev/sd" ]];then parted_dev="$1" mount_dev="$11" elif [[ $1 =~ "/dev/nvme0n1" ]];then parted_dev="$1" mount_dev="$1p1" elif [[ $1 =~ "/dev/mmcblk" ]];then parted_dev="$1" mount_dev="$1p1" else Usag exit fi umount_dev=`ls $parted_dev*` for var in $umount_dev do echo "nvidia" | sudo -S umount $var done echo "nvidia" | sudo -S parted -s $parted_dev mklabel gpt; if [ $? -ne 0 ];then echo "error: mklable gpt." exit fi echo "nvidia" | sudo -S parted -s $parted_dev mkpart primary 2048s 100%; if [ $? -ne 0 ];then echo "error: mkpart primary." exit fi echo "nvidia" | sudo -S mkfs.ext4 -F $mount_dev; if [ $? -ne 0 ];then echo "error: mkfs.ext4." exit fi echo "nvidia" | sudo -S mount $mount_dev /mnt; if [ $? -ne 0 ];then echo "error: mount" exit fi echo "nvidia" | sudo -S rsync -aAXv / --exclude={"/dev/","/proc/","/sys/","/tmp/","/run/user/","/mnt/","/media/*","/lost+found"} /mnt; if [ $? -ne 0 ];then echo "error: rsync error, pleas check file" exit fi echo "nvidia" | sudo -S umount $mount_dev if [ $? -ne 0 ];then echo "error: umount" exit fi exit
nvme_config.sh
#!/bin/bash sudo mv /boot/extlinux/extlinux.conf /boot/extlinux/extlinux.conf.b cat >> /boot/extlinux/extlinux.conf << HERE TIMEOUT 30 DEFAULT primary MENU TITLE L4T boot options LABEL primary MENU LABEL primary kernel LINUX /boot/Image #FDT /boot/dtb/kernel_tegra234-p3701-0004-p3737-0000.dtb INITRD /boot/initrd APPEND ${cbootargs} root=/dev/nvme0n1p1 rw rootwait rootfstype=ext4 mminit_loglevel=8 console=ttyTCU0, console=ttyAMA0, console=tty0 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 # 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 # FDT /boot/dtb/kernel_tegra234-p3701-0004-p3737-0000.dtb # INITRD /boot/initrd # APPEND ${cbootargs} HERE
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/155923.html