diff options
Diffstat (limited to 'run.sh')
| -rwxr-xr-x | run.sh | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -1,5 +1,14 @@ #!/bin/sh -e +print_u32() { + printf "\\$(printf %o $(($1&0xFF)))\\$(printf %o $((($1 >> 8)&0xFF)))\\$(printf %o $((($1 >> 16)&0xFF)))\\$(printf %o $((($1 >> 24)&0xFF)))" +} + + +write_u32() { + print_u32 $1 | dd if=/dev/stdin of=$3 conv=notrunc bs=1 seek=$2 status=none +} + # :Tell hare to use our custom runtime # and linker scripts (this feature is so simple and neat :)) export HAREPATH=. @@ -19,4 +28,13 @@ objcopy \ --binary-architecture=i386:x86-64 \ boot boot.bin +size=$(stat -c %s boot.bin) +sectors=$((size/512 + 1)) +write_u32 1 $((446 + 8)) boot.bin +write_u32 $sectors $((446 + 12)) boot.bin + +[ -f boot.img ] && rm boot.img +../gptman/gptman convert boot.bin boot.img +chmod +rw boot.img + bochs |
