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!
Porting existing applications to my OS
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.
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.
- spix
- Member
- Posts: 128
- Joined: Mon Jun 26, 2006 8:41 am
- Location: Millicent, South Australia
- Contact:
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
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
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.
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.