These instructions are for the no-frills sofware that comes with the mini2440. Nothing fancy, just the default Qtopia 2.2.0 on 2.6.29.
Host Linux (Ubuntu 9.10 - 32bit)
I can't stand Red Hat so I couldn't bring myself to use the arm9.net RH9 iso for the host pc. Instead, I shot myself in the foot by using a 64bit version of Ubuntu 9.10. This was more trouble than it's worth and ultimately I couldn't resolve all the 64/32bit library issues, so I installed a vmware image of 32bit Ubuntu 9.10.
Dependencies
With a brand new 9.10 install, run the updater and then get these additional packages.
sudo apt-get install g++ libx11-dev libxmu-dev libxext-dev zlib1g-dev libjpeg62-dev libssl-dev uuid-dev
The arm-linux-gcc-4.3.2 toolchain
The following is based on the instructions found in this very handy manual PDF (English) with some minor changes for Ubuntu.
We'll need these archives from the DVD or website
arm-linux-gcc-4.3.2.tgz examples.tgz
Extract the contents
chmod +x *.tgz
sudo tar xfzv arm-linux-gcc-4.3.2.tgz -C /
Add the bins to your path
sudo gedit /etc/bash.bashrc (and add this line: PATH=$PATH:/usr/local/arm/4.3.2/bin )
reload your profile and see if they are found
arm-linux-gcc -v
If all went well, you should see this:
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: ....[config details]
Thread model: posix
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
Install the examples
Note: the "opt/FriendlyARM/mini2440" path name is hard-coded into the build scripts so unless you want to adjust them, you should use this convention (case sensitive)
sudo mkdir /opt/FriendlyARM
sudo mkdir /opt/FriendlyARM/mini2440
sudo tar xfz examples.tgz -C /opt/FriendlyARM/mini2440/
sudo chown -R [yourgroup]:[youruser] /opt/FriendlyARM
sudo chown -R [yourgroup]:[youruser] /opt/FriendlyARM
now verify the tooling by compiling one of the examples:
cd /opt/FriendlyARM/mini2440/examples/hello/
make
You should see:
arm-linux-gcc -o hello hello.c
and the binary appears as well:
ubuntu:/opt/FriendlyARM/mini2440/examples/hello$ ls -l
-rwxr-xr-x 1 user:user 5061 2010-02-01 01:30 hello
-rw-r--r-- 1 user:user 73 2006-08-25 13:48 hello.c
-rw-r--r-- 1 user:user 98 2004-10-09 14:23 Makefile
check the executable:
file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
Follow the instructions in the PDF above for moving the file to the 2440 and running it.
These examples demonstrate some of the hardware bits that are available on the 2440. They dont use qt though, so if you want to build an app with a gui, then you'll need to read on...
Installing x86-qtopia
x86-qtopia provides tools and support for developing qt applications and running them on the host pc in a simulated embedded environment. Here's how to set it up.
Extract the archive to: /opt/FriendlyARM/mini2440/
sudo tar xfvz x86-qtopia.tar.gz -C /opt/FriendlyARM/mini2440
Extract the individual archives:
cd /opt/FriendlyARM/mini2440/x86-qtopia/
sudo chmod +x *.gz
sudo tar xfz qtopia-2.2.0.tar.gz
sudo tar xfz konq.tar.gz
mkdir qtopia-2.2.0-FriendlyARM/qtopia/image
sudo tar xfvz fonts.tar.gz -C qtopia-2.2.0-FriendlyARM/qtopia/image
sudo chmod +x *.gz
sudo tar xfz qtopia-2.2.0.tar.gz
sudo tar xfz konq.tar.gz
mkdir qtopia-2.2.0-FriendlyARM/qtopia/image
sudo tar xfvz fonts.tar.gz -C qtopia-2.2.0-FriendlyARM/qtopia/image
Some of the source code needs to be adjusted slightly in order to compile. Big thanks for the help here and here (skip2816)
Edit the four files below as noted:
sudo gedit /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/libraries/qtopia/qmemoryfile_unix.cpp
line 141: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY);
line 141: +++ f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, (S_IRUSR|S_IWUSR));
sudo gedit /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/src/tools/qmemoryfile_unix.cpp
line 143: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY);
line 143: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, (S_IRUSR|S_IWUSR));
sudo gedit /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/libraries/qtopia/backend/vobject.cpp
line 419: --- char *dot = strrchr(g,'.');
line 419: +++ char *dot = (char *) strrchr(g,'.');
sudo gedit /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/plugins/codecs/wavplugin/wavplugin.cpp
line 435: char *ext = strrchr( path.latin1(), '.' );
line 435: char *ext = (char *) strrchr( path.latin1(), '.' );
line 141: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY);
line 141: +++ f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, (S_IRUSR|S_IWUSR));
sudo gedit /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/src/tools/qmemoryfile_unix.cpp
line 143: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY);
line 143: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, (S_IRUSR|S_IWUSR));
sudo gedit /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/libraries/qtopia/backend/vobject.cpp
line 419: --- char *dot = strrchr(g,'.');
line 419: +++ char *dot = (char *) strrchr(g,'.');
sudo gedit /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/plugins/codecs/wavplugin/wavplugin.cpp
line 435: char *ext = strrchr( path.latin1(), '.' );
line 435: char *ext = (char *) strrchr( path.latin1(), '.' );
Grab ownership or else the install will fail...
sudo chown -R [youruser]:[yourgroup] /opt/FriendlyARM/
I edited the build scripts to remove the initial archive removal and extractions. This will prevent the source code changes above from being deleted and overwritten (which the scripts will do). Alternatively, you can simply run the configure statement by hand, then run make, make install, etc..
UPDATE: I've posted the build scripts I've used here.
Finally you can run the build...
./build-all
That should do it.
Installing arm-qtopia
Extract the archive to /opt/FriendlyARM/mini2440/
sudo tar xfz arm-qtopia.tgz -C /opt/FriendlyARM/mini2440/
Edit the build scripts to remove the tar and rm entries
sudo gedit build build-konq
Manually extract the archives:
cd /opt/FriendlyARM/mini2440/
sudo chmod +x *.gz
sudo tar xfz qtopia-2.2.0.tar.gz
sudo tar xfz konq.tar.gz
sudo tar xfz fonts.tar.gz
sudo chmod +x *.gz
sudo tar xfz qtopia-2.2.0.tar.gz
sudo tar xfz konq.tar.gz
sudo tar xfz fonts.tar.gz
Edit the following source files as indicated.
sudo gedit /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/libraries/qtopia/qmemoryfile_unix.cpp line 141: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY);
line 141: +++ f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, (S_IRUSR|S_IWUSR));
sudo gedit /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qt2/src/tools/qmemoryfile_unix.cpp
line 143: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY);
line 143: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, (S_IRUSR|S_IWUSR));
sudo gedit /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/libraries/qtopia/backend/vobject.cpp
line 419: ---char *dot = strrchr(g,'.');
line 419: +++char *dot = (char *) strrchr(g,'.');
sudo gedit /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/plugins/codecs/wavplugin/wavplugin.cpp
line 435: ---char *ext = strrchr( path.latin1(), '.' );
line 435: +++char *ext = (char *) strrchr( path.latin1(), '.' );
line 141: +++ f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, (S_IRUSR|S_IWUSR));
sudo gedit /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qt2/src/tools/qmemoryfile_unix.cpp
line 143: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY);
line 143: --- f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, (S_IRUSR|S_IWUSR));
sudo gedit /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/libraries/qtopia/backend/vobject.cpp
line 419: ---char *dot = strrchr(g,'.');
line 419: +++char *dot = (char *) strrchr(g,'.');
sudo gedit /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/plugins/codecs/wavplugin/wavplugin.cpp
line 435: ---char *ext = strrchr( path.latin1(), '.' );
line 435: +++char *ext = (char *) strrchr( path.latin1(), '.' );
Grab ownership or else the install will fail...
sudo chown -R [youruser]:[yourgroup] /opt/FriendlyARM/
UPDATE: I've posted the build scripts I've used here.
run the build...
./build-all
Building an example (host)
Once the tools are in place, you can run a qt example and run it on the host.
Build the example:
cd /opt/FriendlyARM/mini2440/x86-qtopia/hello
./build
Change the last line of the run-hello script to find the hello executable:
sudo gedit run-hello
line 17: --- hello -qwsline 17: +++ /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/bin/hello -qws
./run-hello
At this point you should see the emulator display the hello example:
Building an example (arm)
Building the example for the embedded device is similar:
cd /opt/FriendlyARM/mini2440/arm-qtopia/hello
./build
./build
Now move the binary to this folder so we can transfer it to the device (optional)
cp ../qtopia-2.2.0-FriendlyARM/qtopia/bin/hello .
To run this app on the 2440, first we have to move it there...
Moving the example app to the mini2440 (via ftp)
Since I'm running a linux vm under windows, I had to manually assign an ip address to my local area connection ( 192.168.1.120 ) via network connections. Then I can ftp from the linux vm (which I set up to use NAT) to the 2440 via the crossover cable.
dev@ubuntu:/opt/friendlyARM/mini2440/arm-qtopia/hello$ ftp 192.168.1.230
Connected to 192.168.1.230.220 FriendlyARM FTP server (Version 6.4/OpenBSD/Linux-ftpd-0.17) ready.
Name (192.168.1.230:dev): root
331 Password required for root.Password:
230 User root logged in.Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /tmp
250 CWD command successful.ftp> put hello
local: hello remote: hello200 PORT command successful.
150 Opening BINARY mode data connection for 'hello'.
226 Transfer complete.
39082 bytes sent in 0.01 secs (7352.3 kB/s)
ftp> put hello.desktop
local: hello.desktop remote: hello.desktop200 PORT command successful.
150 Opening BINARY mode data connection for 'hello.desktop'.
226 Transfer complete.
97 bytes sent in 0.06 secs (1.7 kB/s)
ftp> quit
Running the app on the mini2440
In terminal on the 2440:
chmod +x hello
mv hello /opt/Qtopia/bin
mv hello.desktop /opt/Qtopia/apps/Applications
Reboot the MINI2440
Hello2440 should now appear in the Applications menu, where you can run it.
Where to go from here...
Along with the tooling you also installed the Qtopia documentation. To find the api docs, tutorials and lots of other information, point your browser here:
Qtopia docs:
file:///opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/doc/html/index.html
Qte docs:
file:///opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/doc/html/index.html
Good luck
Hope this guide is helpful and good luck with your own projects.