Bona Fide OS Developer
View unanswered posts | View active topics It is currently Tue Mar 19, 2024 5:45 am



Post new topic Reply to topic  [ 7 posts ] 
 OS with Linux Kernel Tutorial 
Author Message

Joined: Sun Jul 18, 2010 11:56 am
Posts: 4
Post OS with Linux Kernel Tutorial
Can anyone point me to a tutorial that shows the steps for using the linux kernel as the basis for a custom OS.


Sun Jul 18, 2010 11:58 am
Profile

Joined: Sat Jul 03, 2010 8:07 am
Posts: 44
Location: Clarkesville, GA, USA
Post Re: OS with Linux Kernel Tutorial
That largely depends upon what you mean by "custom OS". if you are looking for information on creating a Linux distribution you may want to look at linux from scratch. Otherwise, you would want to grab a book on Linux kernel development, and look into what sys calls Linux supports and what POSIX compliance it has.

_________________
After Monday and Tuesday, even the calendar says WTF.


Tue Jul 20, 2010 1:57 pm
Profile WWW

Joined: Sun Jul 18, 2010 11:56 am
Posts: 4
Post Re: OS with Linux Kernel Tutorial
Thanks, I just bought the books Profession Linux programming and Linux Kernal Architecture today.

I'm not really interested in a custom distribution, here is what I'm after: I have some server software that runs on has been tested on OpenSuSe and Fedora. What I would like is to turn it into some sort of linux appliance (virtual or other wise.)

So what I was thinking is if I could find out a little about what I need to know in order for the kernel to load and start my framework piece (which would be my os (shell and support apps))

I thought about the linux from scratch approach but it seems like all I really need is the kernel, the boot loader (grub) and someone/thing to show me a way to load my application after the kernel is loaded.

Any assistance would be greatly appreciated, or am I way off base?


Tue Jul 20, 2010 2:13 pm
Profile

Joined: Sat Jul 03, 2010 8:07 am
Posts: 44
Location: Clarkesville, GA, USA
Post Re: OS with Linux Kernel Tutorial
well, you would need to map every single dependency that the server software has. Typically, this isn't much. For example, if you were setting up a webserver you might have:

Linux 2.6.33, BusyBox, Iana-Etc, zlib, e2fsprogs, perl/php5/python/falconpl/ruby, openssl, openssh, termcap, iptables, and nginx (though busybox does have an httpd in it already)

Adding to this you will have to create a root file system, get a cross compiler set up, write some boot scripts, and configure everything.

your main issue here is that open source software is mostly built on top of other open source software. the web of dependencies is vast, complex, and often the source of endless frustration. this is made especially poignant when developers either do not release all of the dependencies of a given piece of software, or when they neglect to mention a dependency and are insanely difficult to get in touch with.

Now, if the server software you use does not have ANY dependencies, you could get away with only having busybox and a kernel... You could also simply create all of the tools you need, which is where the books you bought will come in handy. Those books will also come in handy in the case that you would like to tailor the kernel, the init system, and everything else to you own liking for this server software.

Linux is structured in a somewhat odd way if you are coming from the Windows world. Basically, the boot loader puts the kernel in memory. Linux separates memory into user space and kernel space, where drivers are loaded as modules and run as user mode processes. The kernel, once loaded, looks for an init system. The init system loads services (daemons in UNIX talk). By default the kernel will look at /sbin/init which normally doesn't happen. Most distributions use either sysvinit or upstart, neither of which are simple. Init will launch getty at some point. Getty will wait for input of a username, and once that input is given it will launch login and pass the user name to login. Login will then compare that input to the password file, upon a match it will fire up a shell, upon mismatch it will die and return control to getty. If you are looking to essentially create a non-GNU/Linux you would need to write the init system, the getty program, the login program, and the shell. The shell could be a single executable with all of the commands built into it (like busybox), or it can be several small programs that are accessed through a command interpreter (like bash) (coreutils, linux-utils, asmutils all expect bash or some other command interpreter to be present). These things alone would not be enough either. You would need a way to activate and setup your network connection. This is normally done by ifconfig and dhclient/dhcpcd. Beyond that, if the server software looks for any other applications, commands, or libraries you may need to write implementations of the things that it depends upon.

Some useful sites:
http://tldp.org/HOWTO/html_single/Imple ... -2.6-i386/
http://bluemaster.iu.hio.no/edu/dark/li ... calls.html
http://asm.sourceforge.net/asmutils.html
http://www.busybox.net/
http://tldp.org/

_________________
After Monday and Tuesday, even the calendar says WTF.


Tue Jul 20, 2010 8:08 pm
Profile WWW

Joined: Sun Jul 18, 2010 11:56 am
Posts: 4
Post Re: OS with Linux Kernel Tutorial
Ford,

Thanks for the detailed post. After reading your reply I'm wondering if the easier path is to walk through the linux from scratch and make a "custom scaled distribution", rather than trying to turn my server software into an OS.

I need to read a little, I thought the process was going to be a little easier. I just wanted an easier way to release my software and have it run with just the kernel and the glibc library, but it seems like any way I go will be a little more involved than that.


Tue Jul 20, 2010 8:34 pm
Profile

Joined: Sat Jul 03, 2010 8:07 am
Posts: 44
Location: Clarkesville, GA, USA
Post Re: OS with Linux Kernel Tutorial
What is the server software? Do you know what dependencies it has?

_________________
After Monday and Tuesday, even the calendar says WTF.


Wed Jul 21, 2010 8:41 am
Profile WWW

Joined: Sun Jul 18, 2010 11:56 am
Posts: 4
Post Re: OS with Linux Kernel Tutorial
Hello Ford,

The first part is a framework piece, written in C++. It handles things likes the object library, clustering, data access, caching, services and also a httpd

I'm using the libpq to handle data access and also using openldap. The rest is just kernel system calls.

The other pieces are an integration server, commerce server, portal server, customer relationship management server and a web based spreadsheet / data analysis server that operate over this framework.

I also the full product suite written in C# (Mono and Microsoft.Net). I like this version alot better but not sure how I would include Mono in the trimmed OS.


Wed Jul 21, 2010 10:32 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.