Running Qt in Gumstix

first of all, make sure your can create a bootable microSD card. Follow the instruction:

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

To create a bootable microSD, compatible with the·OMAP3 boot ROM, set a special geometry using the·fdisk "Expert mode".  These steps also work for verdex pro COMs.
Important Notes:

- When creating a bootable microSD card for an·Overo COM,·you MUST use expert mode. This sets the correct cylinders, heads and sectors for the microSD card before you partition it.
- Gumstix recommends using a microSDHC card for Overo COMs. Only use microSD cards for verdex pro COMs.

The example below shows the steps required to set up a new microSD card of any size.  The numbers shown are given for a particular 2GB microSD card.  You will be directed to make a simple calculation to determine the correct values for your microSD card.
First, insert your card into the development machine's flash card slot. You may need to use a microSD to SD card adaptor to fit your slot. example the device name will be /dev/sde.  Please 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/sde1

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

# sudo fdisk /dev/sde

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:

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 need it later in the process.
Now go into "Expert" mode:
Command (m for help): x

Next, 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, take the 2032664576 bytes reported above by fdisk, divide 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)
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))

Mark it bootable:
Command (m for help): a
Partition number (1-4): 1

Now, create an ext3 partition for the rootfs:
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
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 your work, 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/sde1   *           1           5       40131    c  W95 FAT32 (LBA)
/dev/sde2               6         247     1943865   83  Linux

Finally, 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
Syncing disks

Formatting the New Partitions
Format the first partition as an 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/sde1 -n FAT
mkfs.vfat 2.11 (12 Mar 2005)

Format the second partition as an ext3 file system:
$ sudo mkfs.ext3 /dev/sde2
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 I/O pins and then loads the second file.
2) u-boot.bin: the boot loader
3) uImage: the Linux kernel

Note: For verdex pro, MLO is not required.
You can build these yourself or download pre-built images. but these three files must be named as stated above.

After building or downloading these files, mount the FAT partition of your microSD card. The following example assumes you mount it at /media/card.
$ sudo mount /dev/sde1 /media/card

Due to constraints of the mask boot ROM in the OMAP processor, MLO MUST be written first.
$ sudo cp MLO-overo /media/card/MLO

Copy u-boot and the Linux kernel to the card:
$ sudo cp u-boot.bin /media/card/u-boot.bin
$ sudo cp uImage.bin /media/card/uImage

Now you can unmount the FAT partition.
$ sudo umount /dev/sde1

At this point you have a bootable FAT partition. Lastly, untar your desired root filesystem on the ext3 partition that you created above.  Do not untar your COM rootfs onto your development machine!  This example assumes that you have mounted it at /media/card:
$ sudo mount /dev/sde2 /media/card

Untar your desired rootfs.
$ cd /media/card
$ sudo tar xvaf /path/to/console-image.tar.bz2

Unmount the ext3 partition.
$ sudo umount /dev/sde2

U-boot Environment Refresh
U-boot comes with a default set of environment variables that can change as new versions are released.  If you are updating u-boot, clear your current set of u-boot environment variables the first time you boot with the new version.  Do this by breaking into u-boot and typing the following commands. (Overo ONLY).
$ nand erase 240000 20000
$ reset
To make additional changes to the environment, break into u-boot again, make the changes and type 'saveenv' to save.  This also eliminates the "*** Warning - bad CRC or NAND, using default environment".


PS! The order you copy MLO, u-boot and uImage to microSD FAT partition is very important. Otherwise, you may not boot from microSD card successfully.

Then, copy two files from your build directory to microSD card:
 directory: /build/czhang/overo-oe/tmp/deploy/glibc/images/overo
 files:  uImage-2.6.34-r90-overo.bin
             Angstrom-omap3-console-image-glibc-ipk-2010.7-test-20101005-overo.rootfs.tar.bz2 (extract to sd card)


Problem occur:

after boot from microSD card (which contain pre-make overo image from internet), Ethernet does not work, because i cannot see the light turns on after i plugged Ethernet cable.

in Overo kernel, check the loaded module
$ lsmod
Module Size Used by
libertas_sdio 13860 0
libertas 168952 1 libertas_sdio
lib80211 6848 1 libertas
ipv6 238492 16
ads7846 10328 0

Hmm, eth0 module hasn't been loaded.

$ modprobe smsc911x
smsc911x: Driver version 2008-10-21.
smsc911x-mdio: probed
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:01, irq=-1)
net eth0: MAC Address: 00:15:c9:28:c3:60
net eth0: SMSC911x/921x identified at 0xd0c3a000, IRQ: 336

great, loaded. right, i need to add eth0 module while the overo booting.

$ cd /etc
$ cat modules
### This file is automatically generated by update-modules"
# Please do not edit this file directly. If you want to change or add
# anything please take a look at the files in /etc/modutils and read
# the manpage for update-modules.
### update-modules: start processing /etc/modutils/ipv6

### update-modules: end processing /etc/modutils/ipv6

$ cd /etc/modutils
$ cat > smsc911x ; create a eth0 module file
$ cat smsc911x ; add command in this file
(Ctrl+D to save it)

$ update-modules

reboot gumstix, done!

copy my own build overo image to microSD card, boot gumstix, the eth0 still not work!!
the reason is that the latest version of bb recipes includes the smsc911x in kernal, not a module. take a look in:
$ cd /etc/network
$ cat interfaces
#auto eth0
#iface eth0 inet dhcp
#iface eth1 inet dhcp
(eth0 has been disabled)

$ vi interfaces ; learn how to drive vi, un-comment eth0
auto eth0
iface eth0 inet dhcp
#iface eth1 inet dhcp ; gumstix does not have eth1

reboot gumstix, done.

Note: sometimes, the eth0 will down after I stopped program. To enable the eth0 manually, try:
$ ifconfig eth0 up
$ ifconfig eth0 netmask


$ udhcpc

sometimes "udhcpc" does not work.
I am using
$ifdown eth0
$ifup eth0

to enable the Ethernet.

take a look if the kernel has "rsync", because i need use it to copy Qt arm-lib files from my build machine.
try if you can install "rsync" with opkg command, which is similar to yum or apt-get
$ opkg install rsync
can't install rsync
$ opkg update
$ opkg install rsync
still can't install.

go back to build machine, build rsync package myself.
$ cd /build/czhang/overo-oe
$ source build/profile
$ bitbake rsync

after that, i should be able to see a rsync.ipk file in:

Go to Gumstix, copy this package to /~

$ cd ~
$ opkg install rsync_3.0.6-r0.6_armv7a.ipk

Then copy all Qt ARM-lib file to gumstix lib folder
$ rsync -av czhang@* /usr/lib

copy my Qt executable file to gumstix
$ cd ~
$ scp czhang@ .
$ pwd
$ /home/root/m4
error while loading shared libraries: cannoy

ok, need to copy serial port arm-lib to gumstix
$ rsync -av czhang@* /usr/lib

run again
$ /home/root/m4

great, see my program on the touch screen.

next step is to calibrate the touch screen and import some pictures.

No comments:

Post a Comment