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