These are the steps for setting up a toolchain and SDK to cross compile GNU Linux for the Beagleboard ver. C4 (OMAP 3530).  The host is Ubuntu 10.04.  The toolchain is then used to cross compile the Codelite package.

Toolchain

Start by making a filesystem and SDK with Narcissus.  Be sure to include the option for the toolchain and X11 with xfce4.  Save and extract the SDK to the root / of the partition.
mark@ubuntu:~$ cd /
mark@ubuntu:/$ sudo tar -xfv /home/mark/Downloads/angstrom-SDK.tar.gz

This should create the folders:
/usr/local/angstrom/…
/var/lib/opkg/…

I made the following changes to the environment-setup script located in /usr/local/angstrom/arm/../environment-setup

-export PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS${libdir}pkgconfig
+export PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS/usr/lib/pkgconfig

alias gcc=”arm-angstrom-linux-gnueabi-gcc”
alias g++=”arm-angstrom-linux-gnueabi-g++”
alias as=”arm-angstrom-linux-gnueabi-as”
alias strip=”arm-angstrom-linux-gnueabi-strip”
alias ld=”arm-angstrom-linux-gnueabi-ld”

CORE_NUM=`cat /proc/cpuinfo | grep processor | wc -l`
alias make=”make -j$CORE_NUM”

Beagleboard rootfs install

Save the file system tar.gz that Narcissus generated and untar it to the SD partition.  There are a number of ways to boot the Beagleboard and the particulars of this step are not included.  Once Angstrom has booted, login as root and issue the following commands.

root:~# opkg install angstrom-x11-base-depends
root:~# startxfce4

Cross Compiling

The Codelite project requires the wxWidgets GTK libraries.
Get the wxWidgets source package from http://www.wxwidgets.org/downloads/
Untar and cd to the root of the wxWidgets folder

Prepare the shell for cross compiling by running the environment-setup script.  Don’t forget the period before /usr/…

wxWidgets-2.9.1$ . /usr/local/angstrom/arm/environment-setup
wxWidgets-2.9.1$ opkg-target update
wxWidgets-2.9.1$ mkdir build_gtk
wxWidgets-2.9.1$ cd build_gtk

Build wxWidgets with the Narcissus SDK:

build_gtk$ ../configure –enable-unicode –enable-debug –host=arm-angstrom-linux-gnueabi –with-gtk
build_gtk$ make -j2
build_gtk$ sudo make install

Build Codelite with Narcissus SDK:
Downloads$ svn co https://codelite.svn.sourceforge.net/svnroot/codelite/trunk codelite
Downloads$ cd codelite/
codelite$ ./configure –host=arm-angstrom-linux-gnueabi
codelite$ make -j2

Install on Beagleboard

Copy the wxWidgets libraries labled ‘libwx_xxx_xxxx.so’ to /usr/local/lib/ of the Beagleboard rootfs.  Also copy the codelite folder to a location on the Beagleboards rootfs.

Boot the Beagleboard and issue the following commands as root user.
root:~# echo “/usr/local/lib” >> /etc/ld.so.conf
root:~# ldconfig

You can either edit the Makefile and change the paths or delete it and reconfigure a new one.  I think it still needs to be edited even after a reconfigure iirc.

root:~# cd codelite

root:~/codelite# ./configure
root:~/codelite# make install

Codelite should now be up and running on the Beagleboard.

 

Links:

http://narcissus.angstrom-distribution.org/

http://prdownloads.sourceforge.net/wxwindows/wxWidgets-2.8.12.tar.gz

http://www.wxwidgets.org/downloads/

http://codelite.org/

 

I configured one of my ZipIts to be a serial terminal for the beagleboard.  Like the ZipIt, the beagleboard has Uboot installed.  The flexibility of Uboot allows many different ways to get an image into RAM.  The methods available for the beagleboard require a serial connection.  Both methods outlined will require minicom to be installed on the ZipIt in order to communicate with the beagleboard.  The lrzsz package is also needed, it can sometimes be included in the minicom package, but double check in case it’s not.

z2sid-rc3:~#: apt-get install minicom

z2sid-rc3:~#: apt-get install lrzsz

 

My ZipIt was running z2sid-rc3 with a kernel built using this config in buildroot.

 

Method 1

I first connected the beagleboard to the ZipIt the same way I was connecting it to my laptop.  This setup requires a USB to serial converter, the usb-serial driver and minicom.  Lots of cables, but that’s how the beagleboard is configured by default, out of the box.  First of all, before plugging anything into the ZipIt’s USB, load the usb-serial driver.

