C, linkers, bootloaders, assembly

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
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

C, linkers, bootloaders, assembly

Post by sds2017 »

Hi I am Jackson, and I a beginner on Operating system development and I know this site said that it was not for beginners but, I understand a lot of the basic stuff except one tutorial the making a simple c kernel. The thing I don't understand is the linker or about the GRUB boot loader. So am asking if any of you know of a better place for beginner Operating system design or if you could give me a simpler way or explain the tutorial.

Thanks
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: C, linkers, bootloaders, assembly

Post by Combuster »

Actually, the requirements are about not being a beginner developer. Everybody is elegible for some help in OS development, but it will be really frustrating if you are not professional and self-sufficient enough to write big programs and make them bug-free, then the complex task of OS development is not suited for you. For instance: a tutorial. You should be able to run through it without necessarily understanding it. Yet you get stuck in there.

My recommendation is that you start on something complex for your standards, like a 3D game from scratch (a pong clone, maybe). The skills you improve from that will later help you doing the more complex task of writing an OS.
"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
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: C, linkers, bootloaders, assembly

Post by Nessphoro »

LD - the linker takes all the code you've compiled and links it together. Pretty much glues all the parts, because when you compiled the code for assembly it has no idea about kmain, but a mere name. And vice versa.

Now GRUB (Grand Unified Boot Loader) is a program that loads your OS - it's like your OS is a child and needs a safe environment (Protected Mode) to live in. And GRUB does all that for you. And the rest of that tutorial is on creating a floppy and copying GRUB and your OS on it.

A tutorial, that I found rather simple, would be Bran's Kernel Development Tutorial
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Re: C, linkers, bootloaders, assembly

Post by sds2017 »

Hi, its me again and I have already been in game, and web devepment and I found them rather boring and when I finally came across to OS development it was a challenge. So I not a beginner programmer just a beginner operating system designer. I understand assembly and c but I don't understand GRUB. I know what it is and all, but all the "equ 0>>1" and the "ALIGN" doesn't make sense to me so I figured if any of you could give me a link to a website or just give me a better understanding of how GRUB works it would help me a lot.

And on the last post thank you for the info but I understand that but I don't understand Bran's Kernel Development very well because it uses GRUB and doesn't explain it very well in my propective
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: C, linkers, bootloaders, assembly

Post by Nessphoro »

Just tell us what exactly you don't understand,
all the "equ 1<<0" and "equ 1<<1" is just setting flags for GRUB. equ stands for equals "<<" are shifts.
ALING ensures that your "sections" are multiples of ALING, ex. if my code is 985 bytes of code and ALING is set to 1024 my code will take up 1024 bytes.
User avatar
Lionel
Member
Member
Posts: 117
Joined: Fri Jul 16, 2010 2:16 pm
Libera.chat IRC: ryanel
Location: California

Re: C, linkers, bootloaders, assembly

Post by Lionel »

I'm assuming your talking about the multiboot header with the 'equ 1<<1' stuff. If your a beginner to os developing, then you don't have to worry about it or understand it. Just don't worry about it until later.
P.S: Nessphoro's explanation is right about equ 1<<1 stuff.
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Re: C, linkers, bootloaders, assembly

Post by sds2017 »

I just have 2 questions for you.

1. What book would be good on OS development for me, if there is a one for me.

2. Second is there any OS that I could mabye study the source code (ex. MINIX).

Thanks for your help.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: C, linkers, bootloaders, assembly

Post by Nessphoro »

sds2017 wrote:I just have 2 questions for you.

1. What book would be good on OS development for me, if there is a one for me.

2. Second is there any OS that I could mabye study the source code (ex. MINIX).

Thanks for your help.
1. http://wiki.osdev.org/Books

2. Linux
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Re: C, linkers, bootloaders, assembly

Post by sds2017 »

Thanks
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: C, linkers, bootloaders, assembly

Post by Combuster »

+1. Steal Linux's driver code if you have to but ignore it's design.
"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 ]
bifferos
Posts: 13
Joined: Fri Aug 27, 2010 7:29 am

Re: C, linkers, bootloaders, assembly

Post by bifferos »

http://prex.sourceforge.net/ is also a fairly nicely laid out and well documented operating system.

I sympathise about Grub. Usability is just f***ing awful, however fortunately you don't need it to develop an OS, you can just use the -kernel option of Qemu to boot your Multiboot binaries directly. When you have your kernel working perfectly (cough...), then you can come back to the forum and ask about Grub :lol:.

Berkus: I believe him. I can remember a friend in the gaming business porting a game from the PC to the PS1. There was no assembler, all the graphics programming was done via C libraries supplied by Sony. I imagine that >10 years on anything that needs optimizing is either bought as a library or has already been developed by any software house worth it's salt, so I can believe the majority of gaming coders just concentrate on the gaming logic rather than performance issues.

regards,
Biff.
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Re: C, linkers, bootloaders, assembly

Post by sds2017 »

Thanks again for the info. Along with the recommendations would Operating Systems: Design and Implementation(3rd Edition) be a good book to learn basic theory and understand MINIX.
Post Reply