Porting existing applications to my OS

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
User avatar
skylar
Posts: 8
Joined: Sun Oct 29, 2006 12:31 pm
Location: Seattle

Porting existing applications to my OS

Post by skylar »

I have recently begun writing a new kernel after about a 5 year "vacation" from OsDev. This will be my fourth kernel and it is still very early in the stages of development (protected mode, gdt, idt, irqs, paging, keyboard, video, and that's about it.)

My ultimate goal is to create a distributed server OS that can run ported versions of existing applications like lighttpd, Ruby, PHP, Perl, etc.

Does anyone have any tips on designing my OS so that I can port existing Linux applications in the future with minimal headaches?

Thanks!
xsix
Member
Member
Posts: 59
Joined: Tue Oct 24, 2006 10:52 am

Post by xsix »

dream again. to port perl or php distribution you'll need to simulate different OS API, and executables like PHP i think uses a big list of api calls. get your os working with a nice gui, different block devices ant NICs support, and then think about ports.
durand
Member
Member
Posts: 193
Joined: Wed Dec 21, 2005 12:00 am
Location: South Africa
Contact:

Post by durand »

Well, they don't need as many OS calls as they do library calls. I'm currently experimenting and porting a few applications across to my OS. You'll need a good, relatively complete standard unix/posix library. A lot of people use newlibc (http://sourceware.org/newlib/). And then you'll need to implement as many of the system call hooks in the library as is required.

I would suggest having a look at what system calls are required (file operations, signals, etc) for these libraries to work and make sure your OS supports them or plans to support them. Then you implement as many of the OS stubs and as much of the OS as is needed and start porting once you've done that.

But yeah... it's a bit early on to start porting apps according to the list of things you have implemented in your new OS. But it's certainly a good time to start planning the stuff you'll need when you do.
User avatar
spix
Member
Member
Posts: 128
Joined: Mon Jun 26, 2006 8:41 am
Location: Millicent, South Australia
Contact:

Post by spix »

I just want to point out that newlib isn't posix/sus compliant, it impliments some of the functions, but you will need to code a few yourself. Their goal seems to be embedded applications, and C99 standard I think.

Having said that, they are open to patches to work towards that goal, it's just not a priority.

Really, if you want compatibility with most linux apps, you probably want to follow the Open Groups Single UNIX Spec (SUS) keep in mind, that linux has a lot of little unique things and a lot of linux apps only work on linux (and not other UNIX variants)

Andrew
durand
Member
Member
Posts: 193
Joined: Wed Dec 21, 2005 12:00 am
Location: South Africa
Contact:

Post by durand »

I followed the Single Unix Specification (http://opengroup.org/onlinepubs/007908799/index.html) when implementing my libunix (http://www.djm.co.za/spoon/libUNIX.php) and I've found that I've had to implement a lot of non-standard stuff as well to port some Linux applications.

I feel a little bit dirty adding non-standard support into the library everytime I find something non-standard but, I guess that's the reality. Most of the trouble I find when porting applications is having to deal with poor Makefiles and bad configure scripts when they don't honour environment variables.

Missing library functions is just a matter of implementing them.
Post Reply