z2sid-rc3:~#: modprobe usbserial

The USB hub can now be connected to the ZipIt.  Give the USB devices a second to register, a /dev/ttyUSB0 node will be created.  Attach a minicom session with the following command.

z2sid-rc3:~$: minicom -D /dev/ttyUSB0

 

Method 2

A little investigating and I was able to eliminate most of the wires and the USB hub by using USB serial over the beagle’s OTG port (in the prior setup, the OTG cable was only providing power).  This setup requires a different driver to be running on the ZipIt and the beagleboard’s Uboot environment variables need to be modified.  Start with changing the Uboot enviroment variables.  Enter Uboot and issue the following commands.  Note: this will require the setup from Method 1 in order to get a Uboot prompt on the ZipIt.

OMAP3 beagleboard.org # setenv usbtty cdc_ac

OMAP3 beagleboard.org # saveenv

OMAP3 beagleboard.org # reset

OMAP3 beagleboard.org # setenv stdout usbtty; setenv stdin usbtty; setenv stderr usbtty; saveenv

At this point Method 1 will no longer work on the beagleboard, as we have changed the stdin and stdout.

1.  Plug the ZipIt into AC power and boot z2sid-rc3.

2.  Load the cdc_acm driver with the following command.

z2sid-rc3:~#: modprobe cdc-acm

3.  Connect the beagleboard’s OTG cable to the ZipIt as shown in the picture for Method 2.

4.  There should be a new /dev/tttyACM0 node present now, attach minicom to it.

z2sid-rc3:~$: minicom -D /dev/ttyACM0

 

 

clonetty

The clonetty utility is needed for keeping minicom alive when plugging and unplugging the beagleboard.  It places a pseudo tty in between the ttyACM0 node and minicom.  The pseudo tty never goes down, and when the ttyACM0 node appears, clonetty takes care of setting up the link automatically.  The utility consists of a single C file and can be compiled with this make file.  I built mine right on z2sidx-rc3.  It’s assumed you have everything setup for Method 2.  These are the steps to set up clonetty and minicom.

1.  Plug the ZipIt into AC power, boot Linux.

2.  Connect the beagleboard’s OTG cable to the ZipIt as shown in the picture for Method 2.

3. Start minicom and configure the options to connect with the beagleboard (i.e. 115200 8N1), save as dfl and quit.

z2sid-rc3:~$: minicom -D /dev/ttyACM0 -o

4.  Start clonetty in the background.

z2sid-rc3:~$: clonetty /dev/ttyACM0 &

3.  Observe the output:

pty: /dev/pts/3
Using /dev/ttyACM0

4.  Attach minicom to the pty that clonetty just created.

z2sid-rc3:~$: minicom -p /dev/pts/3 -o

5.  You should now be able to unplug/plug or reset the beagleboard and the minicom connection will stay up.

 

 

omap-u-boot-utils

The omap-u-boot-utils package has source files needed for communicating with uboot and automating a serial transfer of an image into RAM.  There isn’t much OMAP specific code, the routines should work with any uboot’ed target.  This beagle_kermit.sh script uses the kermit method of serial transfer.  Start clonetty as described above, minicom is not needed.  Change to the directory with the omap-u-boot-utils and execute beagle_kermit.sh.  Note: the ‘port’ variable at the head of the script may need adjustment, it should match the output from clonetty.

z2sid-rc3:~/Uboot_utils$: ./beagle_kermit.sh

 

Links:

http://gitorious.org/clonetty

http://engine12.com/files/clonetty/Makefile

http://engine12.com/files/.config.04052011(usb_serial)

http://elinux.org/U-boot_musb_gadget_support

http://zipit.markamber.co/z2sid_v6_uboot_rc3.tar.bz2

http://code.google.com/p/omap-u-boot-utils/

 

By using the USB networking features of Linux you can create a TCP/IP network and achieve the same functionality that is given with an ethernet or 802.11 network.  That is to say, you instantly get all of the network stack protocols such as  ssh, ftp, http, etc.  With USB networking you can easily add several new networking interfaces to a host machine.  These new interfaces can be configured to the same network or can be configured as seperate networks.  A USB network can also be bridged and shared with ethernet and 802.11 networks.

