目录下放
输入文件:
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