LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 03-02-2012, 10:39 AM   #1
skykooler
Member
 
Registered: Feb 2010
Distribution: Ubuntu
Posts: 90

Rep: Reputation: 17
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?
 
Old 03-02-2012, 10:57 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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.
 
1 members found this post helpful.
Old 03-02-2012, 11:38 AM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by skykooler View Post
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.

--- rod.
 
1 members found this post helpful.
Old 03-02-2012, 12:25 PM   #4
zk1234
4MLinux Maintainer
 
Registered: Oct 2010
Location: Poland
Distribution: 4MLinux, Slackware
Posts: 1,254

Rep: Reputation: 220Reputation: 220Reputation: 220
All releases of 4MLinux-core. The latest one:
http://freecode.com/projects/4mlinux/releases/342119

regards,
zk1234

Last edited by zk1234; 03-03-2012 at 01:59 AM.
 
1 members found this post helpful.
Old 03-02-2012, 12:31 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,649
Blog Entries: 4

Rep: Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934
Start with http://www.damnsmalllinux.org/

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.
 
Old 03-02-2012, 02:06 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 03-02-2012, 05:30 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
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.
 
1 members found this post helpful.
Old 03-02-2012, 05:42 PM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by jefro View Post
I still like Toms boot floppy. Most of the servers are down but it was the most linux on a floppy.
Assuming you mean Tom's Root Boot, I couldn't agree more, at least in the days when floppy drives actually existed....

--- rod.
 
1 members found this post helpful.
Old 03-05-2012, 09:34 AM   #9
skykooler
Member
 
Registered: Feb 2010
Distribution: Ubuntu
Posts: 90

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by zk1234
All releases of 4MLinux-core. The latest one:
http://freecode.com/projects/4mlinux/releases/342119
Thank you for that link! That looks very much like what I want!

Quote:
Originally Posted by sundialsvcs View Post
Start with http://www.damnsmalllinux.org/

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".
 
Old 03-05-2012, 02:03 PM   #10
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 03-05-2012, 04:24 PM   #11
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
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.

The lastest version of Linux From Scratch was out a few weeks ago I thought. http://www.linuxfromscratch.org/lfs/view/stable/ is the newest I know of.

There are some automated ways to build that too.


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.

Last edited by jefro; 03-05-2012 at 04:26 PM.
 
Old 03-05-2012, 07:03 PM   #12
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
1 members found this post helpful.
Old 03-06-2012, 09:36 AM   #13
skykooler
Member
 
Registered: Feb 2010
Distribution: Ubuntu
Posts: 90

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by theNbomr View Post
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.
 
Old 03-08-2012, 10:55 PM   #14
romagnolo
Member
 
Registered: Jul 2009
Location: Montaletto
Distribution: Debian GNU/Linux
Posts: 107

Rep: Reputation: 5
May I ask why you can't install Grub legacy? For sure, you can with the right workaround.
 
Old 03-09-2012, 11:53 AM   #15
skykooler
Member
 
Registered: Feb 2010
Distribution: Ubuntu
Posts: 90

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by romagnolo View Post
May I ask why you can't install Grub legacy? For sure, you can with the right workaround.
Well, I thought it conflicts with Burg/Grub2, although last time I checked was about a year ago.
 
  


Reply

Tags
busybox, minimal



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel image corrupted : Wrong Image Format for bootm command ERROR: can't get kernel blink182 Linux - Embedded & Single-board computer 0 05-13-2011 03:11 AM
minimal system to run ddd 3.3.1 on a 2.4.18 linux kernel powah Linux - Software 0 01-22-2007 03:32 PM
difference netween linux-image and kernel image? mariogarcia Linux - Software 2 06-19-2006 08:01 AM
Kernel-image renamed to linux-image? powadha Debian 2 08-02-2005 05:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration