Page 1 of 1
How to build an OS from Linux Kernel?
Posted: Fri Aug 21, 2015 3:28 am
by vishwadeep86
i have seen lot of questions on this topic, but i am just starting in this field as an interest and a basic project. I am familiar with Linux, Shell Scripting, C, C++, Perl, Tcl.
I am just looking to learn to build an OS.
Question 1 :Can i build a basic OS using Linux kernel? It definitely must be possible, but where to start in a simple way? How much work it will take? Motto is just to build a simple OS which should boot and hold text files and rename/copy/move/edit is allowed with no directory structure. Is this the minimum i can think to start a small project?
Question 2 : I have one Desktop, i will create a partition to that system (suppose for 20-30GB) and start working on it for writing OS. This plan looks Ok in context of not putting rest of the data on risk?
Question 3 : What if i want to alter kernel only (just to learn) and want to use already built distro to make new distro? Is it possible? Yes i think this should also be possible, but where to start? Is it simpler than the other way around as in Question 1?
Question 4 : How can i play more with Linux/Unix? You all might be having more cool ideas?
Re: How to build an OS from Linux Kernel?
Posted: Fri Aug 21, 2015 3:47 am
by Combuster
1: You can build off the Linux kernel. The process is called Linux From Scratch, you should search that term.
2: Mistakes are human, and forever remain human.
3: You probably need a very good plan of what you want before you edit the kernel itself. It's a huge thing of its own.
4: Installing Gentoo (in a VM, perhaps, considering point 2) is a pretty good training excursion for those who want to be better than a desktop simpleton.
Re: How to build an OS from Linux Kernel?
Posted: Fri Aug 21, 2015 3:48 am
by FusT
Question 1 :Can i build a basic OS using Linux kernel? It definitely must be possible, but where to start in a simple way? How much work it will take? Motto is just to build a simple OS which should boot and hold text files and rename/copy/move/edit is allowed with no directory structure. Is this the minimum i can think to start a small project?
The linux kernel
is an OS, you would be building your own Linux
distro.
Question 2 : I have one Desktop, i will create a partition to that system (suppose for 20-30GB) and start working on it for writing OS. This plan looks Ok in context of not putting rest of the data on risk?
Not sure what you want to do here
Question 3 : What if i want to alter kernel only (just to learn) and want to use already built distro to make new distro? Is it possible? Yes i think this should also be possible, but where to start? Is it simpler than the other way around as in Question 1?
See the first answer.
Question 4 : How can i play more with Linux/Unix? You all might be having more cool ideas?
Depends on what you mean by "play". Since Linux is open-source you could pretty much do anything from writing your own TCP/IP or USB stack to writing a window manager (like X).
but then again, why would you? Just to learn, sure. But there are better ways to do so (write your own text editor/web browser/etc.)
Re: How to build an OS from Linux Kernel?
Posted: Fri Aug 21, 2015 4:30 am
by bace
FusT wrote:Question 1 :Can i build a basic OS using Linux kernel? It definitely must be possible, but where to start in a simple way? How much work it will take? Motto is just to build a simple OS which should boot and hold text files and rename/copy/move/edit is allowed with no directory structure. Is this the minimum i can think to start a small project?
The linux kernel
is an OS, you would be building your own Linux
distro.
Actually, the Linux kernel is just a kernel. Only when you pair it with something like GNU you get an OS.
Re: How to build an OS from Linux Kernel?
Posted: Fri Aug 21, 2015 4:53 am
by iansjack
FusT wrote:The linux kernel is an OS, you would be building your own Linux distro.
A kernel is rarely an operating system all by itself. For example, a micro-kernel relies on several user programs as well as the kernel itself. Even the Linux kernel relies strongly on modules which are added on to the kernel. And any reasonable interpretation of the term "operating system" would include at least those basic utilities necessary to get the system running and communicate with the outside world.
Re: How to build an OS from Linux Kernel?
Posted: Fri Aug 21, 2015 3:53 pm
by Schol-R-LEA
I am not entirely certain if your goal is to write an operating system that uses the Linux kernel as its kernel but with a different user interface, file system, et. al., or if you are looking to develop a different OS from the ground up using Linux as your development platform. In the absence of more information, I will assume you mean the former.
To start with, I would recommend starting by reading the Beginner's Information pages in the
OSdev wiki, especially
Introduction,
Required Knowledge,
Beginner's Mistakes, and
How to Ask Questions. That will give your the foundation needed to understand the scope of an OS project, if nothing else.
From question 4, it sounds like you don't have Linux installed yet, and presumably you are using an existing Windows installation as your base system. Given that, I would say your best bet is to get a
virtualizer (I recommend VirtualBox) and create a virtual disk installation of the Linux distribution of your choice (you might try asking for advice on this if you don't have one in mind, but expect to get dozens of different opinions on the subject; I use Gentoo, with XFCE on one machine and Enlightenment on another, but YMMV). This will let you avoid re-partitioning your drive, and will make it easy to have several different installations in place.
If you are starting from a bare disk, I would recommend installing a hypervisor such as Xen instead, which will let you work with Windows and Linux on an equal footing.
I can't really give any more advice past this, not without more information from you at least. I hope this gives you a starting point, though.
Re: How to build an OS from Linux Kernel?
Posted: Mon Aug 24, 2015 3:47 am
by FusT
A kernel is rarely an operating system all by itself. For example, a micro-kernel relies on several user programs as well as the kernel itself. Even the Linux kernel relies strongly on modules which are added on to the kernel. And any reasonable interpretation of the term "operating system" would include at least those basic utilities necessary to get the system running and communicate with the outside world.
I stand corrected, excellent explanation.