Monday, March 28, 2011

Computer Engineering

Though I walk through the valley of the shadow of hardware,
I shall fear no kernel.

And, y'know, I'll pwn the invading recognizers in hardware.

Saturday, March 12, 2011

I have amazing friends.

I'm grateful.

Linaro Start Line

So, for work I've been asked to get a hang of the Linaro (www.linaro.org) toolchain.

What the heck does that mean?

More importantly, how can they reorganize their website so one can rapidly get started?

Well, first off, Understand who they are. Get on their IRC channel and ask questions--especially about where to find information.

See, I'm to do some kernel work, so I need to cross compile things. I need a full operating system to drop them in. Every time I try to Google or navigate their pages to find the processes I just read about so clearly, I get confused.

Thus I'm posting a tentative index to the learning curve pages.

Linaro is a set of programs that make it easy to build a ground-up ARM-based system. Presently Angstrom and Ubuntu (and one other?) have prebuilt images made with the toolchain.

I found that the best place to start is an impossible-to-find wiki page that links to several of the many HowTo articles available elsewhere on the site:
https://wiki.linaro.org/Mentoring/HowTo

Process to install an image:
Get an OS-specific image (a pain, more on this later)
Get a hardware-specific "hardware pack" (Not so hard...I think)
Run "linaro-image-create" with a slew of (well documented) arguments (more on linaro-image-create in a moment)
Plug in card
Boot

This "linaro-image-create" tool has a forest of voodoo behind it, most of which is designed to be hidden. This, of course, means it has some dependencies. If you're running any of the supported boards (run it with only certain arguments and it'll dump a list), it's a matter of enabling the PPAs (more on that later) and installing two packages, gcc-gnueabi-*? and linaro-image-tools. I think. I'm doing this on my machine as we speak.

OK. So I need to find the images. This has been a pain. The "Images" link on the page above isn't helpful.

AHA!

So, from Mentoring/HowTo, go to "Booting Hardware with Linaro Tools." I have a Gumstix Overo board, so that's what I followed from there. (Note the link down below to generic instructions for linaro-media-create.)

Here is where we install linaro-image-create. Follow the instructions at "https://wiki.linaro.org/Boards/Overo/Setup". (This page is rendered partially redundant by this wiki page, but valuable things are said here if you're running any Ubuntu 10.10 or earlier.)

This next part takes a touch of magic for me, as I'm running Ubuntu 10.10. See, the linaro-image-create that is in the PPA is too old to support Overo boards. (This won't be the case in Ubuntu 11.04 come April or May.) This means I need the bleeding edge build of linaro-media-create. (4.3 worked fine for me.)

Bleeding edge comes with a price: Dependency Hell. No matter what we do to shrink it, this special place will forever haunt those who strive to wander far from the well-trodden paths of software usage. I kinda like it sometimes--it's a big puzzle game.

In our case, the README that comes with linaro-media-create specifies two dependencies that can't be satisfied by Ubuntu 10.10:
python-debian >= 0.1.16ubuntu1
qemu-kvm-extras-static >= 0.13.0

I found it trivial to find the prerelease package of python-debian of a high enough version and get it installed. (http://launchpadlibrarian.net/49675715/python-debian_0.1.16ubuntu1_all.deb) (note that I did this AFTER installing linaro-image-tools the ordinary way, thus establishing its dependencies.)

qemu-kvm-extras-static is another ball game. See, it doesn't actually exist in 11.04. The tinyurl addresses provided give you small 7kB packages that install seamlessly but do nothing. (They are meta packages that will make the upgrade smooth, but this idea breaks when we pull single .deb's at a time.) At the time of this writing, the package you need is actually qemu-user-static, 0.14 or newer. Without this step it will crash saying that certain instructions are not understood by the emulator.

Once you find THAT (wget http://launchpadlibrarian.net/65940960/qemu-user-static_0.14.50-2011.03-1-0ubuntu1_i386.deb), however, invoking linaro-media-create from the place it was untarred to should work.

You'll notice that the syntax of linaro-media-create is fairly straightforward, yet fairly involved. (I used "sudo ./linaro-image-tools-0.4.3/linaro-media-create --mmc /dev/sdf --hwpack hwpack_linaro-overo_20110202-0_armel_supported.tar.gz --dev overo --binary linaro-natty-headless-tar-20110203-1.tar.gz") It requires two files be handy: the system image and the hardware pack. The Overo/Setup page hard-codes some possibly outdated images into their command lines. Here is how to find your image:

Go to https://wiki.linaro.org/Releases#Obtaining%2520and%2520Testing%2520Linaro%2520Images
Scroll down. Some structural details are located here that are nice to read, but we're looking for the headers "Evaluation Builds" and "Developer Builds." (Here GUI/no GUI and system size are required decisions.)

Aw Crapola. It seems at the time of this writing that these links link fine...but the pages they link to are blank. Lovely.

I pulled mine from
http://releases.linaro.org/platform/linaro-m/hwpacks/final/hwpack_linaro-omap3_20101109-1_armel_supported
and
http://releases.linaro.org/platform/linaro-n/headless/alpha-2/linaro-natty-headless-tar-20110203-1.tar.gz
per my decisions earlier. (Use the root URLs to find the latest and greatest of these.)
I'm not sure why mine worked with the hwpack a different version from the build.



Plug in the card you just made and try to boot.

I have yet to need the "sleep hack" or to encounter the bug listed here: "https://bugs.launchpad.net/linaro/+bug/728734?comments=all".

TODO: prettify and integrate with wiki.