Monday, April 27, 2009

Never lose a terminal with Screen

SSH is a fantastic tool for working on computers remotely. However, I've often run into the following problem: I'll be doing something in the terminal, like downloading a new release of Ubuntu, and been forced to shut down due to battery depletion on my laptop.

Fortunately, there's a utility that allows you to run a terminal as a separate process. You can detach from that terminal, disconnect from your remote machine, and re-connect when you feel like it.

Screen is a GNU/Linux program that allows you to run a terminal without the headache of staying logged in via SSH. I've used it to begin a download at school, detach from the session, drive home, and then reattach to see the progress. It's very handy for situations that require multiple tty's.

To use it, just type the following command into the terminal of the remote machine:

screen


This will bring you to a new, separate tty. Begin your process, then hit Ctrl-A+D (that is, hit Ctrl-A, then D for detach). This will take you out of the screen tty, leaving it running as a separate process. You can reattach to a screen later by typing screen -r.

Friday, April 24, 2009

The Next Big Thing: Part 1: Ubiquitous Internet

Lately I've been marveling at the technology of the last 20 years. 20 years ago, the Internet didn't exist in the form we know it today. I've gotten so used to paying my bills online, it's hard to fathom a day when it couldn't be done like that.

This inevitably gets me thinking about what the world will look like in the future. Being an engineer, and getting a chance to work on cutting-edge technology, I have the privilege of getting paid to wonder what the next decade bring. What new technologies will shape our world?

This begins a series of what I'm calling "The next big thing". I'll do weekly posts about technology that I think will become popular in the next 10 years. If anything, it'll give me a chance to look back 10-years from now and laugh at my own optimism.

Ubiquitous Internet

Tech:
The word Ubiquitous has become a buzzword in computer science communities -- it generally means that everpresent existence of something. Computers are ubiquitous in our modern society -- most people don't go a whole day without interacting with some sort of computer, whether it be the micro-controller in your microwave or the real-time embedded computers in your car.

The next step in the evolution of the Internet is ubiquity. Eventually these many computers will interconnect and communicate without our awareness of it. The ubiquitous internet will allow our refrigerators to send our grocery lists to our cellular phones (or wearable computers) automatically. Our cars will communicate with their manufacturers, providing real-life data for future engineering efforts.

Evidence:
The Internet is already available on most cellular phones in the United States. Already, this technology is producing internet phenomena such as Twitter. While the cellular network is improving constantly, the bandwidth for ubiquitous Internet is not there . . . yet.

The major enabling technology for the ubiquitous internet could be the reallocation of the 800MHz spectrum from analog television to the Internet. In the very near future, the internet will be available anywhere that a television signal could be received.

As these muni systems become more common, devices that take advantage of the availability of the Internet become more feasible.

Conclusion:

I hope you've enjoyed this first installment of The Next Big Thing. Check back again next week for more dreaming and musings on what the future holds.

Friday, April 10, 2009

Installing Ubuntu on the Gumstix Overo

Installing Ubuntu on the Gumstix Overo


To get your own Overobuntu card pre-installed, without the headache or hassle of making your own, buy one from my website: www.radsoftwaresys.com/content/products. You'll be getting a well-tested card, and the proceeds will be used to develop awesome new products for the Gumstix Overo. Thanks! Please note: this card will NOT work with the Chestnut43 board.

This tutorial will walk you through the steps of installing Ubuntu on a Bootable SD card, and booting to Ubuntu on the Gumstix Overo. These instructions assume that you are running from Ubuntu Linux, although any similar Linux distro will suffice.

This tutorial references the following websites. Portion of this tutorial have been assembled from them, sometimes paraphrased and sometimes copied verbatim. Please visit the respective sites for more information:
http://elinux.org/BeagleBoardUbuntu
http://www.gumstix.net/Software/view/Software-Overo/Creating-a-bootable-microSD-card/111.html

Required Materials:

The following materials are required to complete this tutorial:
  • Gumstix Overo
  • Summit Board
  • Power Supply
  • USB Mini-B to Standard-A (computer host to overo device) cable
  • 2GB (or larger) microSD Card (and standard card adapter to plug it into your development PC).
Ensure you have the correct packages installed:

sudo apt-get install ckermit qemu
...installs software...
wget http://ports.ubuntu.com/pool/main/d/debootstrap/debootstrap_1.0.12_all.deb
sudo dpkg -i debootstrap_1.0.12_all.deb
wget http://people.ubuntu.com/~ogra/arm/build-arm-rootfs
sudo chmod u+x build-arm-rootfs

Building the root file system

Next, we'll need to build the Ubuntu arm root file system. This command will place the compressed image in your current working directory, so make sure you cd to the directory in which you want your image.

You can use any one of the following commands to build a root file system, depending on your desired seed (NOTE: I highly recommend you use the LXDE image. The standard Ubuntu GNOME desktop is unbearably slow on the Overo):

General: sudo ./build-arm-rootfs --fqdn --login --password --imagesize --seed

lxde Desktop: sudo ./build-arm-rootfs --fqdn overo --login ubuntu --password temppwd --imagesize 2G --seed lxde,gdm

Xubuntu Desktop sudo ./build-arm-rootfs --fqdn overo --login ubuntu --password temppwd --imagesize 2G --seed xubuntu-desktop

Ubuntu Desktop sudo ./build-arm-rootfs --fqdn overo --login ubuntu --password temppwd --imagesize 3G --seed ubuntu-desktop

Set the computer aside, as it will take a long time to build the entire root filesystem.

Once it's done, you'll see two files: build-arm-rootfs-YYYYMMDDhhmm.log and armel-rootfs-YYYYMMDDhhmm.tgz.

The first file contains the build log (if you have have any errors, this is the best place to start). The second contains your compressed root file system.

Formatting and Creating a Bootable SD Card

These instructions were copied from the following documentation on the gumstix.net website with some minor modifications.

Reference: http://www.gumstix.net/Software/view/Software-Overo/Creating-a-bootable-microSD-card/111.html

Print
The Overo will boot directly from a properly prepared microSD card. This section will outline how to partition and format a bootable microSD card.

In order to create a bootable microSD compatible with the OMAP3 boot ROM you must set a special geometry using the fdisk "Expert mode".

This example will show the steps for setting up a brand new 2Gb microSD card.

First insert your card into your development machine's flash card slot. You may need to use a microSD to SD card adaptor to fit your slot.

On my Ubuntu 8.10 machine, the newly inserted card shows up as /dev/mmcblk0 and that is the device name that will be used through this example. You should substitute the proper device name for your machine. You can use 'mount' or 'df' to see where the card mounts on your machine.

Let's unmount the device's existing file system before we get started with fdisk:

$ sudo umount /dev/mmcblk0

Partitioning the card

Now launch fdisk and create an empty partition table. Note that the argument for fdisk is the entire device (/dev/mmcblk0) not just a single partition (i.e. /dev/mmcblk0p1):

# sudo fdisk /dev/mmcblk0


Command (m for help):
o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Let's first look at the current card information. Note: Your information may be slightly different:

Command (m for help): p


Disk /dev/sde: 2032 MB, 2032664576 bytes
64 heads, 63 sectors/track, 984 cylinders
Units = cylinders of 4032 * 512 = 2064384 bytes
Disk identifier: 0x00aa8e5c

Device Boot Start End Blocks Id System

Note the card size in bytes. We will needed it later in the process.

Now go into "Expert" mode:

Command (m for help): x

Next we will set the geometry to 255 heads, 63 sectors and a calculated value for the number of cylinders required for the particular microSD card.

To calculate the number of cylinders, we take the 2032664576 bytes reported above by fdisk (use the number you saw from above) divided by 255 heads, 63 sectors and 512 bytes per sector:

