Upgrade your BUG memory card
From BUG Wiki
Contents |
Precautions
If your BUG is running R1.2 or earlier, you'll need to follow the instructions on Upgrading BUG Kernel prior to upgrading your memory card. R1.3 of the BUG software stack is based on the Linux Kernel 2.6.24.4, while earlier versions used 2.6.19.2. The result of an incompatibility between your kernel, which resides in on-board flash, and the root file system, residing on the memory card, is that your BUG will not boot. If for some reason this has happened with your BUG, please drop into our IRC channel and we can work through it with you.
Overview
BUG ships with its GNU/Linux operating system on the memory card. The Bug Labs team is always working on updates and fixes and it's generally a good idea to keep up to date with the latest release. The latest root filesystem images are available on our website. We typically announce new updates on our blog and forums.
The steps on this page will guide you through upgrading the OS on the memory card. Currently there are three options, one for Linux users, another for Windows and OS X users that leverages a Linux Live CD, and a community contributed [Windows Tutorial].
Memory Card Flashing via Linux
These steps assume a good working knowedge of Linux and command-line skills, as well as a functional Linux desktop environment. Additionally, some way of mounting the SD or MMC card on your desktop or laptop computer is required. Some machines have built-in readers, if yours does not you will need an external card reader.
Connect (Mount) the MMC or SD device
From a terminal, as root or via sudo check to see that the card is mounted:
$ sudo fdisk -l ... Disk /dev/sdb: 513 MB, 513802240 bytes 32 heads, 32 sectors/track, 980 cylinders Units = cylinders of 1024 * 512 = 524288 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdb1 1 980 501744 6 FAT16 $
Now unmount the device to ensure that there are no corruptions:
$ umount /dev/sdb1
If you see another device name other than /dev/sdb1 then substitute that device name for sdb1 in the following steps.
Backing up existing data
This is an optional step. If you have data on your existing BUG you'll want to get it off before proceeding. To backup the entire image onto your desktop or laptop machine:
$ dd if=/dev/sdb1 of=/tmp/BUG_backup.ext3.bin
When this completes a file, /tmp/BUG_backup.ext3.bin will be created with the complete contents of the BUG memory card.
Download the BUG root filesystem
You can either use a web browser to navigate to our download page to download or download the image using wget from the command-line:
$ cd /tmp $ wget http://bugcommunity.com/downloads/files/bug-image-production-bug-R1.3-rootfs.ext3.bz2 ... Connecting to bugcommunity.com|64.145.49.107|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 30951438 (30M) [application/x-bzip2] Saving to: `bug-image-production-bug-R1.3-rootfs.ext3.bz2' 100%[=========================================================================================>] 30,951,438 270K/s in 1m 47s 2008-10-20 16:02:26 (281 KB/s) - `bug-image-production-bug-R1.3-rootfs.ext3.bz2' saved [30951438/30951438] $
Write the image to the Memory Card
Now we can use dd to write the partition image to the memory card:
$ tar xfjv bug-image-production-bug-R1.3-rootfs.ext3.bz2 bug-image-production-bug-R1.3-rootfs.ext3 $ sudo dd if=bug-image-production-bug-R1.3-rootfs.ext3 of=/dev/sdb1 242162+0 records in 242162+0 records out 123986944 bytes (124 MB) copied, 41.3869 s, 3.0 MB/s
Check the image and resize the partition
Now let's make sure everything went alright and resize the partition so it takes up all the available space on the memory card. If you want to create other paritions then you may want to avoid this step.
$ sudo fsck.ext3 /dev/sdb1 e2fsck 1.40.9 (27-Apr-2008) Filesystem did not have a UUID; generating one. Filesystem has feature flag(s) set, but is a revision 0 filesystem. Fix<y>? yes /dev/sdb1: clean, 5288/15240 files, 79041/121081 blocks
$ sudo resize2fs /dev/sdb1 resize2fs 1.40.9 (27-Apr-2008) Resizing the filesystem on /dev/sdb1 to 501744 (1k) blocks. The filesystem on /dev/sdb1 is now 501744 blocks long.
Boot BUG
Now remove the memory card from your computer and put it back into BUG. Turn it on and you should see the familiar BUG logo boot-up sequence. Note that when booting for the first time after a fresh install, the BUG boot-up takes several seconds longer.
Memory Card Flashing via a Linux LiveCD
The initial few sections here involve downloading, burning and booting a Linux live CD. The live CD will allow Windows and Mac OS X users (both Intel and PowerPC) to boot into a Linux environment in order to perform the tasks outlined below.
Please note: The live CD does NOT require the installation of Linux on your computer. It simply allows you to boot your computer from the CD, and run all of the commands (if you do it right) without affecting any of the data on your existing hard drive(s).
Existing Linux users can choose to follow all of these directions to boot from a live CD, or skip ahead to the #Download the BUG Rootfs section, below. Linux users who choose to skip ahead should gain root privileges via su or sudo at this time.
Requirements
- A Linux live CD such as the one from http://www.sysresccd.org/Download
- A CD burner and a blank CD
- Your BUG memory card with MMC or SD adapter
- An MMC or SD drive and appropriate USB cable
- Internet access
- Basic understanding of IP network configuration
Download a Live CD Image
Note: These instructions assume that you're using the live cd from System Rescue CD. It was chosen for this example because it is a fairly small download (compared to some of the other available live cds) and provides all of the functionality required for the task at hand. You can choose to use other bootable live cds if you prefer, as long as you are able to configure internet access from within their live environment, recognize and access your MMC or SD drive, and create an EXT3 filesystem with them.
- Download the latest version of the LiveCD from http://www.sysresccd.org/Download.
- Windows and Intel Mac owners should download the final stable version for x86 (i486-PC).
- Mac owners with the older, G4-based Macs should use the image listed as final stable version for PowerPC (Mac).
- Burn the CD image to disk.
- Windows users: If you do not have software to do this with, Alex Feinman's free ISO Recorder (http://isorecorder.alexfeinman.com/isorecorder.htm) should do the trick.
- Mac users: You should be able to use OS X's included Disk Utility app to burn the ISO image to CD.
Boot Your PC from the Live CD and Configure Networking
- Ensure that your MMC or SD card is NOT plugged in yet.
- Boot your computer from the CD you just created. Instead of your regular OS (Windows or OS X) loading, you should see the live cd's boot screen.
- Windows users: You may need to press the F12 key (or another special key on your keyboard, depending on make and model) to choose to boot the computer from CD rather than its internal hard drive.
- Mac users: You will need to hold down the C key on your keyboard while your Mac boots in order to force it to boot from CD.
- Once the live cd has fully booted, you will need to configure networking. In the System Rescue CD environment, you type:
net-setup eth0
- to configure networking. Other live cds may have different commands for this. For this example, we will assume you are using a wired network connection, and have only one network interface (Linux will see the first network interface as "eth0"). Wireless configuration is not covered within the scope of these directions.
- If you have a DHCP server in your network environment, you should be able to simply choose "Use DHCP to auto-detect my network settings".
Download the BUG Rootfs
Type:
cd ~ wget http://bugcommunity.com/downloads/files/bug-image-production-bug.ext3.bz2 bunzip2 bug-image-production-bug.ext3.bz2
Attaching Your MMC or SD Card
First, BEFORE YOU PLUG IN THE MMC DRIVE, type the command:
fdisk -l
and note its output.
Next, plug the drive in, wait a few moments, then type:
fdisk -l
again. This time, you should notice a difference in the output -- a new device should be detected. Often, this device will be named something like /dev/sdf. Example output is below:
Disk /dev/sdf: 513 MB, 513802240 bytes 32 heads, 32 sectors/track, 980 cylinders Units = cylinders of 1024 * 512 = 524288 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdf1 1 980 501744 6 FAT16
For this example, we will assume that your MMC is /dev/sdf. You should replace the "sdf" with the appropriate device from your specific system.
WARNING: Make sure to NOT use any of the devices listed in fdisk's output prior to plugging in your MMC card, or you will very likely destroy all or some of your production filesystem!
Let's unmount /dev/sdf1 to make sure that it is not in use by the filesystem:
umount /dev/sdf1
Now, let's write the BUG rootfs to it:
dd if=~/bug-image-production-bug.ext3 of=/dev/sdf1
Resizing the Root Filesystem to the MMC or SD Card
Now let's make sure everything went alright and resize the partition so it takes up all the available space on the memory card. If you want to create other paritions then you may want to avoid this step.
$ sudo fsck.ext3 /dev/sdf1 e2fsck 1.40.9 (27-Apr-2008) Filesystem did not have a UUID; generating one. Filesystem has feature flag(s) set, but is a revision 0 filesystem. Fix<y>? yes /dev/sdf1: clean, 5288/15240 files, 79041/121081 blocks
$ sudo resize2fs /dev/sdf1 resize2fs 1.40.9 (27-Apr-2008) Resizing the filesystem on /dev/sdf1 to 501744 (1k) blocks. The filesystem on /dev/sdf1 is now 501744 blocks long.
Unmount the MMC
cd umount /tmp/mmc
Boot Your BUG
Once the MMC or SD card has been properly unmounted from the live cd environment's filesystem, you can remove it and place it in your BUG.
