updated kernel build how-to, from scratch

Gergely Imreh imrehg at gmail.com
Tue Jan 6 10:41:03 CET 2009


  I was checking out how to compile my own kernel (uImage) for my
GTA02, but run into a few problem while following the wiki - which now
seems seriously out of date. In the end I managed to compile a kernel,
and my Neo boots, though it seems a lot of things won't work.

  I was thinking to update the wiki, and in the meantime figure out
how things _really_ should be done, so here's a little run through of
my steps, maybe someone who _does_ know what he/she is doing, could
spot any gaps or errors....

  This is starting from absolute zero (which might explain while my
things don't work, but other developers' already set up environment is

1) Get the toolchain (as it is linked on the wik [1]), set it up in
the proper directory, add to PATH
2) The kernel packaging will need mkimage, so get the u-boot git
(almost like on [2])
  git clone git://git.openmoko.org/git/u-boot.git u-boot
In the u-boot directory switch to a branch, I took the origin/stable,
as the name was promising:
  git checkout -b mystable origin/mystable
Build u-boot:
It finishes though wiht a lot of warnings, an I got a shiny new
mkimage in the tools dir.
Add the ...../u-boot/tools dir to the PATH.
3) Check out the openmoko kernel, as on [1]
  git clone git://git.openmoko.org/git/kernel.git linux-2.6
In the linux-2.6 switch to a branch:
  git checkout -b mystable origin/andy-tracking
To build the kernel, I have to make a directory first (not going
"dummy", like on the wiki), for the GTA02, for example, make the
directory GTA02 in the kernel's root dir.
  mkdir GTA02
Copy the kernel config there
  cp arch/arm/configs/gta02-moredrivers-defconfig GTA02/.config
Export some flags (as taken from [1])
  export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib
-rpath-link ${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -O1"
Have to edit the .build, because at its current form it will install
the modules to the wrong directory: for me, it puts them in
GTA02/GTA02/staging, instead of GTA02/staging:

diff --git a/build b/build
index 4dde6aa..c6c3afb 100755
--- a/build
+++ b/build
@@ -94,7 +94,7 @@ if make -j5 O=$1 ARCH=arm
                rm -rf $1/staging
                mkdir -p $1/staging
                if [ ! -z "$2" ] ; then
-                       make O=$1 ARCH=arm modules_install
+                       make O=$1 ARCH=arm modules_install
                        cd $1/staging
                        tar czf ../modules$VERSION.tar.gz .
                        cd ../..

With this I'm ready to build:
  ./build GTA02 dummy
Now this is different from the wiki, have to give a proper directory
otherwise it won't build, and have to give a dummy argument to build
the modules tar.gz
After some time it finishes, and the new uImage-(version).bin +
modules-(version).tar.gz is in the GTA02 directory.
With the current settings (so many features previously in module now
compiled in) the uImage will be above 2Mb, so use the QI bootloader.

So that would be the way that I did things, please let me know if I
missed something, otherwise I will write it up properly for the wiki
(and maybe the linux-2.6 git page info should be changed as well, as
it is wrong about the ./build arguments).

After all this, does the current andy-tracking kernel work properly
for everybody else? Or which version of the userspace programs one
needs to make them work? I think mine somewhere about 2008.9. Having
asked this, I haven't tested it extensively (it took a while to figure
out the previous section, and the compile wasn't that quick on my

I know this is marginally "developers" topic, but I have a feeling
that I'm not the only one who is confused by the outdated information,
and don't want to spend days to figure out how to get everything
running. Now I'm looking forward to some actual hacking.... :)


[1] http://wiki.openmoko.org/wiki/Toolchain
[2] http://wiki.openmoko.org/wiki/Uboot

More information about the devel mailing list