#!/bin/sh

# Copyright (C) 2006 Paul Mackerras, IBM Corporation <paulus@samba.org>
# This program may be used under the terms of version 2 of the GNU
# General Public License.

# This script takes a kernel binary and optionally an initrd image
# and/or a device-tree blob, and creates a bootable zImage for a
# given platform.

# Options:
# -o zImage	specify output file
# -p platform	specify platform (links in $platform.o)
# -i initrd	specify initrd file
# -d devtree	specify device-tree blob
# -s tree.dts	specify device-tree source file (needs dtc installed)
# -c		cache $kernel.strip.gz (use if present & newer, else make)
# -C prefix	specify command prefix for cross-building tools
#		(strip, objcopy, ld)
# -D dir	specify directory containing data files used by script
#		(default ./arch/powerpc/boot)
# -W dir	specify working directory for temporary files (default .)

# defaults
kernel=
ofile=zImage
platform=of
initrd=
dtb=
dts=
cacheit=
binary=
gzip=.gz

# cross-compilation prefix
CROSS=

# directory for object and other files used by this script
object=arch/powerpc/boot

# directory for working files
tmpdir=.

usage() {
    echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
    echo '       [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2
    echo '       [-D datadir] [-W workingdir] [--no-gzip] [vmlinux]' >&2
    exit 1
}

while [ "$#" -gt 0 ]; do
    case "$1" in
    -o)
	shift
	[ "$#" -gt 0 ] || usage
	ofile="$1"
	;;
    -p)
	shift
	[ "$#" -gt 0 ] || usage
	platform="$1"
	;;
    -i)
	shift
	[ "$#" -gt 0 ] || usage
	initrd="$1"
	;;
    -d)
	shift
	[ "$#" -gt 0 ] || usage
	dtb="$1"
	;;
    -s)
	shift
	[ "$#" -gt 0 ] || usage
	dts="$1"
	;;
    -c)
	cacheit=y
	;;
    -C)
	shift
	[ "$#" -gt 0 ] || usage
	CROSS="$1"
	;;
    -D)
	shift
	[ "$#" -gt 0 ] || usage
	object="$1"
	;;
    -W)
	shift
	[ "$#" -gt 0 ] || usage
	tmpdir="$1"
	;;
    --no-gzip)
        gzip=
        ;;
    -?)
	usage
	;;
    *)
	[ -z "$kernel" ] || usage
	kernel="$1"
	;;
    esac
    shift
done

if [ -n "$dts" ]; then
    if [ -z "$dtb" ]; then
	dtb="$platform.dtb"
    fi
    dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1
fi

if [ -z "$kernel" ]; then
    kernel=vmlinux
fi

platformo=$object/"$platform".o
lds=$object/zImage.lds
ext=strip
objflags=-S
tmp=$tmpdir/zImage.$$.o
ksection=.kernel:vmlinux.strip
isection=.kernel:initrd

case "$platform" in
pmac|pseries|chrp)
    platformo=$object/of.o
    ;;
coff)
    platformo=$object/of.o
    lds=$object/zImage.coff.lds
    ;;
miboot|uboot)
    # miboot and U-boot want just the bare bits, not an ELF binary
    ext=bin
    objflags="-O binary"
    tmp="$ofile"
    ksection=image
    isection=initrd
    ;;
cuboot*)
    binary=y
    gzip=
    ;;
ps3)
    platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o"
    lds=$object/zImage.ps3.lds
    binary=y
    gzip=
    ext=bin
    objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data"
    ksection=.kernel:vmlinux.bin
    isection=.kernel:initrd
    ;;
ep88xc)
    platformo="$object/fixed-head.o $object/$platform.o"
    binary=y
    ;;
esac

vmz="$tmpdir/`basename \"$kernel\"`.$ext"
if [ -z "$cacheit" -o ! -f "$vmz$gzip" -o "$vmz$gzip" -ot "$kernel" ]; then
    ${CROSS}objcopy $objflags "$kernel" "$vmz.$$"

    if [ -n "$gzip" ]; then
        gzip -f -9 "$vmz.$$"
    fi

    if [ -n "$cacheit" ]; then
	mv -f "$vmz.$$$gzip" "$vmz$gzip"
    else
	vmz="$vmz.$$"
    fi
