Awesomeness of Porting Programs (Fully self-hosting)
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Awesomeness of Porting Programs (Fully self-hosting)
Whats the next logical step after porting gcc, make, nasm and bash? That's right, attempt self-hosting. Took several tries, and I had to modify the build system, but only slightly. All I had to do was manually create dependency files and tools (like the initrd generator).
Some ported programs: http://microsea.googlecode.com/files/selfhost1.jpeg
make compiling the kernel: http://microsea.googlecode.com/files/selfhost3.jpeg, http://microsea.googlecode.com/files/selfhost4.jpeg
Some serial port output: http://microsea.googlecode.com/files/selfhost2.jpeg
Assembling nasm files: http://microsea.googlecode.com/files/selfhost5.jpeg
Compiling modules: http://microsea.googlecode.com/files/selfhost6.jpeg
Hey, look! The compiled modules load and work properly!! http://microsea.googlecode.com/files/selfhost7.jpeg
So do the applications that are compiled! http://microsea.googlecode.com/files/selfhost8.jpeg
And then I copied the compiled kernel to /sys/kernel (which is loaded by grub on boot as the kernel) and:
My operating system is officially self-hosting. I did other tests that I didn't capture, but everything was compiled properly and everything worked. Only minor things in the build system to work out, but it seems to be mostly working properly. Time to celebrate!
Edit: As an aside, it took half an hour to compile on my OS, as opposed to 30 seconds on linux.
-JL
Some ported programs: http://microsea.googlecode.com/files/selfhost1.jpeg
make compiling the kernel: http://microsea.googlecode.com/files/selfhost3.jpeg, http://microsea.googlecode.com/files/selfhost4.jpeg
Some serial port output: http://microsea.googlecode.com/files/selfhost2.jpeg
Assembling nasm files: http://microsea.googlecode.com/files/selfhost5.jpeg
Compiling modules: http://microsea.googlecode.com/files/selfhost6.jpeg
Hey, look! The compiled modules load and work properly!! http://microsea.googlecode.com/files/selfhost7.jpeg
So do the applications that are compiled! http://microsea.googlecode.com/files/selfhost8.jpeg
And then I copied the compiled kernel to /sys/kernel (which is loaded by grub on boot as the kernel) and:
My operating system is officially self-hosting. I did other tests that I didn't capture, but everything was compiled properly and everything worked. Only minor things in the build system to work out, but it seems to be mostly working properly. Time to celebrate!
Edit: As an aside, it took half an hour to compile on my OS, as opposed to 30 seconds on linux.
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Re: Awesomeness of Porting Programs (Fully self-hosting)
Man, that's the definition of awesomeness.
TODO:
zlib
freetype
libpng
cairo
gtk
LXDE
TODO:
zlib
freetype
libpng
cairo
gtk
LXDE
If a trainstation is where trains stop, what is a workstation ?
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Awesomeness of Porting Programs (Fully self-hosting)
Yo:
...FUUUUUUUUUU D:
...FUUUUUUUUUU D:
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: Awesomeness of Porting Programs (Fully self-hosting)
That's exactly where I hope to be within the next month. I just need to modify (possibly redo) my FAT filesystem driver to make it more 'ANSI C Library Compliant'. Then I need to port Newlib and finally port GCC etc.
Re: Awesomeness of Porting Programs (Fully self-hosting)
And Completeness, of course. piranha must be a happy man!gerryg400 wrote:Man, that's the definition of awesomeness.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: Awesomeness of Porting Programs (Fully self-hosting)
If it were completeness, the date displayed after logging in wouldn't be 1982.Chandra wrote:And Completeness, of course. piranha must be a happy man!gerryg400 wrote:Man, that's the definition of awesomeness.
I am pretty happy about it.
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Re: Awesomeness of Porting Programs (Fully self-hosting)
Hey, you're displaying your birthday in there? Kidding! Shouldn't be hard to fix.piranha wrote:If it were completeness, the date displayed after logging in wouldn't be 1982.
Anyways, complete in the sense that your OS is a development platform itself.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Re: Awesomeness of Porting Programs (Fully self-hosting)
That's great! I can even feel your happiness!
Re: Awesomeness of Porting Programs (Fully self-hosting)
Congratulations!
- Kazinsal
- Member
- Posts: 559
- Joined: Wed Jul 13, 2011 7:38 pm
- Libera.chat IRC: Kazinsal
- Location: Vancouver
- Contact:
Re: Awesomeness of Porting Programs (Fully self-hosting)
Very well done. Not many folks can write an OS that can build itself, that's for sure! Lots of hobby OSes don't even have the ability to compile their own programs, let alone the kernel and modules.
Ah, the pitfalls of CPU emulation. What are the speeds in something like VirtualBox? Real hardware? Provided you have a working POSIX implementation and ported tools, I don't see why the OS would be at fault for speed issues. Then again, as someone who's never dabbled in tasks this complex, I'm probably not one to make anything other than wild mass guesses!piranha wrote:Edit: As an aside, it took half an hour to compile on my OS, as opposed to 30 seconds on linux.
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: Awesomeness of Porting Programs (Fully self-hosting)
Fixed now.Hey, you're displaying your birthday in there? Kidding! Shouldn't be hard to fix.
I haven't tried it recently on virtualbox, and I don't currently have a spare machine to try it on. My guess is that my POSIX stuff is not nearly as efficient as it could be (readdir is especially badly implemented, for example). Also, gcc calls /usr/libexec/.../cc1 to compile the program, and that binary is a whopping 8.5 MB. Not only is my exec() function slow, but my ata code is even slower (PIO, one sector at a time). To compile a simple program takes 12 seconds the first time gcc is invoked, and 4 seconds after that (because of read caches), but thats still really slow. The cache just speeds up access to blocks, it doesn't fix the fact that exec needs to map upwards of 9 MB of an executable each time gcc is called. Version 0.2 of my OS is focusing on doing things right, fixing bugs and hacks, and SMP and some networking. Version 0.3 will focus on making everything fast (and will require a lot of rewriting of the block device layer).Blacklight wrote:Very well done. Not many folks can write an OS that can build itself, that's for sure! Lots of hobby OSes don't even have the ability to compile their own programs, let alone the kernel and modules.
Ah, the pitfalls of CPU emulation. What are the speeds in something like VirtualBox? Real hardware? Provided you have a working POSIX implementation and ported tools, I don't see why the OS would be at fault for speed issues. Then again, as someone who's never dabbled in tasks this complex, I'm probably not one to make anything other than wild mass guesses!piranha wrote:Edit: As an aside, it took half an hour to compile on my OS, as opposed to 30 seconds on linux.
As for now, I don't mind waiting if the result is a self-compiling OS
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Re: Awesomeness of Porting Programs (Fully self-hosting)
Just beware of the "second version antipattern" http://en.wikipedia.org/wiki/Second-system_effectpiranha wrote:Version 0.2 of my OS is focusing on doing things right, fixing bugs and hacks, and SMP and some networking. Version 0.3 will focus on making everything fast (and will require a lot of rewriting of the block device layer).