You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
971 B
51 lines
971 B
10 years ago
|
#!/bin/bash
|
||
|
|
||
9 years ago
|
if [ "$#" -ne 1 ]; then
|
||
|
echo "Usage: bootgen.sh *build dir*"
|
||
10 years ago
|
exit 1
|
||
|
fi
|
||
|
|
||
9 years ago
|
BUILD=$1
|
||
10 years ago
|
|
||
10 years ago
|
# Re-locator Path
|
||
|
RELOCATOR=bootmgr/relocator
|
||
|
|
||
9 years ago
|
# Build location
|
||
|
BOOTMGR=${BUILD}
|
||
10 years ago
|
|
||
|
# Check for re-locator binary
|
||
|
if [ ! -f $RELOCATOR/relocator.bin ]; then
|
||
|
|
||
|
echo "Error : Relocator Not found!"
|
||
10 years ago
|
exit 1
|
||
10 years ago
|
else
|
||
|
echo "Relocator found..."
|
||
|
fi
|
||
|
|
||
|
# Check for boot manager binary
|
||
|
if [ ! -f $BOOTMGR/bootmgr.bin ]; then
|
||
|
|
||
|
echo "Error : Boot Manager Not found!"
|
||
10 years ago
|
exit 1
|
||
10 years ago
|
else
|
||
|
echo "Boot Manager found..."
|
||
|
fi
|
||
|
|
||
|
# 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
|
||
|
|
||
10 years ago
|
# Generate a 0 padded version of the relocator
|
||
10 years ago
|
dd if=$RELOCATOR/relocator.bin of=__tmp.bin ibs=1 conv=notrunc >/dev/null 2>&1
|
||
|
|
||
10 years ago
|
# Concatenate the re-locator and the boot-manager
|
||
10 years ago
|
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
|