Prepare a bootable SD card to run Balsa

From LSDevLinux
Revision as of 13:28, 14 October 2010 by Mayhewn (talk | contribs) (Adjust categories)

Jump to: navigation, search


This set of instructions tells you how to install a Balsa Prototype onto a SD card.

The Balsa build finishes with the set of Balsa files in a bzip2 tarball in the .../balsa-results/build directory. Alternately, you can download a Balsa tarball and store it in that directory. These are instructions for decompressing the tarball and loading the files onto an SD card. The goal is to build an SD card that will boot to Balsa. Balsa currently requires a 4 Gig or larger SD card.

These steps must be done on a Linux computer, or a computer booted from a Linux Live CD, and the user must have access to sudo privileges.

In the case of preparing multiple SD cards to run Balsa, Steps 1 and 2 below only need to be performed once.

The Procedure

Step 1: Build or download a Balsa Tarball

See the Balsa Prototype instructions to build a Balsa system from scratch (IT technicians only).

Or download the current Balsa tarball from the link on Balsa Jaunty download. The commands in Step 2 below assume that the tarball is in the same directory it would be in if you had built it. To put it in that directory do this:

  1. open a terminal
  2. create the subdirectory (if it doesn't already exist) with this command:
mkdir -p balsa-results/build

Follow the instructions on Balsa Jaunty download to zsync the downloaded tarball into the directory you've just made: ~/balsa-results/build/[balsa-filename].tbz2. (Or substitute your own path/directory).

Step 2: Decompress the Balsa tarball

This step decompresses the Balsa tarball into an intermediate directory. The intermediate directory must be on a Linux filesystem (e.g. ext2 or ext3; not FAT or NTFS). The code below assumes that the intermediate directory is named balsa-card and is a sibling directory to the balsa-results directory. If you want to put it elsewhere, replace balsa-card and ../balsa-results/build/ with a paths/directories of your choice.

Open a terminal and use the cd command to set the current directory to the parent of the balsa-results directory you made in Step 1. Run these commands:


This command (print working directory) will display the name of the directory you are in. To make sure it's the right one, run the list command:


You should see a list of directories and files, including balsa-results and perhaps balsa-card (if you've done this before).

The next command (remove) deletes any old intermediate card images that may exist. You may skip this step if you do not find balsa-card in the same list as balsa-results. This command will produce an error message if balsa-card is not there; you may ignore the message.

sudo rm -rf balsa-card

We will now remake a new intermediate image.

mkdir balsa-card
sudo chown root:root balsa-card
cd balsa-card
sudo tar --numeric-owner -xpjf ../balsa-results/build/latest.tbz2

If you have built your own Balsa image using balsa-builder, the tarball will be named latest.tbz2. If you have downloaded a tarball substitute the correct filename as in Step 1 [balsa-filename].tbz2.

Step 3: Initialize the SD card

  • If the SD card has a Balsa build (from August 2010 or more recent) on it already, this step can be omitted. You can tell if this is the case if you're using Ubuntu: When you insert the card into the computer it opens a File Manager. If the name of the card, on the left-hand pane, is BalsaRoot you may skip to Step 4.

You will need a Linux system with gparted installed that can read a SD card.

WARNING!! gparted is a partition editor. It is a powerful and dangerous tool. If you don't know what a partition is, you shouldn't be doing this. Read the instructions below and understand them. Follow them closely.

  1. This procedure will destroy all the data on the SD card. Back up any data on it you want to keep.
  2. Plug in the SD card.
  3. Start gparted. You will see a screen that looks like this:
  4. You can get a list of the devices by clicking in the gparted device window (Red Circle 1). Alternatively, click on the GParted menu, then select Devices. Select the SD card from the list.
  5. In the menu, select View | Device Information and make sure that you're working on the right device. (Blue Circle 2)
  6. Click on the mounted partition. (Green Circle 3)
  7. In the menu, select Partition | Unmount
  8. If there is more than 1 partition on the SD card, use the previous two instructions to unmount them all.
The next command cannot be undone. Make sure you are working on the right device.
  1. In the menu, select Device | Create Partition Table.
    By default, gparted will make an msdos partition table. This is correct. Click the Create button.
  2. gparted will return with the SD card completely unallocated.
  3. Click on the unallocated area (the same place the partition used to be).
  4. In the menu, select Partition | Create New Partition. You will see this dialogue box. Fill it out as specified below:
    Create as: Primary Partition (Red Circle 1)
    File System: ext3 (Blue Circle 2)
    Label: BalsaRoot (Green Circle 3)
  5. Click on the Add button.
  6. The main gparted screen will come back. It won't create the partition until you click the green check mark (Red Circle below)
  7. gparted will create the partition with an empty file system. Close gparted.
  8. When you mount the SD in your file browser '"`UNIQ--toggledisplay-00000000-QINU`"', it should look like this:

Step 4: copy/update the Balsa build onto the SD card

With the BalsaRoot SD card mounted, in a terminal window use the cd command to go into to the balsa-card directory you created in step 2.

The following commands assume that the SD card is mounted as /media/BalsaRoot. If it's not, replace /media/BalsaRoot in the next command with the mount point from your system.

sudo rsync --delete -axHAX ./ /media/BalsaRoot

If you want to monitor the progress of the rsync replace the last command above with:

sudo rsync --delete -axHAX --progress ./ /media/BalsaRoot

When the rsync operation is finished, Unmount the SD card with this command:

sudo umount /media/BalsaRoot

The card, labeled BalsaRoot, now contains a working Balsa image.

Boot into Balsa and configure it for a language project

Follow the steps here Install and use Balsa

and then here: Configure Balsa programs and applications

To do