[SOLVED] Where to get completely minimal Linux image (kernel and Busybox only)?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Where to get completely minimal Linux image (kernel and Busybox only)?
I want to build a completely customized Linux that will only run a single program from the command line as fast as possible. I know that for this I need a minimum of the kernel and a shell, and an init script. I have found several tutorials on how to compile such a system from scratch, but they are all several years old and require some things I can't do (for example, installing legacy Grub or using virtualization [I have an Atom processor without virtualization]). Is there somewhere where I can either download such an image or an up-to-date tutorial which doesn't require a virtual machine?
For such purposes I use the mkinitrd command from Slackware (I don't know if it is available for other distributions). If gives you a minimal filesystem tree with Busybox than can easily be customized. After modifying it to my needs I just give the path to the tree as option for initramfs in the kernel config and build the kernel. That way I end up with a kernel with integrated minimal Linux system modifyed to my needs.
I want to build a completely customized Linux that will only run a single program from the command line as fast as possible. I know that for this I need a minimum of the kernel and a shell, and an init script. I have found several tutorials on how to compile such a system from scratch, but they are all several years old and require some things I can't do (for example, installing legacy Grub or using virtualization [I have an Atom processor without virtualization]). Is there somewhere where I can either download such an image or an up-to-date tutorial which doesn't require a virtual machine?
Actually, for that you only need the single program, the libraries that it requires, the kernel, and probably a bootloader. The program can be the init program, as long as the bootloader has installed an adequate root filesystem from an initrd. You can build the root filesystem as an initrd, and include your program in it. It would simplify matters if can be statically linked.
Note that this one is not truly minimal, but it is designed to be small, and it is built so that it can be made considerably smaller.
You could also theoretically start with http://linuxfromscratch.org and use these methods to construct an absolutely minimal system that is, say, customized to work on a particular hardware platform.
I once used techniques similar to these to construct a Linux platform for running a legacy DOS application in an environment that it couldn't tell from "the real thing," but which enabled the supplier to connect using SSH and perform maintenance without, in this case, shutting down the air-conditioning system of an office building or causing it to go on standby. To the end user, it appeared to be the same DOS app that they had always had, except that it could run on more modern hardware and (unbeknownst to them ...) serviced remotely.
Last edited by sundialsvcs; 03-02-2012 at 12:35 PM.
I've found TinyCore Linux to be a good basis for a minimal system. Even there, there is plenty that can be removed for a truly minimal system, but their startup scripting is easy to follow and customize.
--- rod.
Linux from scratch may be my choice. You build your system exactly to the target with only the drivers needed and only the settings for your task. Gentoo used to be pretty basic and still may suit your needs.
The atom will run qemu OK for this task to build it.
I still like Toms boot floppy. Most of the servers are down but it was the most linux on a floppy.
Note that this one is not truly minimal, but it is designed to be small, and it is built so that it can be made considerably smaller.
You could also theoretically start with http://linuxfromscratch.org and use these methods to construct an absolutely minimal system that is, say, customized to work on a particular hardware platform.
I once used techniques similar to these to construct a Linux platform for running a legacy DOS application in an environment that it couldn't tell from "the real thing," but which enabled the supplier to connect using SSH and perform maintenance without, in this case, shutting down the air-conditioning system of an office building or causing it to go on standby. To the end user, it appeared to be the same DOS app that they had always had, except that it could run on more modern hardware and (unbeknownst to them ...) serviced remotely.
I looked at DSL, but it is a pretty full distro - not minimal, but small, with an awful lot of applications that I don't need.
Quote:
Originally Posted by theNbomr
I've found TinyCore Linux to be a good basis for a minimal system. Even there, there is plenty that can be removed for a truly minimal system, but their startup scripting is easy to follow and customize.
--- rod.
TinyCore seems nice, but it is designed as a livecd and doesn't seem to be runnable as a standard Linux (even the "install" requires it to decompress the entire filesystem at boot, which is not what I want).
Quote:
Originally Posted by jefro
Linux from scratch may be my choice. You build your system exactly to the target with only the drivers needed and only the settings for your task. Gentoo used to be pretty basic and still may suit your needs.
The atom will run qemu OK for this task to build it.
I still like Toms boot floppy. Most of the servers are down but it was the most linux on a floppy.
I had hoped to not have to compile an entire kernel, but that may work better for me. I downloaded Tom's Root Boot, but I can't figure out how to run it without a floppy drive. Even VirtualBox on my home server won't let me, as it complains the second disk is "not a valid floppy disk".
There is no reason TinyCore can't be made to run from a conventional disk. I use a heavily customized version of it that boots from a PXE server and runs completely diskless. Decompressing a root filesystem at boot time is routine; compressed init RAM disks do that all the time. I daresay that uncompressed initrd's would be unusual.
--- rod.
The file I have is tomsrtbt.raw I used it as a floppy in qemu so I know it works. It is a actually a bit larger than the 1.44 at 1.72. It was the old 2.88 on a 1.44 deal. You have some error in the file. It shouldn't ask for any second disk.
To get tom's on a disk it may take a bit of work. You'd have to copy the floppy to a hard drive image maybe and add in lilo. The data is sound though. To get it on a cd may be easier. Might even work as copy image to track 1 of a cd.
Might see also zool5, another old floppy.
Tinycore seems to have a good following and I know it does work also.
Even if you have an atom you can if you want make a flash install of some build environment to run it on. I think lilo would be faster than grub but you don't need to install that. You may have to add it to a hard drive image later or by manual add to install.
It might helpful here to know what you presently have and where you want to get. It sounds like you intend to build a Linux package that installs on some dedicated host, and I will guess that said host is somehow resource constrained. Is it your intention to create some kind of distro-like package, or simply to get one or a few systems configured to your requirements? It is a lot easier to craft a custom system by using the resources of a larger existing system than to try to use the target host as the development host all at once.
It is quite feasible to use a full-on desktop host to manipulate a secondary hard disk by partitioning it, installing a bootloader, and installing the kernel and root filesystem, all done as separate phases of the composition. You can, for instance, 'install' grub legacy on the development host, and use it to load the bootloader on the target disk ('install' doesn't mean loading a new bootloader on the development host, in this context). You can use the usual filesystem tools to configure the target disk with partitions and filesystems ('format' the drive). Then it is a matter of copying the kernel and initrd to the target disk, transfer the disk to its target host, and boot.
It might helpful here to know what you presently have and where you want to get. It sounds like you intend to build a Linux package that installs on some dedicated host, and I will guess that said host is somehow resource constrained. Is it your intention to create some kind of distro-like package, or simply to get one or a few systems configured to your requirements? It is a lot easier to craft a custom system by using the resources of a larger existing system than to try to use the target host as the development host all at once.
It is quite feasible to use a full-on desktop host to manipulate a secondary hard disk by partitioning it, installing a bootloader, and installing the kernel and root filesystem, all done as separate phases of the composition. You can, for instance, 'install' grub legacy on the development host, and use it to load the bootloader on the target disk ('install' doesn't mean loading a new bootloader on the development host, in this context). You can use the usual filesystem tools to configure the target disk with partitions and filesystems ('format' the drive). Then it is a matter of copying the kernel and initrd to the target disk, transfer the disk to its target host, and boot.
--- rod.
Actually, my goal was to see how fast I could get Linux to boot (with no extra programs). As I did not fully understand initrds I figured the fastest way to boot would be to load the kernel which would mount the filesystem and start busybox; however, I did manage to work through a tutorial and build my own initrd, with which I boot to busybox in about 3 seconds (unrelated - does anyone know how to get uptime to report seconds?)
For those interested, here is the image (using an Ubuntu kernel): http://www.mediafire.com/?bynpi52jlc1op1n I ended up just moving everything to a hard disk partition and booting with Grub2. There are two initrds; the initrd.img2 is uncompressed, whereas initrd.img is gzip2'd. I can't tell much difference in speed between them, and I don't really have a good way to measure it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.