[[labs.beatcraft.com]]
[[bc9]]

- Contents
#Contents

* Summary [#da11d31e]
>
This article shows how to create the bootable files of OpenEmbedded for bc9. OpenEmbedded is a build framework for~
embedded Linux, and it helps to install an embedded Linux for an embedded device. This article explains an installation~
process of gumstix-oe. This is an OpenEmbedded, which is specifucially designed for gumstix products. The article~
starts with the details of VMware, which is used for base of its development environment. Then, it contnues to provide~
the instructions of how to modify the kernel for bc9.~

* VMware [#g25d67e2]
>
The development environment (Ubuntu 8.04.3 LTS) is installed in VMware.~
The VMware image for '''bc9-oe-sdk''' is configured as shown below.~
- Version: 6.5 compatible
- Disk space: Virtual Disk 20G (Configure that 20G Virtual Disk is devided into 2G peaces) 
- Memory: 512M
--Change to the allocation of the size of memory and number of processors, edit '''memsize''' and '''numvcpu''' at the VMX file.
- Network: bridge network
- OS
-- Ubuntu 8.04.3 LTS (After installing 8.04.2LTS, update it)
-- Modifies the selected applications (shown below), and the rest of the applications remains untouched. Leave them as~
default conditon.
--  gnome-games and other games are removed for saving disk space.
 sudo apt-get remove gnome-card-dat gnome-games gnome-games-data libggzmod4
- ssh, ntp, vim, lv, natilus-open-terminal, adobe flash 10, and adobe acrorea are additionally installed.
- vmware- tools have already been installed.
- The default resolution is 1280 x 768.
- Network is configured as obtaining the address via dhcp.
- The pre-set User  and Password are '''beat''' and '''beatcraft''', respectively.

* gumstix-oe [#za572779]
>
This section describes how to install gumstix-oe on bc9. bc9 uses a gumstix for its CPU board, but it requires some~
modification on the original sorce files. This section explains how to alter the original source file.~
~
Change the configuration of Ubuntu.~
- Change the symbolic link from '''dash''' to '''bash''' at '''/bin/sh'''. (This prevents causing an error when '''bitbake''' is built.) 
 $ sudo dpkg-reconfigure dash
- Required application tools are installed.
 $ sudo apt-get update
 $ sudo apt-get install build-essential help2man diffstat texi2html texinfo libncurses5-dev cvs gawk 
 $ sudo apt-get install python-dev python-pysqlite2 python-psyco ckermit lrzsz subversion

** Obtaining gumstix-oe [#q9c9d0de]
>
Using '''svn checkout''' , obtain '''gumstix-oe'''. Apply the command lines listed below.
 $ mkdir ~/gumstix 
 $ cd ~/gumstix 
 $ svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe

** Setting up environment [#x753b309]
>
- Create the directory where the source code caches are saved.~
These are command that creates the directory, which stores  the source code. The source code is automatically downloaded~
as '''bitbake''' is executed.~
 $ sudo groupadd oe
 $ sudo usermod -a -G oe beat
 $ sudo mkdir /usr/share/sources
 $ sudo chgrp oe /usr/share/sources
 $ sudo chmod 0775 /usr/share/sources
 $ sudo chmod ug+s /usr/share/sources
Since group setting is applied for the management, after this process is completed, please '''logout''' once and '''login''' again.~
~
- Setting up environment.~
Applying the command below, the environment variable, which is required as executing '''bitbake''',~
is configured.
 $ cat ~/gumstix/gumstix-oe/extras/profile >> ~/.bashrc
Once this command is executed, the information of this environment variable is written into '''.bashrc''', and PATH always~
go through as '''bitbake''' is executed.

** Adjust source files [#e5205574]
>
Adjust the contents of build
- optimize '''iwmmxt''', and change '''FEED_ARCH''' to '''iwmmxt'''.
 beat@bc9-oe-sdk:~/gumstix/gumstix-oe$ svn diff com.gumstix.collection/conf/machine/include/tune-iwmmxt.inc
 Index: com.gumstix.collection/conf/machine/include/tune-iwmmxt.inc
 ===================================================================
 --- com.gumstix.collection/conf/machine/include/tune-iwmmxt.inc	(revision 318)
 +++ com.gumstix.collection/conf/machine/include/tune-iwmmxt.inc	(working copy)
 @@ -1,6 +1,9 @@
  # Configurations for the Intel PXA27x Appications Processor Family. 
  # Please use tune-xscale for PXA255/PXA26x based processors.
 -TARGET_CC_ARCH = "-march=iwmmxt -mcpu=iwmmxt -mtune=iwmmxt"
 +FEED_ARCH = "iwmmxt"
 +
 +TARGET_CC_ARCH = "-march=iwmmxt -mtune=iwmmxt"
 +TARGET_CC_KERNEL_ARCH = "-march=iwmmxt -mtune=iwmmxt"
  PACKAGE_ARCH = "iwmmxt"
  PACKAGE_EXTRA_ARCHS += "iwmmxt"

>
- Increase the size of kernel image. (Later kernel will be updated to 2.6.29, and the newer kernel requires a larger~
portion of the allocated aria.)~
 eat@bc9-oe-sdk:~/gumstix/gumstix-oe$ svn diff com.gumstix.collection/conf/machine/include/gumstix.inc
 Index: com.gumstix.collection/conf/machine/include/gumstix.inc
 ===================================================================
 --- com.gumstix.collection/conf/machine/include/gumstix.inc	(revision 318)
 +++ com.gumstix.collection/conf/machine/include/gumstix.inc	(working copy)
 @@ -10,7 +10,7 @@
  PREFERRED_PROVIDER_virtual/kernel = "gumstix-kernel"
  KERNEL_IMAGETYPE = "uImage"
  RDEPENDS_kernel-base = ""
 -KERNEL_IMAGE_MAXSIZE = "1048577"
 +KERNEL_IMAGE_MAXSIZE = "2097154"
 
  UBOOT_ENTRYPOINT = "a0008000"

>
- Booting from microSD, change to '''mmcboot'''. Bluetooth is disabled since bc9 does not intend to use Bluetooth.
 beat@bc9-oe-sdk:~/gumstix/gumstix-oe$ svn diff com.gumstix.collection/conf/machine/gumstix-custom-verdex.conf
 Index: com.gumstix.collection/conf/machine/gumstix-custom-verdex.conf
 ===================================================================
 --- com.gumstix.collection/conf/machine/gumstix-custom-verdex.conf      (revision 318)
 +++ com.gumstix.collection/conf/machine/gumstix-custom-verdex.conf	(working copy)
 @@ -5,12 +5,12 @@
  MACHINE_FEATURES += "verdex"
  MACHINE_FEATURES += "iwmmxt"
  require conf/machine/include/gumstix.inc
 -require conf/machine/include/tune-xscale.inc
 +require conf/machine/include/tune-iwmmxt.inc
  
  #
  # 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 = "30"
  
  #
  # Enable use of virtual terminal for LCD on tty1 if USE_VT = "1" 
 @@ -28,7 +28,7 @@
  #MACHINE_FEATURES  += "spi"
  
  MACHINE_FEATURES  += "serial"
 -MACHINE_FEATURES  += "bluetooth"
 +#MACHINE_FEATURES  += "bluetooth"
  MACHINE_FEATURES  += "sound"
 
  # if you enable robostix you will need to disable both "lcd" and "touchscreen" features
 @@ -51,7 +51,7 @@
  MACHINE_FEATURES  += "fat"
  
  # enable one of the following if you want to target build for uimage/rootfs on mmc/microSD or CF
 -#MACHINE_FEATURES  += "mmcroot"
 +MACHINE_FEATURES  += "mmcroot"
  #MACHINE_FEATURES  += "cfroot"
  
  #

** build [#sfa805b5]
>
Caution: as executing '''bitbake gumstix-basic-image''', it returns '''404 Not Found''' at the part of '''zlib-native-1.2.3'''. To obtain~
'''zlib-1.2.3''', edit '''bb file''' as it is shown below. 
(As of June 10, 2010, '''zlib''' is updated, and the current version is zlib-1.2.5.)
 $ vi gumstix/gumstix-oe/org.openembedded.snapshot/packages/zlib/zlib_1.2.3.bb
>
 LICENSE = "zlib"
 PR="r2"
 
 #SRC_URI = "http://www.zlib.net/zlib-1.2.3.tar.bz2 \
 SRC_URI = "http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.bz2
                 file://visibility.patch;patch=1 \
                 file://autotools.patch;patch=1 " 
 
 S = "${WORKDIR}/zlib-${PV}

>
Applying the command below, build the kernel for bootable microSD and userland.
 $ bitbake gumstix-basic-image
As the build process is completed, following files are generated.
 beat@bc9-oe-sdk:~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex$ ls -l
 total 18152
 -rw-r--r-- 1 beat beat 8576116 2009-07-24 18:57 Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20090724-gumstix-custom-verdex.rootfs.jffs2
 -rw-rw-r-- 1 beat beat 7081015 2009-07-24 18:57 Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20090724-gumstix-custom-verdex.rootfs.tar.gz
 lrwxrwxrwx 1 beat beat      94 2009-07-24 18:57 gumstix-basic-image-gumstix-custom-verdex.jffs2 -> Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20090724-gumstix-custom-verdex.rootfs.jffs2
 lrwxrwxrwx 1 beat beat      95 2009-07-24 18:57 gumstix-basic-image-gumstix-custom-verdex.tar.gz -> Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20090724-gumstix-custom-verdex.rootfs.tar.gz
 -rw-rw-r-- 1 beat beat 1881391 2009-07-24 18:24 modules-2.6.21-r1-gumstix-custom-verdex.tgz
 -rw-r--r-- 1 beat beat  998520 2009-07-24 18:24 uImage-2.6.21-r1-gumstix-custom-verdex.bin

>
The kernel, which is generated from the process above , is version 2.6.21. As building the bootable microSD, bc9 is intend~
using version 2.6.29. Applying the command line in the next section, kernel 2.6.21 will be replaced with 2.6.29. Actually~
the file required for the bootable microSD is only one, which is shown below.
 Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20090724-gumstix-custom-verdex.rootfs.tar.gz

** 2.6.29 kernel & modules [#mb9c9609]
>
'''linux-android-2.6.29 kernel''', which is generated form '''bc9-android-sdk''', is changed its name into '''linux-android-2.6.29''', and~
it is copied to the directory '''/home/beat/kernel_work/'''. After applying patch, '''linux-android-2.6.29''' is renamed to~
'''linux-android-2.6.29-bc9-r3'''. Create the environment set-up file, '''envsetup.sh''', which cross compiles only the kernel. This is~
how to create the environment set-up file.~
 #!/bin/sh
 
 export PATH=/home/beat/gumstix/gumstix-oe/tmp/cross/bin:$PATH
 export ARCH=arm
 export CROSS_COMPILE=arm-angstrom-linux-gnueabi-

>
Letting this file source, execute '''make''' on '''linux-android-2.6.29-bc9-rc3''', and it can perform kernel build.  To create the  microSD~
bootable files for bc9, the process requires extra work. To use the lines of code shown  below, create '''make-bc9-kernel.sh''', and~
execute this on '''linux-android-2.6.29-bc9-r3'''.~
 #!/bin/sh
 
 export LANG=C
 
 GUMSTIX_HOME=" /home/beat/gumstix/gumstix-oe"
 SYSMAP="./System.map"
 
 TOOL_PREFIX="${GUMSTIX_HOME}/tmp/cross/bin/arm-angstrom-linux-gnueabi-"
 DEPMOD="${TOOL_PREFIX}depmod-2.6"
 OBJCOPY=${TOOL_PREFIX}objcopy
 MKIMG=${GUMSTIX_HOME}/tmp/staging/i686-linux/bin/uboot-mkimage
 UBOOT_ENTRYPOINT="a0008000"
 MOD_WORKDIR="./mod_work"
 
 make ARCH=arm CROSS_COMPILE=${TOOL_PREFIX} prepare
 KERNREL=`make kernelrelease`
 KERNVER=`make kernelversion`
 KERNIMG="uImage-${KERNREL}.bin"
 MODTGZ="modules-${KERNREL}.tgz"
 KERNIMGLN="uImage-${KERNVER}-bc9.bin"
 MODTGZLN="modules-${KERNVER}-bc9.tgz"
 
 echo "### Cleanup"
 rm -rf ${MOD_WORKDIR}
 rm -f ${KERNIMG} ${MODTGZ} ${KERNIMGLN} ${MODTGZLN}
 
 echo "### Build kernel"
 make ARCH=arm CROSS_COMPILE=${TOOL_PREFIX}
 if [ $? != 0 ]; then
     echo "*** Failed to build kernel"
     exit 1
 fi
 
 echo "### Make kernel image"
 ${OBJCOPY} -O binary -R .note -R .comment \
 -S ./arch/arm/boot/compressed/vmlinux linux.bin
 if [ $? != 0 ]; then
     echo "*** Failed to make kernel image"
     exit 1
 fi
 
 ${MKIMG} -A arm -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} \
 -e ${UBOOT_ENTRYPOINT} -n "oe/verdex/arm" -d linux.bin ${KERNIMG}
 if [ $? != 0 ]; then
     echo "*** Failed to make kernel image"
     exit 1
 fi 
 
 ln -s ${KERNIMG} ${KERNIMGLN}
 
 echo "### Install modules"
 make ARCH=arm DEPMOD=echo INSTALL_MOD_PATH=${MOD_WORKDIR} modules_install
 if [ $? != 0 ]; then
     echo "*** Failed to modules_install"
    exit 1
 fi
 
 ${DEPMOD} -A -b ${MOD_WORKDIR} -F ${SYSMAP} ${KERNREL}
 if [ $? != 0 ]; then
     echo "*** Failed to depmod modules"
     exit 1
 fi
 
 echo "### Make modules tar ball"
 tar czvf ${MODTGZ} -C ${MOD_WORKDIR} lib
 if [ $? != 0 ]; then
     echo "*** Failed to make modules tarball"
     exit 1
 fi 
 
 ln -s ${MODTGZ} ${MODTGZLN}
 
 echo "### Finished"
 ls -l ${KERNIMG} ${MODTGZ}  
 
>
As '''make''' is completed, the make process generates the standard files such as '''vmlinux'''. In addtion to these standard files, this~
make process also creates bc9 specific:~
 -rw-rw-r--  1 beat beat 1.4M 2009-07-28 20:39 modules-2.6.29-bc9-r3.tgz
 lrwxrwxrwx  1 beat beat   25 2009-07-28 20:39 modules-2.6.29-bc9.tgz -> modules-2.6.29-bc9-r3.tgz
 -rw-rw-r--  1 beat beat 1.5M 2009-07-28 20:38 uImage-2.6.29-bc9-r3.bin
 lrwxrwxrwx  1 beat beat   24 2009-07-28 20:38 uImage-2.6.29-bc9.bin -> uImage-2.6.29-bc9-r3.bin

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