Basic Setup: Booting into Ubuntu from uSD
If you want to create a uSD card so that your Beaglebone Black will boot into Ubuntu from it, you have two options:
- Follow the instructions given at elinux (as of July 2014, that would be in section 4.4.1). This is what I used to do, but for some reason, from early 2014 on the installation led to images that did not boot. I got stuck with the first three LEDs ON and no idea how to debug it. (I tried and tried, using various computers, uSD cards, card readers, and beaglebones. Very frustrating!)
- Follow the instructions given at armhf. These involve more manual steps, but on the plus side, you learn something. For some reaons, these instructions did not work for me in early 2013, but they do now
These are my notes for following option 2.
Download the files given here in the section Ubuntu. (As of July 2014, it's Ubuntu Trusty 14.04).
Follow the installation instructions for those files. (July 2014: Link
here).
The instructions assume some familiarity with Linux, such as knowing
where to use sudo
, and how to unmount stuff. That why I am replicating
the instructions below, filling in details on what I had to do to
prepare the uSD card using a 64bit Ubuntu 12.04 LTS machine.
Put your uSD into a card reader (I had a USB card reader), and plug the whole thing into a computer running linux (me: 64bit Ubuntu 12.04 LTS). Be sure to use a card that has nothing valuable on it - the following steps will erase everything on it.
Wait a bit until the card is automatically mounted, then see where it is by running
mount
If nothing that looks like your card shows up, do
ls /dev/sd*
For me, the card showed up as sdb
, with the partitions sdb1 and sdb2
being mounted. I unmounted those using
sudo umount sdb1
sudo umount sdb2
Partition the uSD card (for me: sdX
is /dev/sdb
):
sudo fdisk /dev/sdX
Initialize a new partition table by pressing: o
.
Make sure that it's empty: p
Create boot partition: n
(new), p
(primary), 1
(first partition),
press enter
(default first sector), +16M
(last sector).
Change parition type to FAT16: t
(type), e
(W95 FAT16(LBA)
Make partition bootable: a
, then 1
(that's a "one")
Create data parition: n
(new), p
(primary), 2
(second partition),
press enter
(default first sector), press enter
(defaul last
sector).
Check the partition table: p
Commit changes: w
Make sure the command runs through without errors. I had first forgotten to umount the uSD card, and had to run everything again after unmounting it.
Format the partitions
sudo mkfs.vfat /dev/sdX1
sudo mkfs.ext4 /dev/sdX2
The second command will take a few minutes to finish. Afterwards, change to the folder that contains the downloaded u-boot file and Ubuntu tar.xz file. Install u-boot on the first partition by running
mkdir boot
sudo mount /dev/sdX1 boot
tar xJvf bon-uboot.tar.xz -C boot
umount boot
Then install Ubuntu onto the data partition:
mkdir rootfs
sudo mount /dev/sdX2 rootfs
tar xJvf ubuntu-trusty-14.04-rootfs-3.14.4.1-bone-armhf.com.tar.xz -C rootfs
umount rootfs
Now the image is ready to boot. Pop the uSD into the BeagleBone and boot it up. For me this did not work - the BeagleBone displayed 4 solid lights and stopped booting. I had to remove the power, hold down the user/boot button (button on top, near the uSD slot), and apply power again. I kept the button pressed until all LEDs lid up, then let go. Finally the BeagleBone booted and I saw the familiar heartbeat pattern on LED2.
I asked the armhf guy what to change so that I don't have to press the user/boot button every time I start the BeagleBone, and the reply came almost immediately: The trick is to replace (on the first partition of the uSD card) the file uEnv.txt with the following file:
optargs=fixrtc
loadfdt=ext4load mmc ${mmcdev}:2 ${fdtaddr} /boot/dtbs/${fdtfile}
loaduimage=mw.l 4804c134 fe1fffff; if ext4load mmc 0:2 ${loadaddr} /boot/zImage; then mw.l 4804c194 01200000; echo Booting from external microSD...; setenv mmcdev 0; else setenv mmcdev 1; if test $mmc0 = 1; then setenv mmcroot /dev/mmcblk1p2 rw; fi; ext4load mmc 1:2 ${loadaddr} /boot/zImage && mw.l 4804c194 00c00000; echo Booting from internal eMMC...; fi
mmcboot=run mmcargs; bootz ${loadaddr} - ${fdtaddr}
uenvcmd=i2c mw 0x24 1 0x3e; run findfdt; if test $board_name = A335BNLT; then setenv mmcdev 1; mmc dev ${mmcdev}; if mmc rescan; then setenv mmc1 1; else setenv mmc1 0; fi; fi; setenv mmcdev 0; mmc dev ${mmcdev}; if mmc rescan; then setenv mmc0 1; else setenv mmc0 0; fi; run loaduimage && run loadfdt && run mmcboot
The file looks quite different from the original, and I can only guess what goes on inside it. But it works!
I plugged the BeagleBone into my network and checked my router (FritBox) for new IP-adresses. Using PuTTy, I logged in via ssh using username ubuntu, password ubuntu. Success!