summaryrefslogtreecommitdiff
path: root/build_helpers
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2015-11-04 23:59:52 -0800
committeriximeow <me@iximeow.net>2015-11-04 23:59:52 -0800
commitede397ed5b34164b583ed81158e5b49b8fdc1595 (patch)
treed29bc1a3df48b4b564f0ab090c1e3033e01695f4 /build_helpers
parent4b4b3b9a15404263a537e8202a5085e942c57a7f (diff)
use progressiflyiosh for status instead of ad-hoc
Diffstat (limited to 'build_helpers')
-rwxr-xr-xbuild_helpers/compile.sh22
-rwxr-xr-xbuild_helpers/splicetobootsect.sh24
2 files changed, 27 insertions, 19 deletions
diff --git a/build_helpers/compile.sh b/build_helpers/compile.sh
index f00549f..fc97a27 100755
--- a/build_helpers/compile.sh
+++ b/build_helpers/compile.sh
@@ -1,27 +1,31 @@
-#! /bin/sh
+#! /bin/bash
set -u
set -e
+. build_helpers/progressif.ly.io.sh
+
INPATH="$1"
INBASEPATH="${INPATH%.*}"
# mangle such that no two names conflict (a/b/c and a/b.c conflicting would be no fun)
#OUTNAME="$(echo "$INBASEPATH" | sed 's/\./../g' | sed 's/\//._/g')"
OUTNAME="src._kernel._main"
-echo -n "[*] Building '$INPATH' to 'tmp/$OUTNAME'... "
+ # $INPATH
+track building_src "Building sources to 'tmp/$OUTNAME'... "
gcc -T linker.ld -m32 -Wl,--build-id=none -nostartfiles -nostdlib -ffreestanding $INPATH -o "tmp/$OUTNAME".o
-echo " OK!"
-echo -n "[+] Start address is... "
+trackend building_src t
+track find_start "Start address is... "
BIN_START=$(objdump tmp/src._kernel._main.o -f | grep start | cut -b 15-)
-echo "$BIN_START"
+# echo "$BIN_START"
+trackend find_start t
# this actually writes three extra nulls, not sure why...
echo "$BIN_START" | xxd -r - | od -t x --endian=little | head | xxd -r - > "bin/$OUTNAME".bin
-echo -n "[+] Stripping unnecessary sections... "
+track strip_sections "Stripping unnecessary sections... "
objcopy -R .note.gnu.build-id -R .comment -O binary "tmp/$OUTNAME".o "tmp/converted_$OUTNAME".bin
-echo " OK!"
+trackend strip_sections t
-echo -n "[+] Joining kernel and start address... "
+track relocate_kernel "Joining kernel and start address... "
# adjust for the three extra nulls above
dd if="tmp/converted_$OUTNAME".bin of="bin/$OUTNAME".bin seek=4 oflag=seek_bytes conv=notrunc 2>/dev/null
-echo " OK!"
+trackend relocate_kernel t
#rm "tmp/$OUTNAME".o
diff --git a/build_helpers/splicetobootsect.sh b/build_helpers/splicetobootsect.sh
index ac4ca0d..7a5b0b8 100755
--- a/build_helpers/splicetobootsect.sh
+++ b/build_helpers/splicetobootsect.sh
@@ -2,30 +2,34 @@
set -u
set -e
+. build_helpers/progressif.ly.io.sh
+
if [ -z "$1" ] || [ ! -f "$1" ]; then
- echo "Argument must be the path to a binary to splice into a bootsector"
+ track err_argpath "Argument must be the path to a binary to splice into a bootsector"
+ trackend err_argpath f
exit 1
fi
INSIZE=$(stat -c%s $1)
if [ $INSIZE -ge 510 ]; then
- echo "Input file is greater than bootsector max size (510 bytes)"
+ track err_bootsectsize "Input file is greater than bootsector max size (510 bytes)"
+ trackend err_bootsectsize f
exit 1
fi
OUTFILE="bootable.img"
-echo -n "[*] Creating bootsector template... "
+track bootsect_template "Creating bootsector template... "
dd if=/dev/zero bs=510 count=1 of="$OUTFILE" >/dev/null 2>&1
echo -ne "\x55\xaa" >> "$OUTFILE"
dd if=/dev/zero bs=512 count=255 ibs=512 seek=1 of="$OUTFILE" >/dev/null 2>&1
-echo " OK!"
+trackend bootsect_template t
-echo -n "[*] Inserting bootsector... "
+track create_bootsect "Inserting bootsector... "
dd if="$1" of="$OUTFILE" conv=notrunc >/dev/null 2>&1
-echo " OK!"
+trackend create_bootsect t
-echo -n "[*] Inserting kernel... "
+track insert_kernel "Inserting kernel... "
dd if="bin/src._kernel._main.bin" of="$OUTFILE" conv=notrunc ibs=512 seek=1 >/dev/null 2>&1
-echo " OK!"
-echo "Done. File at:"
-echo "$OUTFILE"
+trackend insert_kernel t
+track splice_done "Done. File at: '$OUTFILE'"
+trackend splice_done t