Let's Make Robots!

Raspberry Pi is not a pc :) And neither does BBB or Olinuxino

Hi all!

OK so this is not a rant or maybe it is but here we go. 

Raspberry PI is not your common PC (and this applies to all little ARM based boards popping up lately).

Try running a fullfleged linux distro on it and it will crawl to a slow moving beast, and by fullfleged Linux distro I do mean all those things like Raspbian, Archlinuxarm etc. These things are just normal distros recompiled for ARM.

What I mean by this is that they still use the exact same components as the X86 counterparts. Maybe Arch is more lightweight in the beginning but once you start adding stuff it get's bigger due to dependencies that no one really optimizes for an embedded system. 

Here is an example which probably applyes to all of them:

- you want to install Midnight Commander for example 

- you do apt-get or pacman ... install mc 

- it starts pulling dependencies in as mc is compiled with all the options enabled

- so you probaly get slang, ncurses, Xlibs and some others depending on the distro 

Bottom line: these libs take space on you SD card, and more so they eat precious memory *you just don't have!* ... nevermind the time it takes to read the libraries from the SD into the memory when starting up a program that actually needs them.

Bottom line 2: All these Linux distros are compiled against the huge thing called libc which is the C library used by most Linux programs. This in turn eats you precious memory and adds slowness to the system.

So given the things above how would you imagine they manage to get Linux running on all those devices like routers with 16 - 32 Mb of RAM and 4 Mb of storage, on those so called smart TV's?

Well long before the Pi was even tought of, people needed to be able to run the kernel and a very light user space on things so developers came up with some very cool projects:

First was uClibc http://www.uclibc.org/ which is a very small C libary that kind of emulates the good old libc used on bigger systems. Nowadays most POSIX compliant Linux software can be compiled against it ... yes even the huge thing called WebKit.

Second they needed userspace utils like bash so they decided to create busybox http://busybox.net/ which is a one binary to rule them all type of thing ... So you get lots of things like sh, ls, mount ... etc out of one single binary :) Cool right? 

Once the two above were done they basically could build up a pretty functional but basic Linux distro that would need very low storage space ... think of about 4Mb with all bells and whistles :D

Of course in order to run your own cool special program on it you would need to create the root filesystem image from scratch, get your source to compile against uclibc, and integrate all of it.

So the uclibc and busybox guys decided they need something that would allow this to be done in a nicer way so they developed a set of scripts called Buildroot http://buildroot.uclibc.org/ . Now this is the real cool stuff :) 

Buildroot makes use of bothe uclibc and busybox to allow *you* user to create your own little Linux distro. It allows you to add just the thing you need, select the init system you think you need, select the kernel you want. YOU are the master.

Now back to the Pi some guys are really at hard work creating custom Buildroot trees for Pi in special and here are two github repos I used so far:

https://github.com/nezticle/RaspberryPi-BuildRoot 

https://github.com/gamaral/rpi-buildroot    

I would recommend to start up with the first as it does not need to compile the whole toolchain it just uses a precompiled one from Linaro so it saves you some time. 

I will  not go into details on how to use buildroot to build your distro as it does require lots of experience and both of the links above have instructions on how to use them, but just to give you an idea both the systems running on the tank and on the geekbell I posted here are build in this way.

The tank sytem runs in about 25Mb of RAM and uses about 200Mb of storage whithout any clean up. It boots in under 30 seconds to SSH prompt. Now compare that to Raspbian ;)

But it all comes at a cost:

- there is no package manger - you need to add something new - recompile, reflash SD

- the init system (whatever of them you decide on) is very basic - so for some stuff you need to add your own init scripts

- wifi is a pain - there is no clever script to help you out configuring it it''s all done manually with wpa_supplicant or write your own clever script

- and probably more stuff I can't see because I'm used to it :) 

So this is what Embedded Linux is all about and if you ask me this is what should be used on those boards in the end.

Just wanted to share another way to do it ... have fun hacking :)  

  

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

If an RPI or Beagle is not powerful enough you can buy some powerful sbc's these days. AMD sells this http://www.gizmosphere.org/why-gizmo/gizmoboard/#specs Dual core 1GHz dual core X86 cpu with GPU, 1GB ram ...

... now you bring the big guns:P

I am interested in trying this one day. Just haven't had the time. Running raspbian right now (got an SD preloaded when I got the pi)

 

 

 

Huh?  I'm too ignorant for this.

 

 

 

 

 

Remember than Linux and windows both (and Macs and Unix before them ) used to run GUIs on MUCH smaller machines.  If you don't want all the features of a full-blown modern GUI, it can be extremely small by modern standards.  When it is customized to one particular machine or a very small class of machines, that helps a lot.  Take a look at this:

http://www.damnsmalllinux.org/

 

I know of them and some more like Puppylinux and others. But as a long time Linux dude I can't just be happy with things that just work :) Whithout my tinkering in there it's just less fun I guess.

You say buildroot runs under say 30Mb of space. I have a very low end ARM based Android smartphone which has just 200Mb of internal storage. Out of that, the Gingerbread Android OS just takes up 90Mb. I know this because I've linked up pretty much everything else (All application files (.apk), dalvik-cache files(.dex) and library files(.lib)) to my SD card on my phone (Link2SD) using an ext3 partition on my SD card. So how come Android is able to provide a sleek UI in just 60 more Mb of space and run so smoothly? My hardware is by no means good. I have a 800MHz processor and 256Mb RAM. I have the Samsung Touchwiz UI.

200Mb of storage.

Android is a linux kernel with a very light weight userspace. On top they have the framework which is java based and runs on the framebuffer.

 

 

I don't think most people consider the implications of all that stuff they have loaded.  To build an embedded system it needs to be customized, and the projects you mentioned do a very good job with a lot less pain than the "old" way.  But even buildroot can be painful.  But I suppose that's why they call it embedded "development"