Creating OS [Noobie :D]

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.
akatchi
Posts: 9
Joined: Tue Oct 25, 2011 2:03 pm

Re: Creating OS [Noobie :D]

Post by akatchi »

death2all wrote:For a bootloader, I dare say that mine is just kludged together, and loads in the kernel from a predefined sector on disk (64, if you must know.) That's all you will really need, I would have thought. I am working on improving my boot loader now, to get it multiboot compliant, and the same with my kernel, but this is not mandatory just to get a basic OS working. As for displaying characters, it is BIOS interrupt 0x10 (I forget the service number, use Ralph Brown's Interrupt List for that...)

As for the whole thing, not too long, depending on how far you want to go, and what you want it to do. In its current state, my OS took about 2 months, most of which was consumed by a paging bug (albeit a really nooby bug, and one that I could very easily have avoided, and any competent programmer would have done.) All in all, to get a single command, in PMode, with paging and a flat memory model, a rough guesstimate gives me around 2-3 months, if you use your time well, and don't make any stupid mistakes.
Is it that easy to create a simple bootloader =o i was like wow it sure gonna take some time to create one but when you say you did it so fast xD. if i only create
an cross-compiler
a (micro etc... dont know wich one yet) kernel
and a bootloader or grubs
i can make an os already =o
wow thats quite fast =) i got till 1 february for my OS and i first wanna start with creating a very basic one and if i got time left then ill upgrade it, but i got a holiday between it :3 and a test week (you only get 1/2 tests a day looks like an exam in our country) wich means i got alot of free time 2 ^^
atm im doing an detailled report about what a os is exactly, just found out alot of things xD also gonna add stuff like the Algol 68 :3 its just im on wikipedia translating everything while im typing and then ill see something new blue's and that is pressable so i press it xD gonna explain that again :3 so its gonna be very detailed xD even if my os is gonna fail that might make my grade a nice one ^^

regards, Akatchi
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

Re: Creating OS [Noobie :D]

Post by CWood »

You're overcomplicating things. You don't need a cross compiler yet. Start small. Normal gcc will work fine, so long as you link as flat binary (check on the wiki for this.) I would also recommend against Algol 68 as well at this stage. After your exam, if you want to carry on with your OS, fine, the world is your oyster. But to start with, especially for your exam, concentrate on getting a very simple command, such as "sysinfo" with the CPU Vendor string, and amount of memory, printed. I'm not saying you're not capable of doing a cross compiler etc, I'm just saying that it does increase the likelihood that it won't work in time for your deadline, which is risky if it is for school. My computing teacher told me that to create a fully fledged OS, it takes 10,000 hours. You don't have that kind of time, unless you are Arnold Schwarzenegger in one of his movies. Go simple. It shouldn't take more than a month to display a simple memory map and vendor ID. Then, if you want, upscale after the deadline, as your own project.
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: Creating OS [Noobie :D]

Post by Combuster »

You don't need a cross compiler yet. Start small. Normal gcc will work fine
For anyone stuck in the past with 32-bit linux that knows exactly what sort of hack he's pulling off, host gcc can work. In all (other) cases, crosscompiler. It also happens to be one of the easiest steps to make one.
"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
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Creating OS [Noobie :D]

Post by Kazinsal »

Combuster wrote:For anyone stuck in the past with 32-bit linux that knows exactly what sort of hack he's pulling off, host gcc can work.
S/he also needs to know that the terrible kind of hack involved not only could cause the OS to not compile/not compile correctly for someone with, say, an i586-elf-gcc crosscompiler, but can also cause issues to arise when compiled with his or her own host compiler.

Imagine: one day, everything's fine, then you add a little feature or bugfix and boom, your OS no longer compiles.

Your default toolset install is designed to build for the specific OS you're running - not another OS and certainly not to build an OS of your own creation.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Creating OS [Noobie :D]

Post by Brynet-Inc »

The system toolchain is not really suitable for anything but the host system, distributions almost always includes local patches not found in the vanilla sources.

It is incredibly simple to create a cross-compiler, so just take the time. Bonus, you're creating a build environment that is reproducible by others.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

Re: Creating OS [Noobie :D]

Post by CWood »

Now I'm really gonna ruffle a few feathers. I develop directly in asm, not C. I only use flat binary linking using ld, to make my life easier rather than using the %include rubbish which makes the whole thing a hemorrhoid waiting to happen.
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: Creating OS [Noobie :D]

Post by Combuster »

death2all wrote:Now I'm really gonna ruffle a few feathers. I develop directly in asm, not C.
Then this is probably a good example why Assembler developers are not that good at giving C-and-OS related advice. :wink:

Take care next time.
"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 ]
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

Re: Creating OS [Noobie :D]

Post by CWood »

hehe fair enough thanks Combuster
akatchi
Posts: 9
Joined: Tue Oct 25, 2011 2:03 pm

Re: Creating OS [Noobie :D]

Post by akatchi »

death2all made an OS in assembly ? if its possible id like to create mines for as far as possible :D
is it possible to say what things i need to make becuase i dont understand anythign at all atm :oops: , totally dont know what to make for the very very basic os ^^
thanks for all the responses by the way
:D

Regards Akatchi
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

Re: Creating OS [Noobie :D]

Post by CWood »

It is very possible to write entirely in asm. Just be sure to be able to convert from C to asm mentally (not actually that different, given how similar C is to asm...)

edit: difficult
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Creating OS [Noobie :D]

Post by gerryg400 »

death2all wrote:It is very possible to write entirely in asm. Just be sure to be able to convert from C to asm mentally (not actually that different, given how similar C is to asm...)

edit: difficult
That's very confusing. If you're writing an OS in asm why do you need to "convert from C to asm mentally" ?
If a trainstation is where trains stop, what is a workstation ?
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: Creating OS [Noobie :D]

Post by rdos »

death2all wrote:It is very possible to write entirely in asm. Just be sure to be able to convert from C to asm mentally (not actually that different, given how similar C is to asm...)

edit: difficult
No sane person would "convert from C to asm". I write directly in asm because asm is superior to C, and if I do any type of "conversions" they are from C++, not C. When I'm forced to use C, I would still think in C++, and convert C++ OO to C, which is perfectly possible.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Creating OS [Noobie :D]

Post by gerryg400 »

rdos wrote:
death2all wrote:It is very possible to write entirely in asm. Just be sure to be able to convert from C to asm mentally (not actually that different, given how similar C is to asm...)

edit: difficult
No sane person would "convert from C to asm". I write directly in asm because asm is superior to C, and if I do any type of "conversions" they are from C++, not C. When I'm forced to use C, I would still think in C++, and convert C++ OO to C, which is perfectly possible.
So, rdos, you are an asm fan, and prefer asm to C ?

Why didn't you say so before ? :)
If a trainstation is where trains stop, what is a workstation ?
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: Creating OS [Noobie :D]

Post by Combuster »

Mentally needing to translate between language constructs implies you haven't mastered the language at all, because each language has it's own way of solving typical problems.

Try implementing an advanced data structure in C, C++ and Objective C with maintainability being your first concern. If your approach to memory management is not different in all three versions you did something wrong.
"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 ]
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

Re: Creating OS [Noobie :D]

Post by CWood »

What I meant was, most resources out there are written in C. I did not mean anything people are suggesting, about not having mastered the language etc, I meant that most code on the wiki, and other resources, is in C, and therefore must be mentally converted to be useful :). IOW, you need to be able to read and understand C to code an OS in ASM.
Post Reply