9 Replies - 9152 Views - Last Post: 02 October 2012 - 05:39 AM

#1 MrCAT22  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 32
  • Joined: 27-June 12

build independent operating system

Posted 23 August 2012 - 09:22 PM

Hi,

I already made so many application with dev-cpp.

And now, I arrive at this hardest question and have no idea how do it with Dev Cpp. :helpsmilie:

I am sure a simple application (like 'Hello World') is enough to be called as "operating system"
if we can run it independently (not run it under windows, linux, or other operating system).

How run it independently?
we can run it from our USB when our computer start booting.
or we can run it from our hardisk that doesn't has operating system.

but how we can do this? the *.exe file can't run when the computer is start booting.
I have no idea. :helpsmilie: :surrender:
Any tutorial?

This post has been edited by MrCAT22: 23 August 2012 - 09:24 PM


Is This A Good Question/Topic? 0
  • +

Replies To: build independent operating system

#2 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5304
  • View blog
  • Posts: 27,195
  • Joined: 10-May 07

Re: build independent operating system

Posted 24 August 2012 - 07:12 AM

First research how to write a boot loader, that'll be enough to get you started booting off a USB stick/thumb drive.
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6062
  • View blog
  • Posts: 23,514
  • Joined: 23-August 08

Re: build independent operating system

Posted 24 August 2012 - 07:58 AM

http://wiki.osdev.or...anded_Main_Page
Was This Post Helpful? 1
  • +
  • -

#4 Aphex19  Icon User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 615
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: build independent operating system

Posted 24 August 2012 - 10:52 AM

Read through OSdev thoroughly (JackOfAllTrade's link), that will tell you more than any single thread could tell you here. I really think that it's pointless to try to explain here what is available elsewhere.

I recommend starting here, then here.

edit:
However, just to clarify. An executable file is usually specific to the operating system. It will follow a file format which the operating system can understand. e.g. Windows uses the PE file format. In OS dev, the computer understands binary instructions, that's it. Whatever abstractions you want from that are entirely arbitrary (e.g. files, file formats, virtual memory etc).

This post has been edited by Aphex19: 27 August 2012 - 06:42 AM

Was This Post Helpful? 1
  • +
  • -

#5 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: build independent operating system

Posted 24 August 2012 - 12:54 PM

hint hint: you can create a raw binary to print hello world that will fit in the boot sector with room to spare pretty easily.

some things I've learned that may help you:
I like using QEMU personally. It has a -kernerl option that will load your kernel(either linux or multiboot) directly. this means it has to be in the ELF file format which on windows means you either need a cross compiler OOOR you can learn from my hardship and just use objcopy(part of both MinGW and Cygwin) to preform the conversion ;). I've spent several hours trying to figure out how to produce ELF files on windows and that's by far the easiest solution.

GRUB will then be able to load your kernel just like QEMU can in a real situation and isn't too hard to setup.

This post has been edited by ishkabible: 24 August 2012 - 12:56 PM

Was This Post Helpful? 0
  • +
  • -

#6 MrCAT22  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 32
  • Joined: 27-June 12

Re: build independent operating system

Posted 24 August 2012 - 08:02 PM

hi, Thanks for reply.

I found this tutorial:
http://www.codeproje...rld-Application

it create "Hello World" with NASM and compile it into *.bin
and write that *.bin into floppy disk.
and boot from that floppy.

I want to know how we can do this with Dev Cpp?
how to compile *.c into *.bin? :helpsmilie:
and how write that *.bin into USB? :helpsmilie:
and then we can boot from that USB.

If we can, I think we can make Operating System easily and fun. :bananaman: :bigsmile:
Was This Post Helpful? 0
  • +
  • -

#7 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,281
  • Joined: 28-March 11

Re: build independent operating system

Posted 24 August 2012 - 08:08 PM

Bootloaders are usually done in Assembly because of size restrictions. To create an os that does something useful is NOT fun and easy. There is tons of things that an os does. Just look at code of one of the many open source os's out ther
Was This Post Helpful? 0
  • +
  • -

#8 MrCAT22  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 32
  • Joined: 27-June 12

Re: build independent operating system

Posted 24 August 2012 - 08:19 PM

hi, I found how to compile *.c into *.bin in here:
http://www.nondot.or...TheBootProcess/

but it use Dev Cpp 2.7.2.3, but I use Dev Cpp 3.4.2

how to compile *.c into *.bin? like this:
gcc -c test.c
ld -o test -Ttext 0x0 -e main test.o
objcopy -R .note -R .comment -S -O binary test test.bin


my test.c only like this:
int main(){
}




but it give me the following error:
ld: warning: cannot find entry symbol main; defaulting to 00000000
test.o(.text+0x21):test.c: undefined reference to `_alloca'
test.o(.text+0x26):test.c: undefined reference to `__main'




so, is there any Dev Cpp 2.7.2.3 out there? Please share.... thank you....
Was This Post Helpful? 0
  • +
  • -

#9 Aphex19  Icon User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 615
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: build independent operating system

Posted 27 August 2012 - 06:49 AM

Quote

To create an os that does something useful is NOT fun and easy.

I disagree that OS development is not fun. Developing a kernel has been great fun to me, although obviously there's more to an OS than only the kernel. I agree that's it not easy though, not at all.

View PostMrCAT22, on 25 August 2012 - 04:19 AM, said:

hi, I found how to compile *.c into *.bin in here:
http://www.nondot.or...TheBootProcess/

but it use Dev Cpp 2.7.2.3, but I use Dev Cpp 3.4.2

how to compile *.c into *.bin? like this:
gcc -c test.c
ld -o test -Ttext 0x0 -e main test.o
objcopy -R .note -R .comment -S -O binary test test.bin


my test.c only like this:
int main(){
}




but it give me the following error:
ld: warning: cannot find entry symbol main; defaulting to 00000000
test.o(.text+0x21):test.c: undefined reference to `_alloca'
test.o(.text+0x26):test.c: undefined reference to `__main'




so, is there any Dev Cpp 2.7.2.3 out there? Please share.... thank you....


Sounds like you're using a standard version of GCC on Windows. It's best to build a cross compiler (which can work with the ELF format) if you want to work in kernel development, especially on Windows. Step by step instructions here. You should install Cygwin to compile the cross compiler too, since essentially, you need a UNIX environment to compile it.

Personally, I would recommend (if you want to write a kernel) using the GRUB bootloader. It makes your life so much easier, believe me.

This post has been edited by Aphex19: 27 August 2012 - 07:03 AM

Was This Post Helpful? 0
  • +
  • -

#10 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 615
  • Joined: 03-April 12

Re: build independent operating system

Posted 02 October 2012 - 05:39 AM

View PostMrCAT22, on 24 August 2012 - 07:22 AM, said:

I am sure a simple application (like 'Hello World') is enough to be called as "operating system"
if we can run it independently (not run it under windows, linux, or other operating system).


Not really: Bare machine programming is VERY typical with embedded systems.
They are still not considered operating systems.
With the smaller board there are often so little memory that you don't have an alternative:
There is no OS that fits in.

Last time I did that was writing a cruise control on ATMEL Butterfly card (1 kB RAM, 32 kB Flash).

If that's not counted (loading), then, a long time ago I wrote boot monitor for a Mikromikko 1. It was a 8085-based micro computer.
First write the code, then compile, then burn onto EPROM, then put the EPROM onto the board,
turn on the power and see what happens.
At least that should count.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1