6

I want to make a very minimal linux os which only have a terminal interface and basic commands/applications (busybox is my choice for commands/apps). I don't want the installation option on my os. I just want it to be booted and run completely from RAM. I'm planning to use ISO-Linux as bootloader. No networking, no virtualization support, no unnecessary drivers, etc. I want it to be very very basic os. I've downloaded the latest stable kernel (v4.5) source code from kernel.org and the build environment ready.

My one more confusion is that does a kernel by default has any user interface (shell, terminal, ...) where i can type commands and see output?

0
9

Technically you can achieve this. Though, kernel do not have any built-in user-interface.

You need to follow steps as:

1. Create a initramfs with static busybox and nothing else.
This initramfs will have few necessary directories: like proc, sys, tmp, bin, usr, etc

2. Write a "/init" script, whose main job will be:
   a. mount the procfs,tmpfs and sysfs.
   b. Call busybox's udev i.e. mdev
   c. Install the busybox command onto virtual system by executing busybox install -s
   d. Calling /bin/sh

3. Source the initramfs directory while compiling the kernel. You can do so by flag: CONFIG_INITRAMFS_SOURCE

4. Compile your kernel.

5. Boot off this kernel and you will get the shell prompt with minimal things.

Though, I write above notes in a very formal way. You can fine tune it the way you desire.

UPDATE:

Follow this link for some guidelines.

2
  • Thanks @SHW ! I got the overall picture of what i've to do with the help of some sites and your answer. But as i mentioned, i've only a little knowledge about configuring & building a kernel. But no idea about creating initramfs/initrd and make it bootable. If you can share some more details about the process would be more helpful. If you want to suggest some sites which closely meet my requirements would also be fine (but not linuxfromscratch or similar kind of sites since those sites has a whole but useful process of building a standard linux distro). – Kesavamoorthi Mar 19 '16 at 9:56
  • Thanks a lot for the update! BTW any help/link for make it bootable using iso-linux or similar (easy, lightweight) bootloader? – Kesavamoorthi Mar 19 '16 at 11:13
0

If you have only minimal knowledge in building a kernel, you may want to investigate minimal distributions like CoreOS. Others (that I have not used myself) are Project Atomic, Snappy Ubuntu Core, RancherOS, Photon...

If your requirement is to run in RAM, there are minimalist rescue and/or LiveCD distributions or embedded distributions that could probably be adapted for your use (what is that use, BTW?) with less work than creating a distro from scratch.

2
  • I want to build it on my own. I've gone through many such minimal os (MicroCore or TinyCore, Trinux, Tiny SliTaz, etc.) from where i got the basic idea about what i need to do to achieve my goal. The use is nothing but experimenting :) – Kesavamoorthi Mar 19 '16 at 10:19
  • OK if your goal is learning, then @SHV's way seems good. – Law29 Mar 19 '16 at 16:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.