1
0
Fork 0
mirror of https://github.com/tailix/loadwarka.git synced 2024-11-11 13:50:54 -05:00
loadwarka/build.sh

27 lines
704 B
Bash
Raw Normal View History

2022-01-26 15:19:39 -05:00
#!/bin/sh
set -e
2022-01-27 12:10:51 -05:00
BIN='vendor/cross/root/bin'
2022-01-27 12:56:26 -05:00
SRC='src/x86'
2022-01-26 15:19:39 -05:00
CROSS="$BIN/i386-elf-"
2022-01-27 13:21:06 -05:00
STAGE1_LDFLAGS='--defsym=program_start=0x7c00'
STAGE2_LDFLAGS='--defsym=program_start=0x7e00'
2022-01-27 14:26:06 -05:00
STAGE1_OBJS="$SRC/common.o $SRC/stage1.o"
2022-01-27 14:49:04 -05:00
STAGE2_OBJS="$SRC/common.o $SRC/stage2.o $SRC/main.o"
2022-01-27 13:21:06 -05:00
2022-01-26 19:29:05 -05:00
./clean.sh
2022-01-27 14:02:58 -05:00
${CROSS}gcc -c $SRC/common.S -o $SRC/common.o
2022-01-27 12:56:26 -05:00
${CROSS}gcc -c $SRC/stage1.S -o $SRC/stage1.o
${CROSS}gcc -c $SRC/stage2.S -o $SRC/stage2.o
2022-01-27 14:49:04 -05:00
${CROSS}gcc -c $SRC/main.c -o $SRC/main.o
2022-01-27 13:09:49 -05:00
2022-01-27 13:21:06 -05:00
${CROSS}ld -T$SRC/linker.ld -o $SRC/stage1.bin $STAGE1_LDFLAGS $STAGE1_OBJS
${CROSS}ld -T$SRC/linker.ld -o $SRC/stage2.bin $STAGE2_LDFLAGS $STAGE2_OBJS
2022-01-27 13:09:49 -05:00
2022-01-27 12:56:26 -05:00
./testyboot mbr mbr.bin $SRC/stage1.bin
cat mbr.bin $SRC/stage2.bin > disk.img