Moving on from DJGPP

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
jtokarchuk
Member
Member
Posts: 26
Joined: Fri Oct 14, 2011 4:32 pm

Moving on from DJGPP

Post by jtokarchuk »

Howdy,

I would like to move myself towards a sustainable build environment. I need some input on how to do that.

Currently I am following bran's kernel development build steps which utilizes DJGPP (I am running on a 64bit machine, I am using dosbox for DJGPP which works but I am hitting hard limits with character amounts that are hindering me)

I know about the article to set up a cross compiler. If I completed this, how would I translate the existing build structure to follow this? (GCC would work, curious about if linking would go the same?)

build script:

Code: Select all

cd src

echo Now assembling, compiling, and linking your kernel:
nasm -f aout -o start.o start.asm
rem Remember this spot here: We will add 'gcc' commands here to compile C sources


gcc -w -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o main.o main.c

gcc -w -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o scrn.o scrn.c

gcc -w -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o gdt.o gdt.c

gcc -w -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o idt.o idt.c

gcc -w -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o isrs.o isrs.c

gcc -w -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o irq.o irq.c

gcc -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o timer.o timer.c

gcc -w -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o kb.o kb.c

gcc -w -Wall -O -finline-functions -nostdinc -fno-builtin -I../include -c -o string.o string.c

rem This links all your files. Remember that as you add *.o files, you need to
rem add them after start.o. If you don't add them at all, they won't be in your kernel!
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 string.o
echo Cleaning up object files...
copy kernel.bin ..\kernel.bin
del *.o
del *.bin
echo Done!
pause
exit
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: moving on from DJGPP

Post by sortie »

I can point you to some resources I made that show how osdev is decently done on Unix systems:

http://wiki.osdev.org/Meaty_Skeleton - Example initial template operating system, as inspiration on how to structure an OS.
https://gitorious.org/sortie/myos/ - MyOS, the same template as Meaty Skeleton, but developed a little bit further and shows basic things like GDT and IDT, meant to show how basic things are decently done.

You're crazy for using DJGPP, but I commend you for desiring to move on. I suggest you adopt a decent Unix system in the making, if you're using Windows, or at least consider this option seriously.

[This post paid for by the committee to advance sortie's agenda of unix semantics and to abolish technologies that should not be.]
jtokarchuk
Member
Member
Posts: 26
Joined: Fri Oct 14, 2011 4:32 pm

Re: moving on from DJGPP

Post by jtokarchuk »

sortie wrote:I can point you to some resources I made that show how osdev is decently done on Unix systems:

http://wiki.osdev.org/Meaty_Skeleton - Example initial template operating system, as inspiration on how to structure an OS.
https://gitorious.org/sortie/myos/ - MyOS, the same template as Meaty Skeleton, but developed a little bit further and shows basic things like GDT and IDT, meant to show how basic things are decently done.

You're crazy for using DJGPP, but I commend you for desiring to move on. I suggest you adopt a decent Unix system in the making, if you're using Windows, or at least consider this option seriously.

[This post paid for by the committee to advance sortie's agenda of unix semantics and to abolish technologies that should not be.]
Heh, thanks.

I will work on that tonight. I'll convert to my debian partition and rework from there. Thanks for the advice.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Moving on from DJGPP

Post by Combuster »

The changes are mostly cosmetic once you have your cross-compiler set up. gcc becomes i686-elf-gcc, ld becomes i686-elf-ld. You don't actually need a unix for anything in particular.

That said, DJGPP is old and upgrades might expose bugs in your code you would never have encountered otherwise because of optimisation inabilities of such old GCCs.

[The i-have-more-posts committee's wisdom has it that you should learn from unix' mistakes and transcend way beyond it.</countertroll>]
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Moving on from DJGPP

Post by sortie »

Btw, link with your compiler, not the linker, otherwise you don't give the compiler a chance to do useful things.
Post Reply