On this page... (hide)
I did this once before for a project at UC Berkeley, called the ESCHER effort (see http://chess.eecs.berkeley.edu/escher). Much of my experience came from that page.
Now, I'm installing a crosscompiler on (k)ubuntu gutsy, which is running in vmware on my Mac OS X laptop.
Find out what the gumstix is running
Install minicom
sudo port install minicom
Using a USB-Serial dongle, I connect to the serial port on the gumstix. I configured it through minicom to be 115200 8N1. After logging in as root:gumstix, I catted a file to see what version of the buildroot it was using.
# cat /etc/gumstix-release DISTRIB_ID='gumstix' DISTRIB_DESCRIPTION='' DISTRIB_RELEASE='1161' DISTRIB_CODENAME='' BUILD_DATE='Mon Nov 6 11:20:28 PST 2006' BUILD_HOSTNAME='azazel.hughes-family.org' #
Check out the buildroot by this version
So we need to check out build -r 1161. Easy enough. On my linux 'machine', I do the following
cd ~ && cd svn/ && svn export -r 1161 http://svn.gumstix.com/gumstix-buildroot/trunk gumstix-buildroot-1161
Installing a C++ compiler
If you want a C++ compiler, you have to either run the interactive version of make config, or you can apply this patch to .defconfig. I created the patch using diff -u (oldcfgfile) (newcfgfile) > gumstix-libstdcpp.patch, so you wouldn't have to edit the file.
+++ .defconfig.new 2008-02-18 13:07:59.000000000 -0700
@@ -83,7 +83,7 @@
BR2_GCC_VERSION="3.4.5"
# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set
BR2_EXTRA_GCC_CONFIG_OPTIONS=""
-# BR2_INSTALL_LIBSTDCPP is not set
+BR2_INSTALL_LIBSTDCPP=y
# BR2_INSTALL_OBJC is not set
#
@@ -341,7 +341,7 @@
# BR2_PACKAGE_XML2 is not set
# BR2_PACKAGE_XORG is not set
BR2_PACKAGE_ZLIB=y
-# BR2_PACKAGE_ZLIB_TARGET_HEADERS is not set
+BR2_PACKAGE_ZLIB_TARGET_HEADERS=y
#
# Target Options
Open and edit this file, copying the above contents into it. After creating this patch file, apply it like so:
patch -i gumstix-libstdcpp.patch .defconfig
Running the installation
The first time I ran this, it turns out I needed bison, flex, and gettext and texinfo. So, on my VMWare machine, run this before running any of the makes below, to avoid having to do maintenance during the install:
sudo apt-get install bison flex gettext texinfo zlib1g-dev
Copy and paste this line, to avoid messing up "L" and "1". The purpose of adding the "1161" at the end is to ensure that I know which version this is. Also, note that the export command, not co is used, to avoid needlessly copying a bunch of .svn files to my computer, which just clutter it up. If I need to update the repository, I have more things to worry about than this.
cd gumstix-buildroot-1161 && make defconfig && make
During this process, a bunch of files are downloaded (including a 40MB version of the linux kernel, and 13MB of binutils that never seems to download fast at all), and the kernel is configured. You may need to provide some help during the configuration process, though most of the params are correct by default...
Bug if you don't install texinfo
Then, something really troubling happened:
WARNING: `makeinfo' is missing on your system. You should only need it if
you modified a `.texi' or `.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy `make' (AIX,
DU, IRIX). You might want to install the `Texinfo' package or
the `GNU make' package. Grab either from any GNU archive site.
Wow, this is really annoying. I do have makeinfo installed, a simple call to which confirms it. Also, after installing texinfo with apt-get, I still got the error. SO, on http://docwiki.gumstix.org/Buildroot#Troubleshooting, there is a note about this problem. They recommend
rm -rf toolchain_build_arm_nofpu make
After installing texinfo. This worked for me, since I am using makeinfo v.4.8. If you have version 4.10 or 'higher', you are in trouble since the comparison script to see if 4.10 > 4.4 fails, since 4.1 < 4.4 (remember you these programs bit you in your freshman year?). Refer to the buildroot page if you have this bug.
This reminds me that guy from Office Space??:
MICHAEL Ok! Ok! I must have, I must have put a decimal point in the wrong place or something. S***. I always do that. I always mess up some mundane detail.
The bottom line is that by installing texinfo above, you can avoid all of this.
No c++ compiler installed
Well, this finally all completed, but in the end, I don't have a C++ development chain---just a regular C development chain. Hm. I looked up what I did on the ESCHER project to fix this:
make BR2_INSTALL_LIBSTDCPP=true
Ah, I guess that would have been good to know a while back.
Install of C++ fails
compr_zlib.c:39:18: error: zlib.h: No such file or directory
This means you need to have installed zlib on your LOCAL (building) machine. Why this is, I have no idea...but, there it is. To do this,
sudo apt-get install zlibc
It was added to the list above to prevent this error.
Running an example
Now that your crosscompile toolchain exists, let's use it! The best way to use it is to take advantage of something like autotools to do our crosscompilation setup for us. I have created an autotools "Hello World" program for the ECE473-573 class I taught at UA in Spring 2008.
wget http://www.ece.arizona.edu/~sprinkjm/teaching/ece473/uploads/Main/ece473-573-hw01-question1-1.0.tar.gz
Now, extract it and go into the directory
tar xzf ece473-573-hw01-question1-1.0.tar.gz && cd ece473-573-hw01-question1-1.0 && mkdir build-arm-linux && cd build-arm-linux
We have to setup our crosscompile toolchain in the right place. If you can't remember where you installed it, try
slocate arm-linux-gcc
If nothing comes up, you need to update your slocate
sudo slocate -u
Now, take that path (maybe it resembles the below) and add it to your ~/.bashrc
export BASECROSS=/home/compile1/svn/gumstix-buildroot-1161/build_arm_nofpu/staging_dir
export PATH=${PATH}:${BASECROSS}/bin
With this in hand, we build!
../configure --host=arm-linux && make
Now, we have our file---let's download it to the gumstix and bask in the glow of our professionalism. We are victorious. There is nothing in our way now, baby!
I configured my gumstix to be at 192.168.0.2, and just compiled this stuff on compile1.csl.ece.arizona.edu, and I'm running on my mac. No worries, scp is the bomb.
scp compile1@compile1:/tmp/ece473-573-hw01-question1-1.0/build-arm-linux/src/main root@192.168.0.2:~