2032664576 / 255 / 63 / 512 = 247.12 which we round down to 247 cylinders.

Expert command (m for help): h

Number of heads (1-256, default 4): 255

Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity

Expert command (m for help): c
Number of cylinders (1-1048576, default 984): 247

Return to fdisk's main mode and create a new partition 32 MB FAT partition:

Expert command (m for help): r


Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-247, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-247, default 15): +32M

Change the partition type to FAT32:

Command (m for help): t

Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

And mark it bootable:

Command (m for help): a

Partition number (1-4): 1

Next we create an ext3 partition for the rootfs:

Command (m for help): n

Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (6-247, default 6): 6
Last cylinder or +size or +sizeM or +sizeK (6-247, default 247): 247

To verify our work, lets print the partition info:

Command (m for help): p


Disk /dev/sde: 2032 MB, 2032664576 bytes
255 heads, 63 sectors/track, 247 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00aa8e5c

Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 1 5 40131 c W95 FAT32 (LBA)
/dev/mmcblk0p2 6 247 1943865 83 Linux

Up to this point no changes have been made to the card itself, so our final step is to write the new partition table to the card and then exit:

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

Formatting the new partitions

We format the first partition as a FAT file system (the -n parameter gives it a label of FAT, you can change or omit this if you like):

#  sudo mkfs.vfat -F 32 /dev/mmcblk0p1 -n FAT

mkfs.vfat 2.11 (12 Mar 2005)

We format the second partition as an ext3 file system:

$ sudo mkfs.ext3 /dev/mmcblk0p2

mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
121920 inodes, 485966 blocks
24298 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=499122176
15 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: ^[done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Installing the boot files

There are three files required on the first (FAT) partition to boot your Overo:

  1. MLO: the boot-loader loader - this small program is loaded into the OMAP3 processor's static RAM. It does some minimal configuration of system memory and io pins and then loads the second file.
  2. u-boot.bin: the boot loader
  3. uImage: the linux kernel

You can build these yourself or download pre-built images. It is important that these three files have precisely these names on the card.

For build instructions, check out http://www.gumstix.net/Software/cat/Software-Overo/111.html, particularly the section on Setting up a build environment. You can download pre-built images from the following places:

  1. MLO: http://www.gumstix.net/overo-gm-images/v0.91/MLO-overo-v0.91
  2. u-boot.bin: http://www.gumstix.net/overo-gm-images/v0.91/u-boot-overo-v0.91.bin
  3. uImage.bin: http://www.gumstix.net/overo-gm-images/v0.91/uImage-overo-v0.91.bin

Once you have completed building or downloading these files, mount the FAT partition of your microSD card. This example will assume that you have mounted it at /media/card:

sudo mount /dev/mmcblk0p1 /media/card

Due to constraints of the mask boot ROM in the OMAP processor, MLO should be written first:

$ sudo cp MLO-overo-v0.91 /media/card/MLO

Then copy u-boot and the linux kernel to the card:

$ sudo cp u-boot-overo-v0.91.bin /media/card/u-boot.bin

$ sudo cp uImage-overo-v0.91.bin /media/card/uImage

You can now unmount the FAT partition:

$ sudo umount /dev/mmcblk0p1

At this point you have a bootable FAT partition.

The final step is to untar your desired rootfs onto the ext3 partition that you created above.

Note that this step can be dangerous. You do not want to untar your Overo rootfs onto your development machine - be careful!

This example will assume that you have mounted it at /media/card:

$ sudo mount /dev/mmcblk0p2 /media/card

Now untar your desired rootfs (note: The first step is important!):

$ cd /media/card

$ sudo tar -zxvf armel-rootfs-YYYYMMDDhhmm.tgz

You can now unmount the ext3 partition:

$ sudo umount /dev/mmcblk0p2

Finishing Up


The last step is to remove your bootable SD card, and insert it into the MMC slot on the Overo. Before you insert the card, make sure the Overo is off.

Once you've inserted the card, boot the Overo. It should boot into your new Ubuntu environment.


UPDATE Nov. 27, 2009:

HOW TO INSTALL MODULES:
This section will detail how to install the kernel modules from the Angstrom distribution into
the Overobuntu image. Also, please note the lack of tutorial style. I will be updating this section to be more of a tutorial shortly, but I figured it is useful enough to put this version up now.

First, bitbake the U-boot, x-load, and kernel. See http://www.gumstix.net/Software/view/Software-Overo/Setting-up-a-build-environment/111.html if you're unsure what this means, or don't have your build environment set up.


bitbake u-boot x-load linux-omap3


In gumstix/gumstix-oe/tmp/deploy/glibc/images, you will find
files like:
MLO-*
u-boot-*
uImage-*
modules-*-.tar.gz

The first three are used in building the bootable SD card. See
http://www.gumstix.net/Software/view/Software-Overo/Creating-a-bootable-microSD-card/111.html

Once you have the FAT partition set up with MLO, u-boot.bin and uImage,
untar the ubuntu arm-rootfs to the ext3 partition.

Next, untar the modules-*-.tar.gz from the build to the ext3 boot partition.
This will "install" the modules and firmware.

One last step, boot from the SD card. There will be some errors regarding
a missing modules.dep file. NOTE the path in the error. Sign in as the
user specified when you built the ubuntu arm-rootfs. CD to the location
noted in the error and type the following command:
sudo depmod
and enter the password.

Finally, reboot:
sudo shutdown -r now

Hopefully, this will get Ubuntu running for you with the required drivers.

UPDATE: November 28, 2009 -- from "http://www.gumstix.net/wiki/index.php?title=Installing_Ubuntu_9.04_on_Gumstix_Overo"

If you're interfacing with your Overo with the USB serial terminal, keep in mind that you won't see the 'login:' prompt after booting Ubuntu unless you configure getty to listen on /dev/ttyS2. You'll need to do this while your MicroSD card is still mounted on another host.

# cd /path/to/rootfs
# cat > etc/event.d/ttyS2 <start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5

stop on runlevel 0

respawn
exec /sbin/getty 115200 ttyS2
EOF


You will also need to add ttyS2 to /etc/securetty to allow root logins there:

# echo "ttyS2" >> etc/securetty

"

Cards purchased from me will now have this capability.

Monday, April 6, 2009

Ubuntu 9.04 on a Gumstick

This week, Jeff and I finally brought Ubuntu to the Gumstix Overo.

To get your own Overobuntu card pre-installed, without the headache or hassle of making your own, buy one from my website: www.radsoftwaresys.com/content/products. You'll be getting a well-tested card, and the proceeds will be used to develop awesome new products for the Gumstix Overo. Thanks!

The timing couldn't be any better, as gumstix just announced last week the addition of the Overo Wind, Fire, and Water to their Computer-on-module (COM) lineup. These use the OMAP3530 processor, which supports openGL-ES, which means as soon as we can get our hands on one, we'll be toying with Compiz and Gumstix!!

For those that are still in the dark about the gumstix, check out my previous post about the Overo Earth.

We've written a step-by-step tutorial on how to get this working, and if there's interest I'll post it on blog.myokapi.net.

Of course, since it didn't happen without pix . . .

The Gumstix Linux bootsplash - I like the gumstix on his tummy.

It doesn't have a USplash screen (yet), but the Jaunty login window loads up pretty quickly.

We used the LXDE desktop since it takes up less system resources than GNOME. If there's interest, I can post screenshots of GNOME as well.

The Terminal window shows the output of /proc/cpuinfo. It's the overo, alright.

The Jaunty login screen on Jeff's TV.

Jeff got errors at first, but I think he has them solved now . . .