BeagleBone for ALSA & jackd

Michael Conrad mconrad at intellitree.com
Thu Oct 25 17:20:50 UTC 2012


On 10/24/2012 8:53 AM, Grant wrote:
>>> I would like to build as minimal of a system as possible on a
>>> BeagleBone.  I only need ALSA and jackd to work.  Would this work well
>>> with busybox?  I'm very familiar with Gentoo but a system like this
>>> would be set up entirely outside of the Gentoo framework?
>>>
>> Gentoo makes for a great system to create lightweight builds.  You can build
>> a minimal build with something like:
>>
>>      ROOT=/tmp/somewhere emerge -v baselayout uclibc busybox
>>
>> The details are slightly more complex, eg I tend to use a uclibc based
>> chroot with hardened compiler, etc, you will need a cross compiler setup,
>> but very roughly that's about all you need...
> I already have Gentoo on an SD card running on the BeagleBone so I
> wouldn't need a cross compiler.  Could I do the above, copy
> /tmp/somewhere to / on another SD card, set up /boot, and boot?  It
> couldn't be so easy.... :)

Well, this is on the verge of being more appropriate for the Gentoo 
forums, but I figured I'd mention my technique for building my 
busybox-based car computer.

Start by building busybox (statically linked), and building a system 
image consisting of a standard directory tree, a bunch of busybox 
hardlinks, and a small handfull of files in /etc.  Find any Linux that 
runs on your target platform.  Steal their kernel. (and needed modules)  
Make it boot.  (have to write your own init scripts.  I suggest "runit" 
since it's built into busybox, but perp and s6 are also nice)

You now have a bootable Linux system in the ballpark of 4MB.

Get a Gentoo stage-3 image for your platform.  For best results, put the 
stage-3 image on a nice file server and NFS-mount it onto the target 
platform.  (which is a little involved, but worth it, IMHO. This gives 
you an easy way to make backups and copies or even add it to version 
control.)  chroot into it and emerge all the packages you need.

(trying to do the same on x86 and cross-compiling will waste a bunch of 
your time and drive you slightly insane, unless you enjoy debugging 
autoconf scripts)

Once you have the chrooted Gentoo system behaving as you like, write a 
perl script that copies out *only* the files you need, (excluding 
binaries replaced by busybox) and place them into the mostly-empty 
system you created earlier.  Gentoo has the nice /var/db/pkg files to 
help you find all of a package's files.  Exclude packages like 
baselayout.  Then exclude some directories like /etc and 
/usr/share/doc.  (you want to very carefully craft your own /etc)

Then take the result and copy it to a USB stick, and boot off of it.

For bonus points, take the result and play the symlink-to-tmpfs game and 
then make the image a read-only squashfs image, and use that as the 
system root.

-Mike


More information about the busybox mailing list