I have a beagleboard rev. C4 with Ubuntu running on an 8 GB SD card.  The beagleboard does not have an ethernet port or wifi chip, however, it does have both USB host and USB OTG ports.  The goal was to connect the ZipIt to the beagleboard with USB and then bridge to the ZipIt’s wireless connection.  By bridging the two networks, both the beagleboard and the ZipIt can utilize the wifi connection and access the web over the LAN.

  1. network a ZipIt Z2 to a beagleboard using USB
  2. create a bridge to the ZipIt’s wifi connection and share it with the beagleboard

The beagleboard has the ability to act as both a USB host and a USB client.  The connection being described in this post has the beagleboard assigned as the host and the ZipIt in USB client mode.  The ZipIt can also act as the USB host, but unlike the beagleboard, it cannot be both at the same time.  A kernel that has been configured to put the ZipIt in USB client mode is a requirement.  I compiled my own kernel using buildroot and the kernel sources from anarsoul’s tree with this .config and this additional patch, also provided by anarsoul.  At the time of this post, he has not released a compiled version of the USB client, I’m sure that if you poke him, he will be happy to help, otherwise I can also provide a binary.

You will also need to create a USB adapter for the ZipIt.  The USB wiring–>pin connections are the same as those for the USB host cable, the only difference you may consider is a male end.  The configuration details below can easily be adapted to work with a ZipIt to ZipIt, or a ZipIt to laptop connection.

It is recommended to use the z2lite-rc8 userland by wicknix.  This userland has the iptables already included.  The usage of other userlands will need  this package installed (i.e. z2sid-rc3).

The additions needed to /etc/network/interfaces for the beagleboard and ZipIt are as follows.

beagleboard –> /etc/network/interfaces

iface usb1 inet static

address 192.168.2.22

netmask 255.255.255.0

network 192.168.2.0

gateway 192.168.2.12 (this is the IP assigned to the ZipIt)

 

ZipIt  –> /etc/network/interfaces

auto usb0
iface usb0 inet static

address 192.168.2.12
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255

up echo 1 > /proc/sys/net/ipv4/ip_forward
up iptables -t nat -A POSTROUTING -o wlan0 -s 192.168.2.0/24 -j MASQUERADE
up iptables -t nat -A PREROUTING -i wlan0 -p tcp –dport 3074 -j DNAT –to-destination 192.168.2.12
up iptables -A FORWARD -i wlan0 -d 192.168.2.12 -p tcp –dport 3074 -j ACCEPT

down echo 0 > /proc/sys/net/ipv4/ip_forward
down iptables -t nat -D POSTROUTING -o wlan0 -s 192.168.2.0/24 -j MASQUERADE

 

Boot the beagleboard and the ZipIt.  Log in to the ZipIt and issue the following commands.

z2sid-rc3:~#:modprobe g_ether

z2sid-rc3:~#:ifdown usb0

z2sid-rc3:~#:ifup usb0

It’s assumed the ZipIt is already connected to a wireless AP and can access the web.  Please note that you configure and connect the ZipIt to the wireless AP as normal.  The ZipIt’s USB cable can now be plugged into the beagleboard’s USB hub.  That should be it.  Open your beagleboard’s web browser and try to access the web.

Troubleshooting:

Networking problems can arise from many sources.  The problem may be with the hardware, software, environment, configuration, etc., and can often be a combination of the possibilities.  Here’s a few tips for troubleshooting problems.

Start with establishing a ping signal.  It is best to clear any rules in the iptables that could prevent a response from the ping request.

z2sid-rc3:~#:iptables -L –> lists all the rules for the ‘firewall’

z2sid-rc3:~#:iptables -F –> clears all the rules for the ‘firewall’.  Should be the same as if a firewall was not up.

With USB networking the first thing to check of course would be the USB connection.  This can be done with a userland tool called ethtool.  The ethtool package can be found in most repositories, including those of Ubuntu.  If you are using a buildroot based userland such as z2lite you may need to build the ethtool package yourself.  The z2lite-rc8 package has the needed userland tools for creating the network bridge.

z2sid-rc3:~#:ethool usb0 –> should return Link Detected: yes

z2sid-rc3:~#:ethtool -i usb0 –> returns info about the driver and firmware.  Look for driver: g_ether.

z2sid-rc3:~#:ping 192.168.2.22 –> looking for a ping response of  ~ 2 ms

Once you have a ping response you can then start adding rules to the iptables that will bridge the USB network and the ZipIts wifi connection.

 

Links:

http://downloads.tuxfamily.org/linuxrx1950/precompiled/zipit/

https://github.com/anarsoul/linux-2.6/tree/pxa27x-dev

http://mozzwald.com/node/60

http://hostwork.com/users/matt/zipitz2/

 

 

© 2016 engine12