Files
perfect-dark/tools/extract-segment
T
2020-02-02 19:22:36 +10:00

12 lines
340 B
Bash
Executable File

#!/bin/bash
# Extracts a segment from the stage1 binary which has been built from source.
segment=$1
pos=$(grep "^\.$segment " $B_DIR/stage1.map | awk '{print $6}')
len=$(grep "^\.$segment " $B_DIR/stage1.map | awk '{print $3}')
dd if=$B_DIR/stage1.bin of=$B_DIR/ucode/$segment.bin skip=$(($pos)) iflag=skip_bytes bs=$(($len)) count=1