X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=scripts%2Fcombined-image.sh;h=4e00cb89a286dae0ba97c9872965ccf5c9e8a875;hb=69f544937f8498e856690f9809a016f0d7f5f68b;hp=eecd3d7f20d7f225ada6be88725965c5453764df;hpb=f20af3832204ca2c35a9f1da208a34d2a509996c;p=openwrt%2Fopenwrt.git diff --git a/scripts/combined-image.sh b/scripts/combined-image.sh old mode 100644 new mode 100755 index eecd3d7f20..4e00cb89a2 --- a/scripts/combined-image.sh +++ b/scripts/combined-image.sh @@ -7,14 +7,16 @@ BLKSZ=65536 exit 1 } +IMAGE=${3:-openwrt-combined.img} + # Make sure provided images are 64k aligned. -kern=$(tempfile) -root=$(tempfile) +kern="${IMAGE}.kernel" +root="${IMAGE}.rootfs" dd if="$1" of="$kern" bs=$BLKSZ conv=sync 2>/dev/null dd if="$2" of="$root" bs=$BLKSZ conv=sync 2>/dev/null # Calculate md5sum over combined kernel and rootfs image. -md5=$(cat "$kern" "$root" | md5sum -) +md5=$(cat "$kern" "$root" | mkhash md5) # Write image header followed by kernel and rootfs image. # The header is padded to 64k, format is: @@ -26,7 +28,7 @@ md5=$(cat "$kern" "$root" | md5sum -) $(stat -c "%s" "$kern") $(stat -c "%s" "$root") "${md5%% *}" | \ dd bs=$BLKSZ conv=sync; cat "$kern" "$root" -) > ${3:-openwrt-combined.img} 2>/dev/null +) > ${IMAGE} 2>/dev/null # Clean up. rm -f "$kern" "$root"