Upgrade your BUG memory card
From BUG Wiki
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.
If you have received your BUG after the date of May 15th 2009, you enjoy the luxury of a Uboot bootloader. This means that you do not have to worry about keeping your kernel (in onboard NOR) in sync with your rootfs (on your SD). Uboot users can skip down to Instructions.
If however you bought your BUG before May 15th 2009 and have not followed the instructions on upgrading your bootloader from Redboot to U-boot, your must your kernel version MUST match your rootfs verion. Therefore, BEFORE upgrading your memory card with the rootfs, you will need to follow the instructions on Upgrading BUG Kernel. Because different revisions of the BUG software stack are based on different versions of the Linux Kernel, your BUG will not boot if your kernel (which resides in onboard flash) and rootfs (which resides on the memory card) are out of sync. If for some reason this has happened with your BUG, please drop into our IRC channel and we can work through it with you.
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 Mac OS X users that leverages a Linux Live CD, and a community contributed [Windows Tutorial]. The instructions below assume you're upgrading from a R1.3 to R1.4 rootfs. If you are going from an earlier release (R1.2 or earlier) please see Upgrade_your_BUG_memory_card_(1.2_to_1.3)
Upgrading BUG Rootfs – Linux
These steps assume a good working knowledge 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.
Step 1: 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 Linux $
Make sure you see that it contains a valid partition table. i.e. you see "Linux" in the System column. If you do not, you will need to reformat your card. If you do not see Linux under system, use the following command to write an ext3 partition and partition table, substituting /dev/sdb with the dev name you saw above:
sudo fdisk /dev/sdb d n p 1 (enter for default beginning) (enter for default size) w
Of course, you may skip this step if it already is of type Linux.After it writes, you should run the
sudo fdisk -lagain and verify that "System" is now Linux, and proceed.
- 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.
Step 2: Back 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.
Step 3: 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.4.3-rootfs.ext3.bz2 --2009-06-11 17:20:29-- http://bugcommunity.com/downloads/files/bug-image-production-bug-R1.4.3-rootfs.ext3.bz2 Resolving bugcommunity.com... 126.96.36.199 Connecting to bugcommunity.com|188.8.131.52|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 48693828 (46M) [application/x-bzip2] Saving to: `bug-image-production-bug-R1.4.3-rootfs.ext3.bz2' 100%[=====================================================================================================================>] 48,693,828 327K/s in 2m 32s 2009-06-11 17:23:01 (313 KB/s) - `bug-image-production-bug-R1.4.3-rootfs.ext3.bz2' saved [48693828/48693828]
Step 4: Write the Image to the Memory Card
Now we can use dd to write the partition image to the memory card:
$ bunzip2 bug-image-production-bug-R1.4.3-rootfs.ext3.bz2 (tar step if on R1.3; see below) $ sudo dd if=bug-image-production-bug-R1.4.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
Note If you are using the R1.3 image bug-image-production-bug-R1.3-rootfs.ext3.tar.bz2 you will need do do:
tar xvf bug-image-production-bug-R1.3-rootfs.ext3.tar
after the bunzip2 and before the dd command. You have to have an ext3 file before doing the dd.
Step 5: 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 e2fsck -f /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.
Step 6: Boot Your 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.
That's it! We hope you enjoy using your updated BUG.
Upgrading BUG Rootfs – 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.
- 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
Step 1: 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.
Step 2: 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:
- 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".
Step 3: Download the BUG Root Filesystem
cd ~ wget http://bugcommunity.com/downloads/files/bug-image-production-bug-R1.4.3-rootfs.ext3.bz2 bunzip2 bug-image-production-bug-R1.4.3-rootfs.ext3.bz2
NOTE For R1.3 image only you will also need to do:
tar xvf bug-image-production-bug-R1.3-rootfs.ext3.tar
Basically, at the end of this step you should have a file that ends with ".ext3".
Step 4: Connect (Mount) the MMC or SD Device
- BEFORE YOU PLUG IN THE MMC DRIVE, type the command:
and note its output.
- Next, plug the drive in, wait a few moments, then type:
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 Linux
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:
Step5: Write the Image to the Memory Card
Now, let's write the BUG rootfs to your memory devide:
dd if=~/bug-image-production-bug-R1.4.3-rootfs.ext3 of=/dev/sdf1
Step 6: 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 e2fsck -f /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.
- Now unmount the memory card:
cd umount /tmp/mmc
Step 7: 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. Turn ithe BUG 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.
That's it! We hope you enjoy using your updated BUG.
Upgrading BUG Rootfs – Mac OS X
- This doesn't really work: much less painful to use a LiveCD in VM, I've tested with ubuntu in VMWare. Leaving the text below but don't expect much, the ext2fsx project hasn't been touched for two years**
- This procedure does work. I tested it with Mac OS X Leopard and it worked just fine: http://www.rolandtanglao.com/archives/2009/03/17/upgraded-kernal-and-them-root-fs-my-bug-froom-13-r14-gps-still-doesnt-get-fix
These steps assume command-line skills and a familiarity with the Mac OS X Terminal. Additionally, you will need a SD or MicroSD card reader.
Step 1: Install Linux Filesystem Tools for Mac
Updating the root filesystem requires some tools for Linux filesystems that are not included in Mac OS X. These tools are provided by the ext2fsx project. At the time of writing the current version of Mac OS X is 10.5 Leopard and the current version of ext2fsx is 1.4d4.
- Download the tools from the ext2fsx sourceforge project site http://sourceforge.net/projects/ext2fsx/
- Install ext2fsx. A restart is required.
Step 2: Connect (Mount) the MMC or SD device
- Plug the card into your computer via your external card reader
- Open "System Preferences" and navigate to the "ExtFSManager" pane (listed under "other")
- You should see a volume labeled "Generic Storage" or similar in the volumes listing. Open the "Generic Storage" volume and select the partition within it. Verify that the "connection bus" is USB, and look for the "Device". It should look like disk#s1 (eg. disk1s1) or similar. It is most definitely NOT disk0!!! Take note of this name for later use.
Step 3: Follow Linux Instructions
You now have all the necessary tools (e2fsck and resize2fs, Add /usr/local/sbin to your path in order to access e2fsck and resize2fs ) to follow the steps for the Linux instructions.
You can start from the step entitled Backing up existing data making sure to use the device path you discovered in the previous steps (eg. /dev/disk1s1)
Sometimes dealing with dd takes a while. If you use linux, here are a sequence of steps that should reduce your image-writing time.
cd /tmp && wget http://dauber/trunk/full/11157/Angstrom-bug-image-production-glibc-ipk-2009.X-stable-bug20.rootfs.tar.gz --2010-04-29 16:23:58-- http://dauber/trunk/full/11157/Angstrom-bug-image-production-glibc-ipk-2009.X-stable-bug20.rootfs.tar.gz Resolving dauber... 192.168.20.33 Connecting to dauber|192.168.20.33|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 78774112 (75M) [application/octet-stream] Saving to: `Angstrom-bug-image-production-glibc-ipk-2009.X-stable-bug20.rootfs.tar.gz' 77% [===============================================================================================> ] 60,747,040 11.1M/s eta 2s
- Create a mountpoint:
sudo mkdir /media/SD;
- Reformat the card:
sudo mkfs.ext3 /dev/sdX1
- Mount the card
sudo mount /dev/sdX1 /media/SD
- Get into the directory and untar the rootfs tarball:
cd /media/SD && sudo tar xvf /tmp/Angstrom...tar.gz
- Get out of the directory and unmount
cd && sudo umount /media/SD
- All together:
sudo mkdir /media/SD; sudo mkfs.ext3 /dev/sdX1 && sudo mount /dev/sdX1 /media/SD && cd /media/SD && sudo tar xvf /tmp/Angstrom-bug-image-production-glibc-ipk-2009.X-stable-bug20.rootfs.tar.gz && cd && sudo umount /media/SD; sudo rm -fr /media/SD