[[labs.beatcraft.com]]~
[[bc9/Software/OpenEmbedded/kernel2.6.29(2/2)]]~
*kernel update [#q81ecfde]
gumstix-oe の kernel は、現在 2.6.21、2.6.22、2.6.24 を選択することができますが、~
2.6.24 でも既に2年近く古いものになっています。~
そこで bc9 の kernel version を 2.6.29 に更新しました。~
更新の手順を以下に記述します。
*microSD boot 環境の構築 [#q0cc00c9]
kernel を更新するにあたって、新しい kernel を利用する userland を整えます。~
kernel 更新作業の利便性から、内蔵FLASH ROMに書き込む方法でなく~
microSDに起動可能の環境を新たに構築する方法を実行します。~
**gumstix の build 環境の作成 [#c840123d]
bc9 (gumstix) の build 環境を作成します。~
ビルド環境 は [[OpenEmbedded:http://wiki.openembedded.net/index.php/Main_Page]] の build 環境 (bitbake) を [[Gumstix,Inc.:http://www.gumstix.com/]] が gumstix 向けに調整したものを使用します。~
(以降、gumstix OEと表記します)~
あらかじめ gumstix 開発者ホームページにある gumstix ビルド環境の setup 手順を把握しておいて下さい。
-[[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]]
ただし、今回は内蔵FLASH ROM に書き込むイメージでなくmicroSD BOOT 用イメージをbuildするため、~
上記ページとは手順がかなり異なります。
以下の作業は Ubuntu8.04LTS 上で beat ユーザで行うことを前提に記述しています。~
(Ubuntu8.10 を使用したい場合は [[Build Environment Ubuntu 8.10:http://www.gumstix.net/wiki/index.php?title=Build_Environment_Ubuntu_8.10]] を、~
Ubuntu9.04 を使用したい場合は [[Build Environment Ubuntu 9.04:http://www.gumstix.net/wiki/index.php?title=Build_Environment_Ubuntu_9.04]] を参照し、調整を加えて下さい。~
リンク先ページではgccを4.1にしていますが、4.2系の方が良いようです。)
**shの調整 [#z410340b]
Ubuntu の /bin/sh は bash でなく dash へのリンクになっていますが、bitbake による build 作業時に問題が発生するのを避けるため~
以下の手順で bash へのリンクになるよう調整します。
$ sudo dpkg-reconfigure dash
dash を /bin/sh にするか聞かれるので、「いいえ」を選択します。
**必須application のインストール [#w200ac3b]
以下のコマンドで bitbake に必要なapplicationをインストールします。
$ sudo apt-get install build-essential help2man diffstat texi2html texinfo libncurses5-dev cvs gawk \
python-dev python-pysqlite2 python-psyco ckermit lrzsz subversion
**gumstix OE の check out [#bbc8bfd7]
$ mkdir ~/gumstix
$ cd ~/gumstix
$ svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe
**環境変数の設定 [#l1363961]
永続的に設定してしまう場合は
$ cat gumstix-oe/extras/profile >> ~/.bashrc
一時的に環境変数を設定する場合は、
$ . ~/gumstix/gumstix-oe/extras/profile
あるいは
$ source ~/gumstix/gumstix-oe/extras/profile
を実行します。
**source code のキャッシュ保存設定 [#e451cf6a]
gumstix OE は build 作業の途中で source code をダウンロードするようになっています。~
default設定では /usr/share/sources にダウンロードした source code を保存するようになっていますが、~
扱い易いよう以下のように設定を変更してダウンロード先を gumstix/sources にします。~
$ svn diff build/conf/site.conf
Index: build/conf/site.conf
===================================================================
--- build/conf/site.conf (リビジョン 318)
+++ build/conf/site.conf (作業コピー)
@@ -1,5 +1,6 @@
# specifies where BitBake should place the downloaded sources
-DL_DIR = "/usr/share/sources"
+DL_DIR = "/home/beat/gumstix/sources"
# specifies where BitBake should create its temporary files
TMPDIR = ${GUMSTIXTOP}/tmp
**ビルド内容の調整 [#h8d351a1]
PXA270の性能を有効活用するため、以下のように設定を変更して iwmmxt を有効にします。~
$ 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"
microSD から起動できるイメージでは kernel の1Mサイズ制限は不要なのでサイズを倍に増やします。
$ 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,6 +10,7 @@
KERNEL_IMAGETYPE = "uImage"
RDEPENDS_kernel-base = ""
-KERNEL_IMAGE_MAXSIZE = "1048577"
+KERNEL_IMAGE_MAXSIZE = "2197154" // incleased for mmcboot
UBOOT_ENTRYPOINT = "a0008000"
@@ -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"
microSDから起動できるイメージを作成するため、mmcboot のコメントアウトを外して有効にします。~
ほかに bc9 向けの調整を加えています。
$ 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 = "31"
#
# 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"
#
gumstix の expansion board wifistix モジュールは build error になることが分かっているので、~
build されないよう設定を削除します。(bc9 ではもともと使用しません。)
$ svn diff com.gumstix.collection/packages/tasks/task-base-gumstix.bb
Index: com.gumstix.collection/packages/tasks/task-base-gumstix.bb
===================================================================
--- com.gumstix.collection/packages/tasks/task-base-gumstix.bb (リビジョン 318)
+++ com.gumstix.collection/packages/tasks/task-base-gumstix.bb (作業コピー)
@@ -201,7 +201,6 @@
RDEPENDS_task-base-gumstix-wifi = "\
task-base-gumstix-pcmcia \
- wifistix-modules \
wireless-tools \
wpa-supplicant \
"
上記の変更で FEED_ARCH を armv5te から iwmmxt にしているので、ipk で application をインストールする場合~
自分で bitbake build したものでないとインストールできません。~
gumstix.net で用意されている armv5te の prebuild ipk を利用したい場合は、この変更が反映されないよう~
gumstix-custom-verdex.conf の中で tune-iwmmxt.inc を require せず tune-xscale.inc を require して build して下さい。
**build [#d7af3fe0]
以下のコマンドで kernel、kernel module、userland を build します。~
arm cross-toolchain の build から順に行われるので、マシンスペックにもよりますが数時間から半日ほど要します。
$ bitbake gumstix-directfb-image
build が正常に終了すると以下のようなファイルが生成されています。
$ ls -al tmp/deploy/glibc/images/gumstix-custom-verdex/
合計 21780
drwxr-xr-x 2 beat beat 4096 2009-06-23 00:01 .
drwxr-xr-x 3 beat beat 4096 2009-06-22 22:58 ..
-rw-r--r-- 1 beat beat 10402796 2009-06-23 00:01 Angstrom-gumstix-directfb-image-glibc-ipk-2007.9-test-20090622-gumstix-custom-verdex.rootfs.jffs2
-rw-rw-r-- 1 beat beat 8713428 2009-06-23 00:01 Angstrom-gumstix-directfb-image-glibc-ipk-2007.9-test-20090622-gumstix-custom-verdex.rootfs.tar.gz
lrwxrwxrwx 1 beat beat 97 2009-06-23 00:01 gumstix-directfb-image-gumstix-custom-verdex.jffs2 -> Angstrom-gumstix-directfb-image-glibc-ipk-2007.9-test-20090622-gumstix-custom-verdex.rootfs.jffs2
lrwxrwxrwx 1 beat beat 98 2009-06-23 00:01 gumstix-directfb-image-gumstix-custom-verdex.tar.gz -> Angstrom-gumstix-directfb-image-glibc-ipk-2007.9-test-20090622-gumstix-custom-verdex.rootfs.tar.gz
-rw-rw-r-- 1 beat beat 1929321 2009-06-22 22:58 modules-2.6.24-r1-gumstix-custom-verdex.tgz
-rw-r--r-- 1 beat beat 1191276 2009-06-22 22:58 uImage-2.6.24-r1-gumstix-custom-verdex.bin
**microSDのformat [#ldd29d26]
microSD に上記の kernel と userland を配置して起動可能にするため、microSD を2つの partition に分割して format します。~
最低でも128M以上の容量が必要です。~
1. microSD の先頭40Mを FAT16 で format~
2. 残りを ext2 で format~
(fdisk、mkvfat、mkext2を使っても、gparted を利用しても、方法は自由に。)~
vfat partition と ext2 partition をそれぞれ作業マシンの /media/disk、/media/disk-1 に mount している前提で、~
以下のように必要なファイルを必要な位置に配置します。
$ sudo cp ~/gumstix/gumstix-oe/extras/mmc-root/gumstix-factory.script /media/disk/
$ sudo cp ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/uImage-2.6.24-r1-gumstix-custom-verdex.bin /media/disk/uimage
$ sudo tar -C /media/disk-1/ -xvfz ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/gumstix-directfb-image-gumstix-custom-verdex.tar.gz
$ sudo tar -C /media/disk-1/ -xvfz ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/modules-2.6.24-r1-gumstix-custom-verdex.tgz
**microSD boot [#od92c2fb]
用意のできた microSD を bc9 の microSDスロットに挿し、シリアルケーブルを PC に接続して電源を入れると、~
シリアルコンソールに起動ログが流れ microSD から bc9 が起動します。(初回起動時、LCDには何も表示されません。)~
初回の起動は locale の設定や ssh_key の生成が行われるのでやや時間がかかります。~
起動が完了したらシリアルコンソールからログインし、以下のように kernel module の設定を行います。~
$ depmod
$ vi /etc/modules/pxafb
pxafb とだけ記述して保存
$ vi /etc/modules/fbcon
fbcon とだけ記述して保存
$ update-modules
これで次回起動時から LCD が表示されるようになります。
-----------------
RIGHT:by 大塚聡史