Create an ipk package from sources/zh tw

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(將軟體置入 rootfs image)
(將軟體置入 rootfs image)
Line 267: Line 267:
 
<blockquote>
 
<blockquote>
 
{| border="1" cellspacing="0" cellpadding="5" align="center"
 
{| border="1" cellspacing="0" cellpadding="5" align="center"
  |* 在將軟體置入rootfs image時,這個方法並不是一個標準或者是正常的方法。合適的操作方法,跟隨在不適合的方法之後。
+
  |* 在將軟體置入rootfs image時,這個方法並不是一個標準或者是正常的方法。我們會先操作合適的方法,之後,再示範不適合的方法。
 
|}
 
|}
 
</blockquote>
 
</blockquote>

Revision as of 05:13, 16 March 2009

本篇文章的主要目地在於導引及幫助撰寫Openmoko 程式。

Contents

原理

Openmoko 使用OpenEmbedded來製作package 及root image 。

OpenEmbedded 提供 patches及 Bitbake Recipes,這與提供 .spec 檔案建立 RPM套件。 Bitbake 被用來處理recipes,並取得packages及FS images。舉例來說,bitbake可以取出原始碼,套用到 patches、設定,製作及安裝編譯好的源碼。其它的步驟為使用者可定義的,但這超過本文的範圍。

標準的bitbake用法是下載現有的 package如 "gcc" 或"binutils" 或 "linux kernel",套用到platform patches (加入修復的bug程式碼、porting fixes、驅動程式....等),然後編譯並封裝輸出的binary。

軟體版本別

Software軟體版本及設定管理是個廣泛的議題,並且有不同的意見,在這裡會做個快速的說明。

軟體版本在套件建立方法中是很重要的問題,軟體版本即代表軟體的全部。如它是用來追踨軟體變更的一個指標,並且讓每個版本是個獨立的版本。在這裡,我們必須認知到基本的版本管理問題。

Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.

一旦特定層級的功能達到了,則會被編上版本編號。這樣一來,目前的開發就可以繼續 ,但使用者可以下載定義完整的釋出版本,即 定出known bugs 及功能層級。這可被稱為 "branching"。 If version specific bugs are found in version a.b, then we can update this branch independently.

在bitbake,我們必須指定哪個版本的軟體是我們要包裝的。這個可能不是你個人寫程式的習慣,尤其是你只開發小的程式,你的程式不是透過二個以上的人維護。如果你的軟體稱為 "myprogram" ,但沒有連接真的版本名稱,你可以將你的專案目錄重新命名為"myprogram-1.0"。

這是個很好的訓練,如果你在包裝一個軟體,它將會由其它人使用時,當你下次修改它時,就要把檔案夾的名稱改為 "myprogram-1.1" :) 這可以讓使用者暸,並且讓軟體易於管理,並且也可以為你的軟體團隊做未來的規劃。

範例

如果你有一個正在進行的軟體套件,如有一個放置原始碼的檔案目錄、Makefile, 等... 因為這是一個很平常的方法,我將會利用我的專案來實作它。這表示軟體可以在下面的操作步驟中被安裝。

./configure && make && make install.

前提

你必須設定Openmoko開發目錄。所有的詳細設定內容,請參考Building Openmoko from scratch

你也必須在 MokoMakefile進行相同的工作,你可以參考底下的內容。 下列的指令是從上述的說明頁中取得的指令,只要在shell中複製及貼上即可。


# make sure we have mtn
set -e
echo "if script stops immediatly install monotone with either apt-get or yum"
test_mtn=`miitn --version`

#prepare
cd $HOME
mkdir OM
cd OM

#get openembedded
wget http://www.openembedded.org/snapshots/OE.mtn.bz2
bunzip2 OE.mtn.bz2
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded

#get openmoko
svn co http://svn.openmoko.org/ openmoko

#create local config
mkdir -p sources build/conf
cat <<EOF >build/conf/local.conf
MACHINE = "fic-gta01"
DISTRO = "openmoko"
BUILD_ARCH = "`uname -m`"
EOF

#fixes (didnt try without them)
ln -s openmoko/trunk/oe ./oe
cd sources
mkdir -p ../build/tmp/stamps/armv4t-linux
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch

接者,你需下以下的環境變數設定:

Building_Openmoko_from_scratch#Environment_variables

