diff options
| author | Alejandro Sior <aho@sior.be> | 2022-06-18 10:39:10 +0200 |
|---|---|---|
| committer | Alejandro Sior <aho@sior.be> | 2022-06-18 10:39:10 +0200 |
| commit | bd98b26786d21ffddb017ffe35ecaa4a9fd0aa4a (patch) | |
| tree | 1b78a43385bf0751abab8dd2423905696fd5baab /run.sh | |
| parent | 3aefeeb723b8822916fb39b7c32551c35c06e32f (diff) | |
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 |
