#!/bin/bash if test "$Argc" -ne 1 { echo "Usage: bootgen.sh *build dir*" exit 1 } setglobal BUILD = $1 # Re-locator Path setglobal RELOCATOR = 'bootmgr/relocator' # Build location setglobal BOOTMGR = $(BUILD) # Check for re-locator binary if test ! -f $RELOCATOR/relocator.bin { echo "Error : Relocator Not found!" exit 1 } else { echo "Relocator found..." } # Check for boot manager binary if test ! -f $BOOTMGR/bootmgr.bin { echo "Error : Boot Manager Not found!" exit 1 } else { echo "Boot Manager found..." } # echo echo "Generating bootloader..." # Generate an all 0 bin file dd if=/dev/zero of=__tmp.bin ibs=1 count=256 conv=notrunc >/dev/null !2 > !1 # Generate a 0 padded version of the relocator dd if=$RELOCATOR/relocator.bin of=__tmp.bin ibs=1 conv=notrunc >/dev/null !2 > !1 # Concatenate the re-locator and the boot-manager cat __tmp.bin $BOOTMGR/bootmgr.bin > $BOOTMGR/bootloader.bin # Remove the tmp files rm -f __tmp.bin # Remove bootmgr.bin rm -f $BOOTMGR/bootmgr.bin