將以下的 script中的數行程式放入,並到你的 build/ dir (目錄) 並且置入它:

cat <<EOF >doenv.sh
#!/bin/sh
export OMDIR=`pwd`
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded
EOF
. ./doenv.sh

之後,你的目錄樹會呈現以下的內容:

$HOME/OM
 +- build
 |  +- conf
 |  |  +- local.conf
 +- openmoko
 +- openembedded
 +- sources
 +- env.sh

etc...


連到 MokoMakefile,並且跟隨著相關指令進行。 You're now all set to start building. 請記得在你每次開啟terminal時,要執行setup-env 指令。這個可以設定你的環境變數,然而,若是把它放到你的rc 檔案中,會更為容易些。

建議新軟體目錄配置

Bitbake recipes 是一個用來形容如何建立package 的單一檔案。我建議每個package版本都要有一個 recipe ( myprogram-1.0.bb, myprogram-1.1.bb, 等) 所以被放置在同一個目錄下的檔案內容都會被稱為 "myprogram" 。

如以下為個人的目錄配置:

$HOME
 +- $OMDIR (contains the official openmoko tree)
 |  +- ...
 +- My_personal_Openmoko_Packages
 |  +- packages
 |     +- myhello
 |        +- myhello-1.0.bb
 +- My_Personal_Projects_Folder
    +- myhello
       +- myhello-1.0
          +- configure.ac
          +- Makefile.am
          +- ...

做一個簡單的測試,將你的源碼壓縮,並且將tar 放到\web server:

cd My_personal_Projects_Folder/myhello
tar cvfz myhello-1.0.tar.gz myhello-1.0/

這是正確的,如 tarball 將會有一個 NAME(名稱)-VERSION(版本) 的子目錄,這就是我們要的。

方法

在bitbake檔案中,你需要給予下列的東西:

  • 軟體的描述,變數名稱
  • 軟體名稱 (PN)
  • 軟體版本 (PV)
  • 來源URI,在之後的內容中,我會詳細描述
  • 源碼版本,檢查已命名版本的目錄樹的版本修訂
  • 請參考 Open Embedded StyleGuide ,它可以回答關於.bb 檔案轉換的問題。

這裡是它的範例:

#package description
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"
SECTION = "squalyl/myhello"

#this is optional
LICENSE = "GPLv2"

PN = "myhello"
PV = "1.0"

#use "now" to force svn updates at each build
#Using now is a very dangerous way to do it. ONLY use this in your
#personal recipes when you're doing heavy testing, otherwise
#choose a stable date and stick with it that way when you distribute your recipe
#you don't have all sorts of versions getting built out in the wild.
SRCDATE_${PN} = "now"
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"

#for a tarball use:
#SRC_URI = "http://server/path/package/${PN}-${PV}.tar.gz"

#include standard rules to build a autoconf/automake package
inherit autotools

以 ${} 開始的陳述式可以被取代,它允許你下載如名為"mypackage-1.0.tar.gz"的壓縮檔

原始 URIs

bitbake 可以為你的專案自不同的位置取回源碼,或壓縮、 subversion及git等...。

這些資訊都可以在bitbake manual中找到。特別是 這個位置

軟體建立的目錄,是bitbake主要執行的地方,它將會依照它的名稱範本 "PACKAGE_NAME-PACKAGE_VERSION"執行,因此:

  • 壓縮檔必須解壓縮到它的子目錄下
  • svn 上層目錄必須有這個名稱

這是非常重要的!

告訴bitbake如何建立你的軟體package

唯一要做的事就是編輯 $OMDIR/build/local.conf ,告訴 bitbake 如何為.bb檔搜尋檔案夾:

BBFILES+="${HOME}/MypersonalOpenmokoPackages/packages/*/*.bb"

並不需要變更 BBPATH 或其它的任何東西,只需要加入新的設定檔,而不是recipes.

執行以下指令:

$ cd $OMDIR/build
$ bitbake mypackage

將會在 $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....中,執行建立軟體中必要的操作。

下面是 build log的範例:

OE Build Configuration:
BB_VERSION     = "1.6.9"
OE_REVISION    = "<unknown>"
TARGET_ARCH    = "arm"
TARGET_OS      = "linux"
MACHINE        = "fic-gta01"
DISTRO         = "openmoko"
DISTRO_VERSION = ".dev-snapshot-20070723"
TARGET_FPU     = "soft"

