5 [ -f "$1" -a -f "$2" ] ||
{
6 echo "Usage: $0 <kernel image> <rootfs image> [output file]"
10 # Make sure provided images are 64k aligned.
13 dd if="$1" of
="$kern" bs
=$BLKSZ conv
=sync
2>/dev
/null
14 dd if="$2" of
="$root" bs
=$BLKSZ conv
=sync
2>/dev
/null
16 # Calculate md5sum over combined kernel and rootfs image.
17 md5
=$
(cat "$kern" "$root" |
md5sum -)
19 # Write image header followed by kernel and rootfs image.
20 # The header is padded to 64k, format is:
21 # CI magic word ("Combined Image")
22 # <kernel length> length of kernel encoded as zero padded 8 digit hex
23 # <rootfs length> length of rootfs encoded as zero padded 8 digit hex
24 # <md5sum> checksum of the combined kernel and rootfs image
25 ( printf "CI%08x%08x%32s" \
26 $
(stat
-c "%s" "$kern") $
(stat
-c "%s" "$root") "${md5%% *}" | \
27 dd bs
=$BLKSZ conv
=sync
;
29 ) > ${3:-openwrt-combined.img} 2>/dev
/null
This page took 0.043976 seconds and 5 git commands to generate.