bc9/bc9-oe-sdk

bc9-oe-sdk setup

Vmware

bc9-oe-sdk での Vmware イメージの設定を記述します。

  • Version:6.5互換
  • Disk 容量:仮想ディスク20G(2Gごとに分割の設定)
  • CPU数:cpu 1
  • memory:512M
    • VMイメージの memory、cpu を増やしたい場合は、bc9-android-sdk--release20090801.vmx(VMware 仮想マシン構成ファイル)の memsize、numvcpus を編集して増やしてください)
  • Network:bridge network
  • OS
    • Ubuntu 8.04.3 LTS(8.04.2LTSでインストール後 update)
    • アプリケーションは以下の変更以外はインストール後の default のまま
    • gnome-games ほか game 関連は削除します。(容量削減のため)
      • sudo apt-get remove gnome-cards-data gnome-games gnome-games-data libggzmod4
    • ssh、ntp、vim、lv、nautilus-open-terminal、adobe falsh 10、adobe acroread 追加インストール
    • vmware-tools インストール済みです。
    • default 解像度 1280x768に設定しています。
    • network は dhcp でアドレスを取得する設定です。
    • 作業用に作成してある user は beat、beat の password は beatcraft です。

gumstix-oe

  • /bin/sh のシンボリックリンクが dash になっているので bash に変更します。(bitbake の build 時に影響がでないよう)
    $ sudo dpkg-reconfigure dash
  • 必須アプリケーション・ツール類をインストールします。
    $ 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

gumstix-oeの取得

  • gumstix-oe を svn checkout
    以下の手順で gumstix-oe を取得します。
    $ mkdir ~/gumstix 
    $ cd ~/gumstix 
    $ svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe

環境設定

  • ソースコードキャッシュ保存場所を設定
    以下のコマンドで bitbake 実行時にダウンロードされるソースコードの保存場所を設定します。
    $ 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
    管理用のグループ設定をしているので、これが終わったら一度 logout して再度 login します。
  • 環境設定
    以下のコマンドで bitbake 実行時に必要な環境変数を設定します。
    $ cat ~/gumstix/gumstix-oe/extras/profile >> ~/.bashrc
    一度これを実行したら .bashrc に書き込まれるので、以降いつでも bitbake 実行に必要な PATH は通っている状態になっています。

ソースファイル調整

build 内容の調整をします。

  • iwmmxt に最適化し、FEED_ARCH も 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	(リビジョン 318)
    +++ com.gumstix.collection/conf/machine/include/tune-iwmmxt.inc	(作業コピー)
    @@ -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"
  • kernel size を拡大(後ですぐ 2.6.29 kernel に更新するため、予め kernel 分に取られるサイズを大きめにしておきます。)
    beat@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	(リビジョン 318)
    +++ com.gumstix.collection/conf/machine/include/gumstix.inc	(作業コピー)
    @@ -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"
  • microSD 起動のため mmcboot に変更し、bc9 では使用しない 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      (リビジョン 318)
    +++ com.gumstix.collection/conf/machine/gumstix-custom-verdex.conf	(作業コピー)
    @@ -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

2010/06/11 追記
注:bitbake gumstix-basic-image 実行時に zlib-native-1.2.3 の箇所で 404 Not Found が返ってきます。
zlib-1.2.3 を取得する場合 bb ファイルを以下のように編集してください。
#zlib の最新版は2010年6月10日時点で 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}"

以下のコマンドで microSD 起動用の kernel と userland を build します。

$ bitbake gumstix-basic-image

build が終了すると以下のファイルが生成されます。

beat@bc9-oe-sdk:~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex$ ls -l
合計 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

ここで生成される kernel は 2.6.21 ですが、起動用 microSD を作成する時点で最初から
以下の手順で生成される 2.6.29 に入れ替えてしまいますので、実質的に必要になるのは

Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20090724-gumstix-custom-verdex.rootfs.tar.gz

だけです。

2.6.29 kernel & modules

bc9-android-sdk で取得した linux-android-2.6.29 kernel を /home/beat/kernel_work/ に linux-android-2.6.29 の名でコピーし、
patch-kernel-2.6.29.4-bc9-r3 を当て、bc9_android_defconfig を .config としてコピーします。
patch 後 linux-android-2.6.29 を linux-android-2.6.29-bc9-r3 にリネームしておきます。
以下の内容で kernel だけを cross compile するための環境設定ファイル envsetup.sh を作成します。

#!/bin/sh

export PATH=/home/beat/gumstix/gumstix-oe/tmp/cross/bin:$PATH
export ARCH=arm
export CROSS_COMPILE=arm-angstrom-linux-gnueabi-

このファイルを source し linux-android-2.6.29-bc9-r3 で make を実行すれば kernel が build できますが、
bc9 用の microSD 起動用ファイルを得るにはさらに以下の作業が必要です。

以下の内容で make-bc9-kernel.sh を作成し 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}

make が終了すると、vmlinux など標準の make を実行したときに生成されるファイルの他に
bc9 用に必要な以下のファイルが生成されます。

-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

BC::labsへの質問は、bc9-dev @ googlegroups.com までお願い致します。
トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   最終更新のRSS
Last-modified: 2010-06-11 (金) 18:24:14 (5499d)