NOTE: This BitBake doesn't support revision fetching, falling back to current date
NOTE: preferred version 2.4 of glibc not available
NOTE: preferred version 2.4 of glibc-intermediate not available
NOTE: preferred version 2.4 of glibc not available
NOTE: package myhello-1.0: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0
A    myhello-1.0/configure.ac
A    myhello-1.0/include
A    myhello-1.0/include/config.h.in
A    myhello-1.0/cleanall.sh
A    myhello-1.0/AUTHORS
A    myhello-1.0/bootstrap.sh
A    myhello-1.0/ChangeLog
A    myhello-1.0/src
A    myhello-1.0/src/hello.c
A    myhello-1.0/Makefile.am
A    myhello-1.0/NEWS
A    myhello-1.0/README
Révision 2116 extraite.
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed
NOTE: package myhello-1.0: completed
NOTE: build 200707231952: completed
Build statistics:
  Attempted builds: 1

將軟體置入 rootfs image

* 在將軟體置入rootfs image時,這個方法並不是一個標準或者是正常的方法。我們會先操作合適的方法,之後,再示範不適合的方法。


bitbake openmoko-devel-image 被用來建立整個套件,但它並不會將你的軟體包含到rootfs image中。

要進行這個工作,請使用以下的指令:

bitbake openmoko-devel-image -crebuild

This will actually rebuild the rootfs, including your new packages.

*The suggested method follows below.

To include the package in the image there are two steps.

First: Modify your local.conf. $OMDIR/build/conf/local.conf

DISTRO_EXTRA_RDEPENDS += "<app name>"

This adds your application as a dependency for building the distro.

Second: Update the task-base.

bitbake task-base -crebuild

When you update the task base it re-builds and ipk file which will: "Merge machine and distro options to create a basic machine task/package"

You could also add your package by modifying the openmoko/trunk/oe/packages/tasks/task-openmoko.bb and adding your application name with the trailing backslash right before the update-alternatives line.

  modutils-initscripts \
  module-init-tools-depmod \
  udev \
  rsync \
  screen \
  <My application Name> \ 
#  update-alternatives \

