1,atmark-dist環境(ATDE)にPowerPC用クロスコンパイラが入っていることを確認
2,Makefileの2行めあたりに
CXX=(クロスコンパイラ名、たとえばpowerpc-linux-g++、パスをちゃんと書いてあげることを忘れずに)
を追加する
3,Makefileの中の、実行ファイルの生成ルールを、
こんな感じで書き換える
hello-ppc:hello.cpp [タブ]$(CXX) -static -o hello-ppc hello.cpp
例
all: hello-ppc BIN_DIR=./usr/bin CXX=$(BIN_DIR)/powerpc-linux-g++ CXXFLAG=-static hello-ppc:hello.cpp $(CXX) $(CXXFLAG) -o hello-ppc hello.cpp clean: rm -rf hello-ppc
4,順番がごっちゃだけど、hello.cppを用意しておく
#include<iostream> using namespace std; int main(void){ cout << "hello" << endl; return 0; }
5,makeする。powerPC用の実行ファイルになっているかどうかの確認をする
file hello-ppc
6,ftpでボードに送る
7,ボード上で実行する
8,できてもできなくても報告よろしく
1, Ubuntuをインストールする(Ubuntu8.04が最新)
2, Updateをかける
sudo apt-get update sudo apt-get upgrade
3, その他必要なものをインストールする
sudo apt-get install flex gettext bison texi2html libncurses-dev texinfo
4,buildrootをダウンロードして解凍
5,buildrootディレクトリに移動して、
make menuconfig
6,buildrootをインストール
make
7, qemuをインストール
sudo apt-get install qemu
8, あとは試してみる
ppcアーキテクチャのエミュレーションができなかった。
armアーキテクチャの エミュレーションはできた。
参照ウェブサイト
http://monoist.atmarkit.co.jp/fembedded/articles/busyboxtech/01/busyboxtech01c.html
1, busyboxを解凍したディレクトリの下(1.11.1ディレクトリとする)に編集用のディレクトリを作る
(otherディレクトリとする)
2, otherディレクトリの下にKbuild,Config.inを作っておく。
3, otherディレクトリの中にhello.cを用意
#include "busybox.h" int hello_main(void); int hello_main(void){ printf("hello \n"); return 0; }
4、otherディレクトリ内のConfing.in,Kbuildを編集
(editorsディレクトリとか見て真似する)
Config.in
menu "other Execfile" config HELLO bool "hello" default n help display hello only endmenu
Kbuild
lib-y:= lib-$(CONFIG_HELLO) += hello.o
5, 1.11.1/includeの下のapplets.h,usage.hを編集する
applets.h
USE_HELLO(APPLET(hello, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
usage.h
#define hello_trivial_usage "None" #define hello_full_usage "None"
usage.hを書き間違えるとエラーが良くでるので注意
6, 1.11.1/Config.in , 1.11.1/Makefileを編集する
Config.in
comment "Applets" source archival/Config.in ... source other/Config.in
Makefile
core-y := \ applets/ \ libs-y := \ archival/ \ ... other/ \
7、make menuconfig でメニューを出してappletにhelloを追加する
8、make
9, make install
10, 実行する
参考 http://www.ibm.com/developerworks/jp/linux/library/l-busybox/index.html