diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2015-09-14 21:58:14 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2015-09-15 22:43:33 -0500 |
commit | 1138dd0ec507998f1749730ee53e7d89be6a0138 (patch) | |
tree | 77190a576fbcdbdc2e8f62534f90cb2cef43bad6 /tools/bin2c | |
parent | f71dbb43a3f09b3409683e4fca4f9ec60774914d (diff) |
load security code from install directory
This allows us the compiled saturn-mkboot to be distributed, as it's
no longer linked against the security code binary, but rather loads it
at runtime.
Diffstat (limited to 'tools/bin2c')
-rwxr-xr-x | tools/bin2c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/tools/bin2c b/tools/bin2c deleted file mode 100755 index 25bb6f7..0000000 --- a/tools/bin2c +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh - -readbyte() -{ - read dummy hex << EOF - $(dd bs=1 count=1 2> /dev/null | od -t xC) -EOF - printf "%s\n" $hex -} - -if [ $# -ne 1 ] ; then - echo "usage: $0 in.bin > out.c" - exit -fi - -varname=$(basename $1 .bin | tr -d "\n" | tr -c a-zA-Z _) -length=0 - -exec < $1 -printf "#include <stddef.h>\n" -printf "const unsigned char %s[] = {" $varname - -byte=$(readbyte) -until [ -z $byte ] ; do - [ $(($length % 12)) -eq 0 ] && printf "\n\t" - printf "0x%s," $byte - let length+=1 - - byte=$(readbyte) -done - -[ $length -ne 0 ] && printf "\n" -printf "};\n" - -printf "const size_t %s_size = %s;\n" $varname $length |