Then to test this out (if you're using the MokoMakefile) it's pretty simple.

make openmoko-devel-image
make build-qemu
make flash-qemu-local

And now you're running qemu with that fancy new image you just made!

If you are really lazy this script should do all the above stuff. This is just a small shell hack which uses the power of sed to inject packages into the the final image. Use at your own risk and please don't flame the author =D..

#!/bin/bash
# Sudharshan "Sup3rkiddo" S
# inject, script that injects packages into the Openmoko standard, 
# The sed line does all the stuff, nothing elite...
# The package is grouped under TASK_OPENMOKO_LINUX..after rsync
# The bitbake recipes should be present in the proper place. OE docs for info

ARGS=1
E_BADARGS=65

if [ $# -ne "$ARGS" ]
then
    echo "Usage: inject <packagename>"
    exit $E_BADARGS
fi

make update
make setup
cd openmoko/trunk/oe/packages/tasks
mv task-openmoko.bb task-openmoko.bb_bakup
# search for rsync and append the package name after it..[KIDDISH HACK]
sed '/rsync \\/ a\  '$1' \\' <task-openmoko.bb_bakup >>task-openmoko.bb
mv task-openmoko.bb_bakup ~/
cd ../../../
make clean-package-$1
#make build-package-$1
make openmoko-devel-image
#make build-qemu
#make flash-qemu-local
echo "Done injection..muhahah"

See also

Bold text

Personal tools

本篇文章的主要目地在於導引及幫助撰寫Openmoko 程式。

原理

Openmoko 使用OpenEmbedded來製作package 及root image 。

OpenEmbedded 提供 patches及 Bitbake Recipes,這與提供 .spec 檔案建立 RPM套件。 Bitbake 被用來處理recipes,並取得packages及FS images。舉例來說,bitbake可以取出原始碼,套用到 patches、設定,製作及安裝編譯好的源碼。其它的步驟為使用者可定義的,但這超過本文的範圍。

標準的bitbake用法是下載現有的 package如 "gcc" 或"binutils" 或 "linux kernel",套用到platform patches (加入修復的bug程式碼、porting fixes、驅動程式....等),然後編譯並封裝輸出的binary。

軟體版本別

Software軟體版本及設定管理是個廣泛的議題,並且有不同的意見,在這裡會做個快速的說明。

軟體版本在套件建立方法中是很重要的問題,軟體版本即代表軟體的全部。如它是用來追踨軟體變更的一個指標,並且讓每個版本是個獨立的版本。在這裡,我們必須認知到基本的版本管理問題。

Current (most advanced) version is named the "trunk". Additions, fixes, etc. are done to the trunk.

一旦特定層級的功能達到了,則會被編上版本編號。這樣一來,目前的開發就可以繼續 ,但使用者可以下載定義完整的釋出版本,即 定出known bugs 及功能層級。這可被稱為 "branching"。 If version specific bugs are found in version a.b, then we can update this branch independently.

在bitbake,我們必須指定哪個版本的軟體是我們要包裝的。這個可能不是你個人寫程式的習慣,尤其是你只開發小的程式,你的程式不是透過二個以上的人維護。如果你的軟體稱為 "myprogram" ,但沒有連接真的版本名稱,你可以將你的專案目錄重新命名為"myprogram-1.0"。

這是個很好的訓練,如果你在包裝一個軟體,它將會由其它人使用時,當你下次修改它時,就要把檔案夾的名稱改為 "myprogram-1.1" :) 這可以讓使用者暸,並且讓軟體易於管理,並且也可以為你的軟體團隊做未來的規劃。

範例

如果你有一個正在進行的軟體套件,如有一個放置原始碼的檔案目錄、Makefile, 等... 因為這是一個很平常的方法,我將會利用我的專案來實作它。這表示軟體可以在下面的操作步驟中被安裝。

./configure && make && make install.

前提

你必須設定Openmoko開發目錄。所有的詳細設定內容,請參考Building Openmoko from scratch

你也必須在 MokoMakefile進行相同的工作,你可以參考底下的內容。 下列的指令是從上述的說明頁中取得的指令,只要在shell中複製及貼上即可。


# make sure we have mtn
set -e
echo "if script stops immediatly install monotone with either apt-get or yum"
test_mtn=`miitn --version`

#prepare
cd $HOME
mkdir OM
cd OM

#get openembedded
wget http://www.openembedded.org/snapshots/OE.mtn.bz2
bunzip2 OE.mtn.bz2
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev
mtn --db=OE.mtn checkout --branch=org.openembedded.dev -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded

#get openmoko
svn co http://svn.openmoko.org/ openmoko

#create local config
mkdir -p sources build/conf
cat <<EOF >build/conf/local.conf
MACHINE = "fic-gta01"
DISTRO = "openmoko"
BUILD_ARCH = "`uname -m`"
EOF

#fixes (didnt try without them)
ln -s openmoko/trunk/oe ./oe
cd sources
mkdir -p ../build/tmp/stamps/armv4t-linux
wget http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/js-1.5.tar.gz
touch ../build/tmp/stamps/armv4t-linux/js-1.5-r0.do_fetch
wget http://us4.samba.org/samba/ftp/stable/samba-3.0.14a.tar.gz
touch ../build/tmp/stamps/armv4t-linux/samba-3.0.14a-r15.do_fetch
perl -pi.orig -e 's/ *$//;s/\r//g' ../openembedded/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch

接者,你需下以下的環境變數設定:

Building_Openmoko_from_scratch#Environment_variables

將以下的 script中的數行程式放入,並到你的 build/ dir (目錄) 並且置入它:

cat <<EOF >doenv.sh
#!/bin/sh
export OMDIR=`pwd`
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded
EOF
. ./doenv.sh

之後,你的目錄樹會呈現以下的內容:

$HOME/OM
 +- build
 |  +- conf
 |  |  +- local.conf
 +- openmoko
 +- openembedded
 +- sources
 +- env.sh

etc...


連到 MokoMakefile,並且跟隨著相關指令進行。 You're now all set to start building. 請記得在你每次開啟terminal時,要執行setup-env 指令。這個可以設定你的環境變數,然而,若是把它放到你的rc 檔案中,會更為容易些。

建議新軟體目錄配置

Bitbake recipes 是一個用來形容如何建立package 的單一檔案。我建議每個package版本都要有一個 recipe ( myprogram-1.0.bb, myprogram-1.1.bb, 等) 所以被放置在同一個目錄下的檔案內容都會被稱為 "myprogram" 。

如以下為個人的目錄配置:

$HOME
 +- $OMDIR (contains the official openmoko tree)
 |  +- ...
 +- My_personal_Openmoko_Packages
 |  +- packages
 |     +- myhello
 |        +- myhello-1.0.bb
 +- My_Personal_Projects_Folder
    +- myhello
       +- myhello-1.0
          +- configure.ac
          +- Makefile.am
          +- ...

做一個簡單的測試,將你的源碼壓縮,並且將tar 放到\web server:

cd My_personal_Projects_Folder/myhello
tar cvfz myhello-1.0.tar.gz myhello-1.0/

這是正確的,如 tarball 將會有一個 NAME(名稱)-VERSION(版本) 的子目錄,這就是我們要的。

方法

在bitbake檔案中,你需要給予下列的東西:

  • 軟體的描述,變數名稱
  • 軟體名稱 (PN)
  • 軟體版本 (PV)
  • 來源URI,在之後的內容中,我會詳細描述
  • 源碼版本,檢查已命名版本的目錄樹的版本修訂
  • 請參考 Open Embedded StyleGuide ,它可以回答關於.bb 檔案轉換的問題。

這裡是它的範例:

#package description
DESCRIPTION = "An example application for openmoko, depending on a custom source repository"
SECTION = "squalyl/myhello"

#this is optional
LICENSE = "GPLv2"

PN = "myhello"
PV = "1.0"

#use "now" to force svn updates at each build
#Using now is a very dangerous way to do it. ONLY use this in your
#personal recipes when you're doing heavy testing, otherwise
#choose a stable date and stick with it that way when you distribute your recipe
#you don't have all sorts of versions getting built out in the wild.
SRCDATE_${PN} = "now"
SRC_URI = "svn://repo/path/myhello;proto=https;module=${PN}-${PV}"

#for a tarball use:
#SRC_URI = "http://server/path/package/${PN}-${PV}.tar.gz"

#include standard rules to build a autoconf/automake package
inherit autotools

以 ${} 開始的陳述式可以被取代,它允許你下載如名為"mypackage-1.0.tar.gz"的壓縮檔

原始 URIs

bitbake 可以為你的專案自不同的位置取回源碼,或壓縮、 subversion及git等...。

這些資訊都可以在bitbake manual中找到。特別是 這個位置

軟體建立的目錄,是bitbake主要執行的地方,它將會依照它的名稱範本 "PACKAGE_NAME-PACKAGE_VERSION"執行,因此:

  • 壓縮檔必須解壓縮到它的子目錄下
  • svn 上層目錄必須有這個名稱

這是非常重要的!

告訴bitbake如何建立你的軟體package

唯一要做的事就是編輯 $OMDIR/build/local.conf ,告訴 bitbake 如何為.bb檔搜尋檔案夾:

BBFILES+="${HOME}/MypersonalOpenmokoPackages/packages/*/*.bb"

並不需要變更 BBPATH 或其它的任何東西,只需要加入新的設定檔,而不是recipes.

執行以下指令:

$ cd $OMDIR/build
$ bitbake mypackage

將會在 $OMDIR/build/tmp/deploy/ipk/armv4t/myhello .....中,執行建立軟體中必要的操作。

下面是 build log的範例:

OE Build Configuration:
BB_VERSION     = "1.6.9"
OE_REVISION    = "<unknown>"
TARGET_ARCH    = "arm"
TARGET_OS      = "linux"
MACHINE        = "fic-gta01"
DISTRO         = "openmoko"
DISTRO_VERSION = ".dev-snapshot-20070723"
TARGET_FPU     = "soft"

NOTE: This BitBake doesn't support revision fetching, falling back to current date
NOTE: preferred version 2.4 of glibc not available
NOTE: preferred version 2.4 of glibc-intermediate not available
NOTE: preferred version 2.4 of glibc not available
NOTE: package myhello-1.0: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: started
NOTE: Fetch svn://svn.unsads.com/squalyl/om/src/myhello;proto=https;module=myhello-1.0
A    myhello-1.0/configure.ac
A    myhello-1.0/include
A    myhello-1.0/include/config.h.in
A    myhello-1.0/cleanall.sh
A    myhello-1.0/AUTHORS
A    myhello-1.0/bootstrap.sh
A    myhello-1.0/ChangeLog
A    myhello-1.0/src
A    myhello-1.0/src/hello.c
A    myhello-1.0/Makefile.am
A    myhello-1.0/NEWS
A    myhello-1.0/README
Révision 2116 extraite.
NOTE: package myhello-1.0-r0_0_200707231759: task do_fetch: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: started
NOTE: Unpacking /home/squalyl/OM/sources/myhello-1.0_svn.unsads.com_.squalyl.om.src.myhello__now.tar.gz to /home/squalyl/OM/build/tmp/work/armv4t-linux/myhello-1.0-r0_0_200707231759/
NOTE: package myhello-1.0-r0_0_200707231759: task do_unpack: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_patch: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_configure: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_compile: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_install: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_package: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: started
Packaged contents of myhello-dbg into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello-dbg_1.0-r0_0_200707231759_armv4t.ipk
Packaged contents of myhello into /home/squalyl/OM/build/tmp/deploy/ipk/armv4t/myhello_1.0-r0_0_200707231759_armv4t.ipk
NOTE: Not creating empty archive for myhello-doc-1.0-r0_0_200707231759
NOTE: Not creating empty archive for myhello-dev-1.0-r0_0_200707231759
NOTE: Not creating empty archive for myhello-locale-1.0-r0_0_200707231759
NOTE: package myhello-1.0-r0_0_200707231759: task do_package_write: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_populate_staging: completed
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: started
NOTE: package myhello-1.0-r0_0_200707231759: task do_build: completed
NOTE: package myhello-1.0: completed
NOTE: build 200707231952: completed
Build statistics:
  Attempted builds: 1

將軟體置入 rootfs image

* 在將軟體置入rootfs image時,這個方法並不是一個標準或者是正常的方法。我們會先操作合適的方法,之後,再示範不適合的方法。


bitbake openmoko-devel-image 被用來建立整個套件,但它並不會將你的軟體包含到rootfs image中。

要進行這個工作,請使用以下的指令:

bitbake openmoko-devel-image -crebuild

This will actually rebuild the rootfs, including your new packages.

*The suggested method follows below.

To include the package in the image there are two steps.

First: Modify your local.conf. $OMDIR/build/conf/local.conf

DISTRO_EXTRA_RDEPENDS += "<app name>"

This adds your application as a dependency for building the distro.

Second: Update the task-base.

bitbake task-base -crebuild

When you update the task base it re-builds and ipk file which will: "Merge machine and distro options to create a basic machine task/package"

You could also add your package by modifying the openmoko/trunk/oe/packages/tasks/task-openmoko.bb and adding your application name with the trailing backslash right before the update-alternatives line.

  modutils-initscripts \
  module-init-tools-depmod \
  udev \
  rsync \
  screen \
  <My application Name> \ 
#  update-alternatives \

Then to test this out (if you're using the MokoMakefile) it's pretty simple.

make openmoko-devel-image
make build-qemu
make flash-qemu-local

And now you're running qemu with that fancy new image you just made!

If you are really lazy this script should do all the above stuff. This is just a small shell hack which uses the power of sed to inject packages into the the final image. Use at your own risk and please don't flame the author =D..

#!/bin/bash
# Sudharshan "Sup3rkiddo" S
# inject, script that injects packages into the Openmoko standard, 
# The sed line does all the stuff, nothing elite...
# The package is grouped under TASK_OPENMOKO_LINUX..after rsync
# The bitbake recipes should be present in the proper place. OE docs for info

ARGS=1
E_BADARGS=65

if [ $# -ne "$ARGS" ]
then
    echo "Usage: inject <packagename>"
    exit $E_BADARGS
fi

make update
make setup
cd openmoko/trunk/oe/packages/tasks
mv task-openmoko.bb task-openmoko.bb_bakup
# search for rsync and append the package name after it..[KIDDISH HACK]
sed '/rsync \\/ a\  '$1' \\' <task-openmoko.bb_bakup >>task-openmoko.bb
mv task-openmoko.bb_bakup ~/
cd ../../../
make clean-package-$1
#make build-package-$1
make openmoko-devel-image
#make build-qemu
#make flash-qemu-local
echo "Done injection..muhahah"

See also

Bold text