[clue] Speaker for 12 March.

David L. Anselmi anselmi at anselmi.us
Thu Mar 14 19:57:04 MDT 2013


David L. Anselmi wrote:
>
> If no one has any better ideas I'll talk about debootstrapping a Raspbian image.

So.  No better ideas showed up and the 4 of us who did talked about debootstrap and the Pi.

I was able to show the Pi to 2 people who hadn't seen one.  I was also able to show them the case I 
got that I like very much.  And it worked fine with the class 4, Microcenter brand, 4GB SD card.

Chris provided an HDMI cable and keyboard so we could use the Pi without SSH.  He also showed us 
http://www.openelec.tv/ (though we didn't have anything to watch), which is cool if your into Apple 
TV and stuff like that.  With a Pi you get about the same features Free, for about $50.  And it's 
said to Just Work(TM).

On the "make your own minimal image that you can add on to from there" front, I followed the 
directions at http://wrttn.in/59e640 to make a minimal image that booted.  I was particularly 
impressed to learn that qemu will run ARM binaries in a chroot on amd64 without all the VM overhead 
I've associated with qemu/kvm.  Very cool.  The gems of this exercise are: fallocate, kpartx, and 
qemu-arm-static (though I have no idea how chroot knows about the last).


Now the disappointing part of that page is step 4.  "...the only thing remaining is to create a .img 
file..."  What?!  That's half the reason I came here, buddy!

So I figured that part out for myself.  In reverse order:

The .img file is a 2GB (for Raspbian) file to dd onto your SD card (via the device node that udev 
gives it).

You put build and configure the image on any old Linux box using cp, qemu, git, debootstrap, et. 
al., (also in reverse order).

The files will go in e.g., /mnt/boot (FAT) and /mnt (ext4) (do you sense a trend developing?)  They 
are mounted using loop devices created automagically from the .img file using kpartx.  That's a 
slick tool.

Inside the image are: an ext4 partition to the end of the disk, a 56MB FAT partition, and a DOS 
partition table (but probably not MBR).  Use mkfs.ext4, mkfs.vfat, foo, and fdisk.  (The order 
continues for both the tools and contents.  But actually kpartx is run at the foo and not, as 
implied, above.)

To make the .img file use fallocate.  It is much faster at creating blank files than dd 
if=/dev/zero... (though in this case "blank" means "meaningless" rather than "filled with zeros"). 
Another slick tool, fallocate requires ext4 so as a bonus I got to learn how to convert ext3 to ext4.

So there you have it.  Build your system in an image file you create beforehand, rather than copying 
a directory tree after you partitioned your SD card.  Really, you don't need to create a .img file 
as implied by step 4 but it's more fun that way.

Apologies if my sequencing made this difficult for anyone.  It was more fun to write that way, at least.

Dave


More information about the clue mailing list