Creating a custom live distro for a target appliance

242

After a long period of absence from the site I’m back with a lot of work done on custom embedded appliances and Linux custom live CD creation. This is the first article of an hopefully good series of topics related to custom CD/USB creation, but before entering into too much details on it I’d like to answer a common question about this: “why do you go there ?”

 

Motivation

Here is the short version:

  • I’d like to have a minimal system without too much software dependencies

  • It has to be really small and run on tailored devices with memory and CPU constraints

  • It’s not a desktop system, software and general requirements don’t change, no additional software installation is needed after initial startup

  • Startup configuration and installation has to be quick (no user interaction)

  • I’m a geek and I tend to revert/control everything I’ve around me

  • Because it’s fun and it’s nice to learn something

Here’s the long version:

  • I’d like to learn more from a live CD/USB creation

  • I’d like to have a small footprint installation

  • this appliance has to run without external user interaction, no administration needed or available for it; it has to be reliable and survive to: power losses, HD malfunction, general HW failures, bad usage or tough environment temperatures, holy bible plagues, …

  • the appliance has to be replaceable quickly, something like a swap with an identical device. Linux OS “boot media” has to be exchangeable and easily upgradeable by a common user without IT skills

  • It has to run completely on RAM (ram disk and configuration), if something goes wrong I’d like to “fix” my problems with just a reboot (restore factory defaults)

  • No video/console available, this device has: a power cable, an ethernet cable

  • low spec CPU power needed, I just need to run few apps on it (Samba and few more), I don’t need 1000 cores for basic things

  • Because it’s fun and it’s nice to learn something

 

Requirements

So you’re may wondering about what kind of task I’d like to achieve, it’s pretty simple: an home server NAS with just few custom constraints, here are:

  • Has to run from RAM (disk+memory) as previously reported, I don’t want to configure or modify my needs too quickly (after first installation)

  • It has to be cheap, at least until I don’t get enough money for a custom made ARM device, for the entire project I’ve spent 80$ / 60€

  • I pay my electricity bill so it has to adsorb less watts as possible (a pentium class device is not my choice for a 24/7 machine)

  • It has to have enough CPU power to sustain few CPU intensive jobs (asterisk, P2P programs, online UPnP video/audio decoding and streaming, samba), I’ve used MIPS/ARM devices for this particular task but even if they’re more appealing when you talk about power usage you’ve few troubles with CPU intensive tasks (UPnP, video/audio streaming or torrent for example)

  • I need USB ports

  • Hardware may fail, heat and dust are big problems, I’d like to have a machine without moving parts, I don’t want to use an HD for the Linux installation, I don’t want to have a fan over the CPU or the power supply, I’d like to rely on removable media so if there’s something wrong I may move my installation to a similar machine

  • Linux root system resides in an USB stick, it has to be read only and load the system on boot. USB sticks have an “infinite life” (a sort of) if you use them as read only devices, they’re even cheap and easily replaceable for an average user without IT skills

  • If you’ve an HW failure you may recover everything with just these swap parts: a standard ATX power supply, a similar mobo+cpu, a cheap usb stick

  • Linux installation in just 100Mb or maybe something more, I’ve a lot of 128Mb usb sticks to waste so I’ve cut my distro to stay around 100Mb

  • I’d like to attach an external USB drive with my own media (photo, films, music, …), this media is just read from “home clients” (read: media stations connected to TVs), sometimes someone (me) uploads contents on it or does entire backups of it

  • It has to be expandable easily: adding a web cam, a sound card, an Internet audio/video streaming with icecast should be possible without too much troubles

  • It has to be close to x86 architecture to be cheap, believe me: I’m an embedded specialist and I’d like to stay with ARM/MIPS devices when they’re available, I like to deal with toolchains and cross compile installations but my device has to be really cheap, it’s hard to beat the price I’ve mentioned

  • I don’t wanna waste too much time on it, it has to be ready as soon as possible

  • It’s not just a NAS, it’s an “home server”, I’ve web apps, Internet audio/video streams, files, UPnP (and more…) on it, I’ve used a lot of NAS-like distro but I’d like to have something more

 

 

Hardware

For this particular project I’ve chosen to use an ATOM CPU: single board, single core, desktop, no particular peripherals (I only need the USB bus and the ethernet card), no frills and damn cheap. There are plenty of them available everywhere, I’ve just chosen the cheaper one with USB ports and 1 Ethernet, overall cost: 80$ (you may find something cheaper across 50-60$)

 

The Plan (Plan 9 from outer space)

This is just an intro for a series of articles describing my own initial project, now I’ve expanded it to something else but at least I’d like to describe why I’m doing this and what kind of results I’d like to have, when I’ve started it I’ve wasted a lot of time on research (hw/sw) but now I’ve a more clear path to my own personal appliances. Here’s what I’ve did:

  • Building a minimal image
  • Trying to use a RAM disk

  • Run the entire distro from a RAM disk (so read only media)

  • Trim it to minimal memory (user memory) consumption, XOrg is not needed

  • Packaged and automated it (some scripting)

  • Build the installation media (my USB stick)

 

Follow all these chapters to read the entire post

 

 

 

I’d like to interact with you and have your opinions as well, feel free to collaborate and discuss my own opinions, especially if they’re different from mine

 

Ben