生成的文件转编程器烧录文件

#!/bin/bash
####将所有数据更新为生产上用作烧录器使用的程序
####Usage:
#####cat /proc/mtd 
####dev:    size   erasesize  name
####mtd0: 000c0000 00020000 "cfe"
####mtd1: 000e0000 00020000 "splash"
####mtd2: 00800000 00020000 "kernel_fs"
####mtd3: 01400000 00020000 "loader"
####mtd4: 02c00000 00020000 "jwtdata"
####mtd5: 01000000 00020000 "otherdata"
####mtd6: 02100000 00020000 "bakdata"
####mtd7: 00060000 00020000 "stbinfo"
####mtd8: 00060000 00020000 "nvram"
####mtd9: 00060000 00020000 "macadr"
####mtd10: 00100000 00020000 "thirdsw"
####mtd11: 00340000 00020000 "reserved"


targetprj=kv_7581b0_update
targetdir=new_kv_update/kv_7581b0_update

if [ -e ${targetprj} ];then
	echo -e "targetdir: ${targetdir}"
else
	echo "Please copy the Target Dir(Like kv_update) to Here!"
	exit
fi
rm -fr ${targetdir}
echo -e "Create target dir OK!\n"
mkdir -p ${targetdir}

ls -l ${targetprj} | awk '{print $5,$9}' > file_len
echo "131082 stbinfo" >> file_len
cat file_len
del_str="kv_ ubifs-"
replace_str=""
while read -a a;do  
   echo "--- line $((++n)) ---"  
   for ((i = 0; i < ${#a[@]}; i++)); do  
          echo "a[$i]=${a[i]}"
					done  
			for i in ${del_str}
			do
				a[1]="${a[1]//$i/${replace_str}}"
			done
			simple_name=`echo "${a[1]}" | cut -b 0-3`
			echo "${simple_name}"
			mtdstr=`cat /proc/mtd | grep ${simple_name} | awk -F\: '{print $1}'`
			echo "mtdstr:$mtdstr"
			cat /proc/mtd | grep ${a[1]} | awk '{print $1}'
			nanddump2 -q -l ${a[0]} -f ${targetdir}/burn_${a[1]} /dev/${mtdstr}			
done < file_len


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值