A toy operating system written in C.
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.
 
 
 
 
freywaros/build.sh

18 lines
748 B

#!/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))" src ::src
mcopy -i build/os.img@@"$((partition_offset * sector_size))" build/kernel.bin ::kernel.bin
mcopy -i build/os.img@@"$((partition_offset * sector_size))" build/hello.bin ::hello.bin