I am writing a simple bootloader following the wiki (http://wiki.osdev.org/Rolling_Your_Own_Bootloader). At this moment, the bootloader do:
- Memory detection.
- Test and enable A20 gate.
At this point I think that would be interesting to split the bootloader in several files to put all about gate in a separate file. I tried it but there is something wrong because the behaviour of the bootloader is odd.
All I did was put a a20_enable function in a separate file (a20_gate.S) and then I build all project:
Code: Select all
floppy.img: bootloader.bin os.bin
dd if=bootloader.bin of=floppy.img
dd if=os.bin of=floppy.img seek=1 bs=512
bootloader.bin: bootloader.o a20_gate.o
ld -Ttext=0x7c00 --oformat=binary bootloader.o a20_gate.o -o bootloader.bin
bootloader.o: bootloader.S
as bootloader.S -o bootloader.o
a20_gate.o: a20_gate.S
as a20_gate.S -o a20_gate.o
a20_gate.o: a20_gate.S
as a20_gate.S -o a20_gate.o
os.bin: os.o bootloader.o
ld -Ttext=0x1000 --oformat=binary os.o -o os.bin
os.o: os.S
as os.S -o os.o
bochs: bochsrc.txt
bochs -f bochsrc.txt -q
clean:
rm *.o *.bin
Is a far jump issue or something like that? I need a hint to know where looking.
Regards.