XILINX ZYNQ MPSOC LINUX架构搭建系统升级程序(zu3eg)

经过几番改写,做了以下升级程序:
#!/bin/sh
if [ ! -n “$1” ] || [ ! -n “$2” ];then
echo “usage:”
echo " the first args is the file name (eg:rootfs_v0.1.tar.gz)"
echo " the second args is the ip address of server(192.168.6.101)"
echo " for example: ./upsys.sh rootfs_v0.1.tar.gz 192.168.6.101"
exit
fi
check_mountpart=mount | grep "on / type" | cut -d' ' -f 1#程序处理了是否绑定成功
default=rootfs
part2=/dev/mmcblk0p2#这里把EMMC的分区做了定义,一般都是这个节点
part3=/dev/mmcblk0p3
tmp_file=/mnt
rootfs_file=$1
kernel_version=uname -r
if [ $check_mountpart = KaTeX parse error: Expected group after '_' at position 82: …ch=rootfs_patch_̲kernel_version.tar.gz
serverip=$2

echo “serverip is $serverip”

echo “tftp to get the $rootfs_patch… "
tftp -g -r $rootfs_patch $serverip
if [ $? -eq 0 ];then
echo “tftp to get the $rootfs_file…”
tftp -g -r $rootfs_file $serverip
if [ $? -eq 0 ];then
echo “tftp to get the tools…”
tftp -g -r bootenv $serverip
if [ $? -eq 0 ];then
echo “"
echo “The root file system is mounted on $check_mountpart !”
echo "

if [ $check_mountpart = $part2 ] ;then
umount $part3
cat /bin/busybox > $part3
mkfs.ext4 $part3
mount $part3 $tmp_file
tar xvf $rootfs_file -C $tmp_file
rm /mnt/lib/modules/* -rf
tar xvf r o o t f s p a t c h − C / m n t c h m o d + x b o o t e n v c p b o o t e n v / r u n / m e d i a / m m c b l k 0 p 1 / c h m o d 777 / m n t / l i b / m o d u l e s / rootfs_patch -C /mnt chmod +x bootenv cp bootenv /run/media/mmcblk0p1/ chmod 777 /mnt/lib/modules/ rootfspatchC/mntchmod+xbootenvcpbootenv/run/media/mmcblk0p1/chmod777/mnt/lib/modules/kernel_version/.ko
chmod +x /mnt/usr/bin/

rm /mnt/etc/init.d/xserver-nodm
rm /mnt/etc/init.d/nfs*
rm -f /mnt/etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /mnt/etc/localtime
rm .tar.gz
cd /run/media/mmcblk0p1
./bootenv sdroot0=“setenv bootargs earlycon clk_ignore_unused root=/dev/mmcblk0p2 rw rootwait cma=1000m”
./bootenv sdroot1=“setenv bootargs earlycon clk_ignore_unused root=/dev/mmcblk0p3 rw rootwait cma=1000m”
./bootenv sdboot=“run sdroot1 && load mmc 0:1 4000000 system.dtb && load mmc 0:1 0x80000 Image && booti 0x80000 - 4000000”
sync
echo “="
echo “Update rootfs successfully!”
echo “You can reboot now!”
echo "
=”
else
umount $part2
cat /bin/busybox > $part2
mkfs.ext4 $part2
mount $part2 $tmp_file
tar xvf $rootfs_file -C $tmp_file
rm /mnt/lib/modules/
-rf
tar xvf r o o t f s p a t c h − C / m n t c h m o d + x b o o t e n v c p b o o t e n v / r u n / m e d i a / m m c b l k 0 p 1 / c h m o d 777 / m n t / l i b / m o d u l e s / rootfs_patch -C /mnt chmod +x bootenv cp bootenv /run/media/mmcblk0p1/ chmod 777 /mnt/lib/modules/ rootfspatchC/mntchmod+xbootenvcpbootenv/run/media/mmcblk0p1/chmod777/mnt/lib/modules/kernel_version/.ko
chmod +x /mnt/usr/bin/

rm /mnt/etc/init.d/xserver-nodm
rm /mnt/etc/init.d/nfs*
rm -f /mnt/etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /mnt/etc/localtime
rm .tar.gz
cd /run/media/mmcblk0p1
./bootenv sdroot0=“setenv bootargs earlycon clk_ignore_unused root=/dev/mmcblk0p2 rw rootwait cma=1000m”
./bootenv sdroot1=“setenv bootargs earlycon clk_ignore_unused root=/dev/mmcblk0p3 rw rootwait cma=1000m”
./bootenv sdboot=“run sdroot0 && load mmc 0:1 4000000 system.dtb && load mmc 0:1 0x80000 Image && booti 0x80000 - 4000000”
sync
echo “="
echo “Update rootfs successfully!”
echo “You can reboot now!”
echo "
=”
fi
else
echo “"
echo “*Please make sure the server have the file tool bootenv!”
echo "

exit
fi
else
echo “"
echo “*Please make sure the server have the file $rootfs!”
echo "

exit
fi
else
echo "
"
echo "
Please make sure the server have the file $rootfs_patch!"
echo "
**”
exit
fi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值