doc:appunti:prog:openmoko_compile
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:appunti:prog:openmoko_compile [2009/10/13 19:18] – niccolo | doc:appunti:prog:openmoko_compile [2009/12/17 12:20] (current) – niccolo | ||
---|---|---|---|
Line 3: | Line 3: | ||
Per compilare un' | Per compilare un' | ||
- | * **[[http:// | + | * **[[http:// |
* **[[http:// | * **[[http:// | ||
* **[[http:// | * **[[http:// | ||
Line 9: | Line 9: | ||
===== Installare la toolchain ===== | ===== Installare la toolchain ===== | ||
- | Per installare la toolchain su Debian si possono usare queste istruzioni: **[[http:// | + | Per installare la toolchain su Debian |
- | * **ccache** | + | Si installano preventivamente i pacchetti: |
- | Si scarica la toolchain precompilata dal **[[http:// | + | < |
+ | apt-get install alien autoconf automake autotools-dev build-essential ccache check curl \ | ||
+ | fakeroot gettext intltool libgconf2-dev libglib2.0-dev libtool libxrender-dev mtools uboot-mkimage | ||
+ | </ | ||
+ | |||
+ | Si scarica la toolchain precompilata dal **[[http:// | ||
- | Eseguiamo l' | + | Scegliamo |
< | < | ||
Line 53: | Line 58: | ||
==== Installazione delle dipendenze ==== | ==== Installazione delle dipendenze ==== | ||
- | Se il programma da compilare dipende da una libreria OpenMoko | + | Se il programma da compilare dipende da una libreria OpenMoko, bisogna installarla nella toolchain. Prima di tutto si deve impostare i repository da cui attingere in **'' |
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | arch all 1 | ||
+ | src/gz all http:// | ||
+ | arch armv4t 26 | ||
+ | src/gz armv4t http:// | ||
+ | arch om-gta02 31 | ||
+ | src/gz om-gta02 http:// | ||
+ | </ | ||
+ | |||
+ | Ecco l' | ||
< | < | ||
. / | . / | ||
opkg-target update | opkg-target update | ||
- | opkg-target list |grep edje-dev | + | opkg-target list |
- | opkg-target install | + | opkg-target install |
</ | </ | ||
- | ===== Creare un pacchetto | + | L' |
+ | I pacchetti vengono installati sotto **''/ | ||
+ | |||
+ | ===== Compiling a large project: Navit ===== | ||
+ | |||
+ | Remember to improve the page [[http:// | ||
+ | |||
+ | How to cross-compile a large project like Navit for the OpenMoko/ | ||
+ | |||
+ | First of all, edit the ''/ | ||
+ | |||
+ | < | ||
+ | export OMTOOL_DIR=/ | ||
+ | </ | ||
+ | |||
+ | After toolchain installation, | ||
+ | |||
+ | < | ||
+ | . / | ||
+ | opkg-target list | ||
+ | opkg-target install gpsd-dev | ||
+ | opkg-target install gtk+-dev | ||
+ | opkg-target install libspeechd-dev | ||
+ | </ | ||
+ | |||
+ | Now we check-out Navit sources from the SVN repository and we make an archive just in case we need the pristine sources in the future: | ||
+ | |||
+ | < | ||
+ | svn co https:// | ||
+ | tar zcvf navit-svn-2670.tar.gz navit | ||
+ | </ | ||
+ | |||
+ | Instead of running the traditional **'' | ||
+ | |||
+ | Because Navit on the OpenMoko FreeRunner requires some configure options, we will pass them to the script. Run '' | ||
+ | |||
+ | < | ||
+ | om-conf --host=arm-angstrom-linux-gnueabi --enable-avoid-unaligned --enable-avoid-float \ | ||
+ | --enable-cache-size=20971520 --with-saxon=saxon-xslt --with-xslts=openmoko \ | ||
+ | --enable-svg2png-scaling=16, | ||
+ | navit | ||
+ | </ | ||
+ | |||
+ | In the example above we used some **'' | ||
+ | |||
+ | **'' | ||
+ | |||
+ | **'' | ||
+ | |||
+ | **'' | ||
+ | |||
+ | |||
+ | It's time to cross-compile: | ||
+ | |||
+ | < | ||
+ | cd navit | ||
+ | make | ||
+ | </ | ||
+ | |||
+ | ===== Make an .opk package | ||
+ | |||
+ | === Using the toolchains === | ||
+ | |||
+ | The OpenMoko toolchain provides the **'' | ||
+ | |||
+ | < | ||
+ | . / | ||
+ | om-make-ipkg navit navit-control | ||
+ | </ | ||
+ | |||
+ | The control file is described [[http:// | ||
+ | |||
+ | If you need more control files (e.g. a '' | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/sh -e | ||
+ | |||
+ | error_exit () { | ||
+ | echo usage: $(basename ${0}) [app_dir_name] [ipkg_control_file] | ||
+ | exit 1 | ||
+ | } | ||
+ | |||
+ | test x${OMTOOL_DIR} = x && . / | ||
+ | . ${OMTOOL_DIR}/ | ||
+ | S=${1} | ||
+ | (test x${S} = x || test ! -d ${S}) && error_exit | ||
+ | appname=$(basename ${S}) | ||
+ | tmpdir=/ | ||
+ | test -e " | ||
+ | make -C ${S} install DESTDIR=" | ||
+ | # Copy control files to destination directory. | ||
+ | cp -pr opkg/* ${tmpdir} | ||
+ | ipkg-build -o 0 -g 0 ${tmpdir} | ||
+ | rm -rf ${tmpdir} | ||
+ | </ | ||
+ | |||
+ | Control files and other files are arranged into the '' | ||
+ | |||
+ | < | ||
+ | opkg/ | ||
+ | opkg/ | ||
+ | opkg/ | ||
+ | </ | ||
+ | |||
+ | === Using opkg-utils === | ||
+ | |||
+ | The **[[http:// | ||
+ | |||
+ | The current opkg code is in [[http:// | ||
- | Simply do an: | ||
< | < | ||
svn co http:// | svn co http:// | ||
</ | </ | ||
- | and use the instructions of ipkg's website but the software from this checkout, the opkg-build. | ||
+ | and use the instructions of ipkg's website but the software from this checkout. The main script is **'' | ||
+ | |||
+ | ===== Qemu and the GTA02 FreeRunner ===== | ||
+ | |||
+ | **WARNING**: | ||
+ | |||
+ | Install the Debian packages **gcc-3.4** and **libsdl1.2-dev**, | ||
+ | |||
+ | Edit the **'' | ||
+ | |||
+ | < | ||
+ | # Entries for GTA01 | ||
+ | kernel_wildcard=" | ||
+ | rootfs_wildcard=" | ||
+ | uboot_wildcard=" | ||
+ | download_dir=" | ||
+ | </ | ||
+ | |||
+ | Run the **'' | ||
+ | |||
+ | For the (failed) attempt to run the GTA02 FreeRunner emulator we need different Qemu parameters and different images: | ||
+ | |||
+ | < | ||
+ | qemu_relative=" | ||
+ | # Entries for GTA02, Om2008.12 | ||
+ | kernel_wildcard=" | ||
+ | rootfs_wildcard=" | ||
+ | uboot_wildcard=" | ||
+ | download_dir=" | ||
+ | </ | ||
+ | |||
+ | The **'' | ||
+ | |||
+ | < | ||
+ | # GTA02 | ||
+ | $(FLASHIMG): | ||
+ | # Making an empty/ | ||
+ | $(echo) -en \\0377\\0377\\0377\\0377\\0377\\0377\\0377\\0377 > .8b | ||
+ | cat .8b .8b .8b .8b .8b .8b .8b .8b > .64b # OOB is 64 bytes | ||
+ | cat .64b .64b .64b .64b .64b .64b .64b .64b > .2048b | ||
+ | cat .64b .64b .64b .64b .64b .64b .64b .64b >> .2048b | ||
+ | cat .64b .64b .64b .64b .64b .64b .64b .64b >> .2048b | ||
+ | cat .64b .64b .64b .64b .64b .64b .64b .64b >> .2048b | ||
+ | cat .2048b .64b > .sec # A sector is 2048 bytes of data + OOB | ||
+ | cat .sec .sec .sec .sec .sec .sec .sec .sec > .8sec | ||
+ | cat .8sec .8sec .8sec .8sec .8sec .8sec .8sec .8sec > .64sec | ||
+ | cat .64sec .64sec .64sec .64sec .64sec .64sec .64sec .64sec > .512sec | ||
+ | cat .512sec .512sec .512sec .512sec > .2ksec | ||
+ | cat .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec > .16ksec | ||
+ | # Neo GTA02 NAND is 128k sectors big | ||
+ | cat .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec > $@ | ||
+ | rm -rf .8b .64b .2048b .sec .8sec .64sec .512sec .2ksec .16ksec | ||
+ | </ | ||
+ | |||
+ | The **'' | ||
+ | |||
+ | < | ||
+ | s3c_nand_read: | ||
+ | </ | ||
+ | |||
+ | May be there are more instructions for the GTA02 in the [[http:// | ||
+ | |||
+ | FIXME We can manually run the emulator to get the U-Boot prompt, but here we have to partition and flash the NAND manually. | ||
+ | |||
+ | < | ||
+ | arm-softmmu/ | ||
+ | -mtdblock openmoko-flash.base \ | ||
+ | -kernel u-boot.bin \ | ||
+ | -serial stdio -nographic -usb -monitor null | ||
+ | </ |
doc/appunti/prog/openmoko_compile.1255454293.txt.gz · Last modified: 2009/10/13 19:18 by niccolo