制作升级包脚本

目录下放

输入文件:

BOOT=uboot_rtos_4g.bin
APP_IMAGE=dvr.bin
APP_RES=res

输出文件:
IMAGE=rtos.img



#生成APP INFO
len=`stat -c %s $APP_IMAGE`
len=`printf "0x%08x" $len`
len1=`expr substr $len 9 2`
len2=`expr substr $len 7 2`
len3=`expr substr $len 5 2`
len4=`expr substr $len 3 2`
echo -n -e "\x$len1\x$len2\x$len3\x$len4" > $APP_INFO

dd if=$BOOT      of=$IMAGE   bs=1024 count=384 seek=0
dd if=$APP_INFO  of=$IMAGE   bs=1024 count=64 seek=1024
dd if=$APP_IMAGE of=$IMAGE   bs=1024 count=2496 seek=1088
dd if=$APP_RES   of=$IMAGE   bs=1024 count=512 seek=3584
dd if=/dev/zero  of=$IMAGE   bs=1024 count=4096 seek=4096

rm $APP_INFO

制做升级包:

#!/bin/bash

cd `dirname $0`

BOOT=uboot_rtos_4g.bin
APP_INFO=app_info
APP_IMAGE=dvr.bin
APP_RES=res
IMAGE=rtos.img

if ! ([ -f $BOOT ] && [ -f $APP_IMAGE ] &&  [ -f $APP_RES ])
then
 echo "can't find $BOOT or $APP_IMAGE or $APP_RES"
 exit 1;
fi


#生成APP INFO
len=`stat -c %s $APP_IMAGE`
len=`printf "0x%08x" $len`
len1=`expr substr $len 9 2`
len2=`expr substr $len 7 2`
len3=`expr substr $len 5 2`
len4=`expr substr $len 3 2`
echo -n -e "\x$len1\x$len2\x$len3\x$len4" > $APP_INFO

dd if=$BOOT      of=$IMAGE   bs=1024 count=384 seek=0
dd if=$APP_INFO  of=$IMAGE   bs=1024 count=64 seek=1024
dd if=$APP_IMAGE of=$IMAGE   bs=1024 count=2496 seek=1088
dd if=$APP_RES   of=$IMAGE   bs=1024 count=512 seek=3584
dd if=/dev/zero  of=$IMAGE   bs=1024 count=4096 seek=4096

rm $APP_INFO


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值