[[Software/Android]]~
[[Software/Android/bc9]]~
[[Software/Android/bc9/kernel(2/2)]]
#contents

*Setup Android bootable linux kernel and userland for bc9 (gumstix) 1 [#f63b053a]

**Setting up gumstix build environment [#mf860689]
We use gumstix OpenEmbedded (OE) build system (bitbake).~
Bitbake is originally [[OpenEmbedded:http://wiki.openembedded.net/index.php/Main_Page]] build environment and [[Gumstix,Inc.:http://www.gumstix.com/]] modified it for their own purposes.~

Before you proceed, please understand standard setting up procedure of gumstix.
-[[gumstix developer site - Getting started:http://www.gumstix.net/Software/cat/Getting-started/111.html]]
-[[gumstix developer site - Setting up a build environment:http://www.gumstix.net/Software/view/Getting-started/Setting-up-a-build-environment/111.html]]
-[[gumstix developer site - Replacing the file system image:http://www.gumstix.net/Software/view/Getting-started/Replacing-the-file-system-image/111.html]]

**Check out source [#x1c35072]
 $ mkdir ~/gumstix 
 $ cd ~/gumstix 
 $ svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe

**Setting up Environment (shell) [#da43bdd3]
If you prefer setting up Environment via bash profile, do:
 $ cat gumstix-oe/extras/profile >> ~/.bashrc
If you prefer setting up Environment temporally, do:
 $ . ~/gumstix/gumstix-oe/extras/profile
or
 $ source  ~/gumstix/gumstix-oe/extras/profile

**Setting up source code caching [#efde2f96]
Gumstix OE downloads source code during build operation. ~
So in order to avoid repeating download of every build operation, you had better to set up source code caching directory.~
At first, add new group for cache management and add operating user to this group.
 $ sudo groupadd oe
 $ sudo usermod -a -G oe {your_username}
Next make source code storing directory and set owner and permission appropriately.
 $ sudo mkdir /usr/share/sources
 $ sudo chgrp oe /usr/share/sources
 $ sudo chmod 0775 /usr/share/sources
 $ sudo chmod ug+s /usr/share/sources

**Adjusting build contents [#rff0a69e]
Current default kernel version of gumstix verdex pro is 2.6.21.~
In contrast Android R1 kernel is version 2.6.25 kernel plus some Android unique drivers. ~
So we upgrade gumstix's kernel to version 2.6.24, which is less different to Android R1 2.6.25 kernel than 2.6.21.~
Then we made patch from diff of 2.6.24 gumstix kernel and 2.6.25 android kernel.

With following adjustments, this patch is automatically applied during build operation.~

Procedures are as follows:

+~Changing building kernel version~
 ~/gumstix/gumstix-oe/com.gumstix.collection/conf/machine/include/gumstix.inc
Modify this file as follows:
 diff -u gumstix.inc.original gumstix.inc 
 --- gumstix.inc.original	2009-03-27 21:30:00.000000000 +0900
 +++ gumstix.inc	2009-03-24 22:48:10.000000000 +0900
 @@ -35,7 +35,7 @@
  PREFERRED_PROVIDER_bluez-utils-dbus = "bluez-utils"
  PREFERRED_PROVIDER_gsmd="libgsmd"
 
 -PREFERRED_VERSION_gumstix-kernel = "2.6.21"
 +PREFERRED_VERSION_gumstix-kernel = "2.6.24"
  PREFERRED_VERSION_udev = "118"
  PREFERRED_VERSION_gnuplot = "4.0.0"
  PREFERRED_VERSION_dropbear = "0.47"
+~Adjusting system image contents~
 ~/gumstix-default-2.6.24/gumstix-oe/com.gumstix.collection/conf/machine/gumstix-custom-verdex.conf
Modify this file as follows:
 diff -u gumstix-custom-verdex.conf.original gumstix-custom-verdex.conf
 --- gumstix-custom-verdex.conf.original	2009-03-30 15:02:26.000000000 +0900
 +++ gumstix-custom-verdex.conf	2009-03-25 13:48:26.000000000 +0900
 @@ -9,8 +9,8 @@
 
  #
  # Your flash size = Total flash (in MB) - 1 (for linux kernel partition)
 -ROOT_FLASH_SIZE = "15"
 -#ROOT_FLASH_SIZE = "31"
 +#ROOT_FLASH_SIZE = "15"
 +ROOT_FLASH_SIZE = "31"
 
  #
  # Enable use of virtual terminal for LCD on tty1 if USE_VT = "1"
+~Removing unbuildable module~
When you upgrade gumstix's kernel version to 2.6.24, wifistix module can't be built.~
 ~/gumstix/gumstix-oe/com.gumstix.collection/packages/tasks/task-base-gumstix.bb
So remove this module's build difinition from bitbake setting file as follows:
 --- task-base-gumstix.bb.original	2009-03-26 17:09:52.000000000 +0900
 +++ task-base-gumstix.bb	2009-03-30 17:10:04.000000000 +0900
 @@ -201,7 +201,6 @@
   
  RDEPENDS_task-base-gumstix-wifi = "\
      task-base-gumstix-pcmcia \
 -    wifistix-modules \
      wireless-tools \
      wpa-supplicant \
+~Adding patch during kernel build in bitbake~
 ~gumstix/gumstix-oe/com.gumstix.collection/packages/linux/gumstix-kernel_2.6.24.bb
Modify this bitbake config file as follows:
 diff -u gumstix-kernel_2.6.24.bb.original gumstix-kernel_2.6.24.bb
 --- gumstix-kernel_2.6.24.bb.original	2009-03-26 19:23:32.000000000 +0900
 +++ gumstix-kernel_2.6.24.bb	2009-03-27 22:01:53.000000000 +0900
 @@ -46,7 +46,8 @@
         file://smc911x-fixup.patch;patch=1 \
         file://smc91x-fail-if-no-chip.patch;patch=1 \
         file://one-wire.patch;patch=1 \
 +       file://diff-kernel-original-android.patch;patch=1 \
         ${@base_contains('MACHINE_FEATURES', 'rgb16','file://pxafb-backto16.patch;patch=1', '',d)} \
         "
Here is patch file added in above procedure.~
&ref(diff-kernel-original-android.patch);~
This file applies following modifications to gumstix's original kernel source code.~
・Adding Android unique drivers required to boot Android userland~
・Fix of some Kconfig and Makefile~
・Modification of Framebuffer driver (add panning function to pxafb.c)~
Put it in following directory:
 ~gumstix/gumstix-oe/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.24/
+~Tochscreen driver adjustment~
&ref(tsc2003.c);~
This is modified touchscreen driver (tsc2003.c) for Android.~
Because of execution procedure of gumstix-kernel_2.6.24.bb, this file can't be included in diff-kernel-original-android.patch file.~
Download and replace original tsc2003.c with this file.~
Original tsc2003.c is in following directory: 
 ~gumstix/gumstix-oe/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.24/
+~defconfig adjustment~
When you apply above patch and adjustments, you also require additional item in kernel config for Android drivers.~
&ref(defconfig);~
Download and recplace original gumstix's defconfig with this modified defconfig.~
Original defconfig is in following directory:
 ~gumstix/gumstix-oe/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.24/gumstix-custom-verdex/

**building source code [#rf33984b]
After finish adjustments, proceed the build as follows:
 bitbake gumstix-basic-image
Bitbake downloads all source code and build ARM Cross Toolchain during the first build.~
When the build is finished, onboard FlashROM installable kernel image file and system image file are generated.~
 $ ls -1 ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/
 Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20090330-gumstix-custom-verdex.rootfs.jffs2
 gumstix-basic-image-gumstix-custom-verdex.jffs2 (simlink to above Angstrom....jffs2)
 modules-2.6.24-r1-gumstix-custom-verdex.tgz
 uImage-2.6.24-r1-gumstix-custom-verdex.bin
Additionally do following build:
 bitbake gumstix-directfb-image
System image file which include DirectFB library and commands are generated.
 Angstrom-gumstix-directfb-image-glibc-ipk-2007.9-test-20090330-gumstix-custom-verdex.rootfs.jffs2
 gumstix-directfb-image-gumstix-custom-verdex.jffs2 (simlink to above Angstrom...)
This system image file is convenient to check functions of framebuffer driver.~
By using DirectFB test applications such as df_dok or df_neo, you can check framebuffer driver drawing function before you boot Android.


[[Software/Android/bc9/kernel(2/2)]]


---------------------------------------
RIGHT:by Satoshi OTSUKA


Front page   Edit Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes