aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/ipkg-make-index.sh
Commit message (Expand)AuthorAgeFilesLines
* build: use mkhash to replace various quirky md5sum/openssl callsFelix Fietkau2017-01-051-1/+1
* package/Makefile & ipkg-make-index.sh: add full package data listAlberto Bursi2016-12-261-1/+1
* ipkg-make-index.sh: drop a few non-essential fieldsFelix Fietkau2016-12-141-1/+1
* ipkg-make-index.sh: drop md5sum from package indexFelix Fietkau2016-12-141-3/+0
* scripts: ensure that ipkg-make-index.sh exits successfullyJo-Philipp Wich2015-05-271-0/+1
* build: allow creating empty package feedsFelix Fietkau2015-05-261-0/+3
* ipkg-make-index: use more backwards-compatible openssl call for SHA256Steven Barth2013-10-171-1/+1
* opkg: add support for SHA256 verificationSteven Barth2013-10-041-0/+2
* package/index: filter out the libc package from the indexFelix Fietkau2012-06-111-0/+1
* scripts/ipkg-make-index.sh: use bash instead of /bin/sh to fix use of [[ ]]Felix Fietkau2012-05-131-1/+1
* build: prevent the virtual "kernel" package from leaking into the package ind...Felix Fietkau2012-05-131-0/+3
* Never write errors to stdout from ipkg-make-index.shJo-Philipp Wich2011-02-231-2/+2
* ipkg-make-index: remove leading './' from the Filename fieldGabor Juhos2009-03-291-1/+1
* finally move buildroot-ng to trunkFelix Fietkau2016-03-201-0/+24
ld } /* Literal.Number.Integer.Long */
#!/bin/sh

BLKSZ=65536

[ -f "$1" -a -f "$2" ] || {
	echo "Usage: $0 <kernel image> <rootfs image> [output file]"
	exit 1
}

IMAGE=${3:-openwrt-combined.img}

# Make sure provided images are 64k aligned.
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" | mkhash md5)

# Write image header followed by kernel and rootfs image.
# The header is padded to 64k, format is:
#  CI               magic word ("Combined Image")
#  <kernel length>  length of kernel encoded as zero padded 8 digit hex
#  <rootfs length>  length of rootfs encoded as zero padded 8 digit hex
#  <md5sum>         checksum of the combined kernel and rootfs image
( printf "CI%08x%08x%32s" \
	$(stat -c "%s" "$kern") $(stat -c "%s" "$root") "${md5%% *}" | \
	dd bs=$BLKSZ conv=sync;
  cat "$kern" "$root"
) > ${IMAGE} 2>/dev/null

# Clean up.
rm -f "$kern" "$root"