You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
1.1 KiB
23 lines
1.1 KiB
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
export CC=clang
|
|
|
|
meson setup build --reconfigure
|
|
meson compile -v -C build
|
|
|
|
sector_size=512
|
|
partition_offset=2048
|
|
|
|
dd if=/dev/zero of=build/os.img bs="${sector_size}" count="$((partition_offset + 20480))"
|
|
dd if=build/mbr.bin of=build/os.img bs="${sector_size}" count=1 conv=notrunc
|
|
dd if=build/bootloader.bin of=build/os.img bs="${sector_size}" seek=1 count="$((partition_offset - 1))" conv=notrunc
|
|
mkfs.fat -F 16 --offset "${partition_offset}" build/os.img
|
|
mcopy -i build/os.img@@"$((partition_offset * sector_size))" -s src ::src
|
|
mcopy -i build/os.img@@"$((partition_offset * sector_size))" build/kernel.bin ::kernel.bin
|
|
mmd -i build/os.img@@"$((partition_offset * sector_size))" ::bin
|
|
mcopy -i build/os.img@@"$((partition_offset * sector_size))" build/terminal ::bin/terminal
|
|
mcopy -i build/os.img@@"$((partition_offset * sector_size))" build/shell ::bin/shell
|
|
mcopy -i build/os.img@@"$((partition_offset * sector_size))" build/echo ::bin/echo
|
|
mcopy -i build/os.img@@"$((partition_offset * sector_size))" build/ls ::bin/ls
|
|
mcopy -i build/os.img@@"$((partition_offset * sector_size))" build/cat ::bin/cat
|
|
|