OS Development In Linux (GCC And LD Problems)
Posted: Fri May 04, 2007 3:37 am
...
Thanks,
Lster
Thanks,
Lster
The Place to Start for Operating System Developers
http://f.osdev.org/
That kernel is only a few kilobytes. Because you're not using grub, you'll have to change the memory address of the kernel. It sounds like your GCC hasn't been built with required the executable formats (the tutorial loads the kernel at the 1MB mark, so GCC is probably getting confused and inserting 1MB of random junk before your code).Lprogster wrote:Hi all
As well as developing my OS in Windows, I would like to start a new OS in Linux. As when starting my first OS, I decided to start with this one at http://osdever.net/bkerndev/Docs/whatsleft.htm . (Scroll down to the bit 'Get the whole tutorial...' for the OS archive)
However I am having problems compiling it. There is a batch script with it which is used to compile it. I create my own '.sh' script with the equivalent commands and run it. I then use 'cat' to join it to my boot sector and it produces a 1MB kernel that Qemu tells me is invalid.
Here is my script; please dont run it as it may be unsafe!
It should be noted my boot sector has already been made (in Windows) and does work. I am using the provided link script and source code.Code: Select all
cd /home/lster/Desktop/bkerndev/Sources nasm -f aout -o start.o start.asm gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o scrn.o scrn.c gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o gdt.o gdt.c gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o idt.o idt.c gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o isrs.o isrs.c gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o irq.o irq.c gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o timer.o timer.c gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o kb.o kb.c ld -T link.ld -o kernel.bin start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o cat ./bootsect.bin ./kernel.bin > ./a.img
Any ideas? (Tell me if you need more info.)
Thanks,
Lster
Code: Select all
Kernel now starting.........
Init keyboard.. DONE
Init floppy.. DONE
Enabling ints.. DONE
Login:
When Qemu "just hangs" it's very likely a triple fault.Lprogster wrote:Thank you; it now accepts my kernel, but when I run it Qemu just hangs. Any other ideas...?