C kernel runs now after fixing bootloader and build, beginnings of a REPL
This commit is contained in:
15
Makefile
15
Makefile
@@ -1,15 +1,15 @@
|
||||
all: boot.img kernel.bin
|
||||
|
||||
src/%.o: src/%.c
|
||||
bcc -ansi -3 -c -o $@ $<
|
||||
bcc -ansi -0 -c -o $@ $<
|
||||
|
||||
kernel.bin: src/kernel.o
|
||||
ld86 -T0x1000 -M -o $@ $^
|
||||
ld86 -d -M -o $@ $^ | tee ld86.out
|
||||
|
||||
asm/kernel_syms.S: kernel.bin
|
||||
objdump86 kernel.bin | \
|
||||
grep -E "^[0-9]+ T _.*" | \
|
||||
python -c "import sys; print '\n'.join([\"_extern_c%s:\n jmp 0x1000:0x%04x\" % (x.split(' ')[2].strip('\n'), int(x.split(' ')[0].lstrip('0'), 16)-0x1000) for x in sys.stdin.readlines()])" > asm/kernel_syms.S
|
||||
cat ld86.out | \
|
||||
grep -E "^\s+kernel\s+[a-zA-Z0-9_]+ 0 [0-9]+" | \
|
||||
python -c "import sys; print '\n'.join([\"_extern_c%s:\n jmp 0x1000:0x%04x\" % (x.lstrip(' ').replace('kernel', '').lstrip(' ').split(' ')[0], int(x.lstrip(' ').replace('kernel', '').lstrip(' ').split(' ')[4], 16)) for x in sys.stdin.readlines()])" > asm/kernel_syms.S
|
||||
|
||||
boot.bin: asm/kernel_syms.S asm/bootloader.S asm/bootloader.S
|
||||
cd asm && nasm bootloader.S -f bin -o ../$@
|
||||
@@ -18,7 +18,10 @@ asm/%.o: asm/%.S
|
||||
nasm $< -f as86 -o $@
|
||||
|
||||
boot.img: boot.bin kernel.bin
|
||||
cat $^ > $@
|
||||
dd if=/dev/zero of=boot.img ibs=1k count=1440
|
||||
cat $^ > boot.tmp
|
||||
dd if=boot.tmp of=boot.img conv=notrunc
|
||||
rm -f boot.tmp
|
||||
|
||||
test: boot.img
|
||||
bochs -f bochsrc -q
|
||||
|
||||
Reference in New Issue
Block a user