Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is a question I recently asked in a comment at Slashdot. I didn't really get much of a response, so I decided I'd bring it to a place where I should have gone originally with it.

I'd like to put together a very fast booting Linux system, composed of just the bare minimum needed to be able to run something like BusyBox. I'm not one of those people who make a big deal out of boot times, I'm mainly interested from an academic point of view and am using this to try to learn a little more about how Linux works.

I've googled this topic and have found things like Linux From Scratch, but as far as I can tell these seem to have their own software on which you base whatever you're building. I was under the impression that all you need to boot is a file system, the Linux kernel, an initrd and then userland software for whatever you want to run. I've read that initrd isn't even needed if you compile SATA drivers into the kernel and maybe some other things. In fact I would say that another aim is to boot without using initrd at all, I only intend to use this on my computer for a bit of fun.

Are there any websites that contain a minimal list of things required to get Linux to boot?

  1. List item
share|improve this question

migrated from serverfault.com Jul 18 '09 at 13:58

This question came from our site for professional system and network administrators.

5 Answers 5

The DistroWatch site has a lot of linux distribution references.
You seem to be interested in a light-weight (less stuff loading) installation to study.
The DamnSmallLinux edition might be one choice.
However, I'd suggest you look up the distros.


To learn the Linux Bootup Process.
There is a good IBM DeveloperWorks article on the Linux Boot Process.
And, another presentation at Ubuntu Living: Understanding the Boot Process

share|improve this answer

For more information on the booting process of computers in general and linux in particular have a look at these posts by Gustavo Duartes-

How Computers Boot Up and The Kernel Boot Process

Though slightly out-of-date you could also grab a copy of "Understanding the Linux Kernel" to get a more inside glimpse at the kernel architecture including the boot process.

share|improve this answer

it's true that an initrd isn't needed if you compile in the HD drivers.

but it's more fun the other way, using just the kernel and initrd, no other volume.

I've done this with busybox a couple of times, either because it was a very small box and i wanted it to go without HD, for a storage cluster, where each node had 4 drives all for storage (PATA at the time, so it was hard to connect more than 4), i setup a PXE server to provide the kernel and initrd.

it's very fun and instructive.

share|improve this answer

you may want to take a look at embedded linux. This article at linuxdevices and the follow up articles are a good intro.

share|improve this answer

"...Linux to Boot" (you may need to clarify this - Linux can "boot" with no userland tools at all)

basic CLI: throw ash/dash/sh in /bin in an initramfs and set init=/bin/sh on the kernel command line

simple init.c to go to desktop from my experiment here: http://murga-linux.com/puppy/viewtopic.php?p=590822#590822

#include <unistd.h>
#include <sys/mount.h>
#include <stdlib.h>

//these could be functions but gcc complains less this way 
#define EGGSACK(a)  ({if((fork())==0) execvp(a[0],a);})

int main(int argc, char** argv) {
static char **X={ "Xvesa", "-screen", "800x600x16", "-nolisten", "tcp", "-tst", NULL }
EGGSACK(X);

mount("/proc", "/proc", "proc", MS_MGC_VAL, NULL);
mount("/sys", "/sys", "sys", MS_MGC_VAL, NULL);
mount("/dev", "/dev", "devtmpfs", MS_MGC_VAL, NULL);
mount( "/dev/pts", "/dev/pts", "devpts", MS_MGC_VAL, NULL ); 
putenv("PATH=/bin");
putenv("HOME=/");
putenv("TERM=rxvt");
putenv("PS1=# ");
putenv("SHELL=/bin/sh");
putenv("DISPLAY=:0");

static char **jwm={ "jwm", "-display", ":0", NULL }
EGGSACK(jwm);

while(1) sleep(1); /*keep init alive*/
}

Notes: /sys /proc and /devpts are not absolutely necessary unless you need mdev, top/ps and a terminal respectively. /dev should fall back to being mounted as dev instead of devtmpfs if you plan to use a static /dev tree (included at the link along with minimal .config and filesystem tarball to make our BUILTIN initramfs ) You should mostly only need to add stuff to the kernel you want to support and not remove much at all - that .config was a bare minimum to boot to an X environment with terminal emulator support. It may be more appropriate to exit cleanly instead of looping - I was trying to minimize resource usage, but a fork exec wait for jwm (or your favorite wm) and then an execvp of "sh" would be sufficient.

/*here is a macro for a fork exec wait */
#define EGGSACKWEIGHT(a) ({int s,p;if((p=fork())==0){execvp(a[0],a);}else{while(wait(&s)!= p);}})
share|improve this answer
    
FYI The file structure was based on Rob Landley's aboriginal linux (which is more command line oriented minimalism) but adapted to Puppy's static /dev and some self-adapted multicall binaries and init. Similar distros (usually "floppy") don't exactly explain the process and are missing the key elements. –  technosaurus Jul 25 '12 at 17:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.