fi

vmz="$vmz$gzip"

# Extract kernel version information, some platforms want to include
# it in the image header
version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
    cut -d' ' -f3`
if [ -n "$version" ]; then
    uboot_version="-n Linux-$version"
fi

case "$platform" in
uboot)
    rm -f "$ofile"
    mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
	$uboot_version -d "$vmz" "$ofile"
    if [ -z "$cacheit" ]; then
	rm -f "$vmz"
    fi
    exit 0
    ;;
esac

addsec() {
    ${CROSS}objcopy $4 $1 \
	--add-section=$3="$2" \
	--set-section-flags=$3=contents,alloc,load,readonly,data
}

addsec $tmp "$vmz" $ksection $object/empty.o
if [ -z "$cacheit" ]; then
    rm -f "$vmz"
fi

if [ -n "$initrd" ]; then
    addsec $tmp "$initrd" $isection
fi

if [ -n "$dtb" ]; then
    addsec $tmp "$dtb" .kernel:dtb
    if [ -n "$dts" ]; then
	rm $dtb
    fi
fi

if [ "$platform" != "miboot" ]; then
    ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
	$platformo $tmp $object/wrapper.a
    rm $tmp
fi

# Some platforms need the zImage's entry point and base address
base=0x`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | cut -d' ' -f3`

if [ -n "$binary" ]; then
    mv "$ofile" "$ofile".elf
    ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin
fi

# post-processing needed for some platforms
case "$platform" in
pseries|chrp)
    $object/addnote "$ofile"
    ;;
coff)
    ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
    $object/hack-coff "$ofile"
    ;;
cuboot*)
    gzip -f -9 "$ofile".bin
    mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
            $uboot_version -d "$ofile".bin.gz "$ofile"
    ;;
treeboot*)
    mv "$ofile" "$ofile.elf"
    $object/mktree "$ofile.elf" "$ofile" "$base" "$entry"
    if [ -z "$cacheit" ]; then
	rm -f "$ofile.elf"
    fi
    exit 0
    ;;
ps3)
    # The ps3's loader supports loading gzipped binary images from flash
    # rom to addr zero. The loader enters the image at addr 0x100.  A
    # bootwrapper overlay is use to arrange for the kernel to be loaded
    # to addr zero and to have a suitable bootwrapper entry at 0x100.
    # To construct the rom image, 0x100 bytes from offset 0x100 in the
    # kernel is copied to the bootwrapper symbol __system_reset_kernel.
    # The 0x100 bytes at the bootwrapper symbol __system_reset_overlay is
    # then copied to offset 0x100.  At runtime the bootwrapper program
    # copies the 0x100 bytes at __system_reset_kernel to addr 0x100.

    system_reset_overlay=0x`${CROSS}nm "$ofile".elf \
        | grep ' __system_reset_overlay$'       \
        | cut -d' ' -f1`
    system_reset_overlay=`printf "%d" $system_reset_overlay`
    system_reset_kernel=0x`${CROSS}nm "$ofile".elf \
        | grep ' __system_reset_kernel$'       \
        | cut -d' ' -f1`
    system_reset_kernel=`printf "%d" $system_reset_kernel`
    overlay_dest="256"
    overlay_size="256"

    rm -f "$object/otheros.bld"

    msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \
        skip=$overlay_dest seek=$system_reset_kernel      \
        count=$overlay_size bs=1 2>&1)

    if [ $? -ne "0" ]; then
       echo $msg
       exit 1
    fi

    msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \
        skip=$system_reset_overlay seek=$overlay_dest     \
        count=$overlay_size bs=1 2>&1)

    if [ $? -ne "0" ]; then
       echo $msg
       exit 2
    fi

    gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld"
    ;;
esac
