mirror of
https://github.com/hamishcoleman/thinkpad-ec
synced 2024-11-09 19:11:05 +00:00
29 lines
545 B
Bash
Executable File
29 lines
545 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Quick and dirty extracter to slice out a section of a binary file
|
|
# Copyright (C) 2016 Hamish Coleman
|
|
#
|
|
# TODO:
|
|
# - a tool that is portable to Windows
|
|
# - should output dependancy information
|
|
|
|
INFOFILE="$1"
|
|
if [ ! -r "$INFOFILE" ]; then
|
|
echo Need file with source and offset info
|
|
exit 1
|
|
fi
|
|
shift
|
|
|
|
OUT="$1"
|
|
if [ -z "$OUT" ]; then
|
|
echo Need output filename
|
|
exit 1
|
|
fi
|
|
|
|
read SOURCE OFFSET LENGTH <"$INFOFILE"
|
|
|
|
set -x
|
|
|
|
dd status=none iflag=count_bytes,skip_bytes if=$SOURCE skip=$[$OFFSET] count=$[$LENGTH] of="$OUT"
|
|
|