[Qemu]是個相當不錯的模擬器,它不只可以模擬x86,還可模擬arm。最近找了很多相關的資料,發現目前已經有很多人寫了不錯的教學,而且qemu支援的arm平台[ARM System emulator]也相當多。但重點是qemu並非所有arm的平台都支援,所以或許可以找找patch或自己試著修改看看,才能符合自己的平台。
[OPENCSL]這個網站相當不錯,初學者可以很快做出一個"ARM Integrator"(ARMB26EJ-S的架構)的模擬器。另外是OpenMoko[Neo1973],目前已有修改過後的qemu,跑出來就跟真的環境一樣。然後[Linux on Palm 5]也有修改後的模擬器,都可以實際跑起來。
有興趣的朋友,可以玩玩看,我覺得還滿有趣的。
2008年2月22日 星期五
2008年2月20日 星期三
空閒時間看Linux kernel原始碼
看Linux kernel的原始碼是一種很有趣的事情,可以看到很多用C寫奇怪的作法,真很有趣,如jserv所提到的[C 語言的 trigraph/digraph]一文。
只是因為只有空閒時間才能看,所以都只能看片段,沒辦法一層一層的往下找"真相",只有大約知道API怎麼CALL、用什麼樣的結構和演算法等等。
不過令人驚訝的是Linux kernel有超完整的架構,讓我這個初學者超佩服的,這時才知道自己的渺小。
未來,我會找時間來整理一些自己看kernel的想法...
只是因為只有空閒時間才能看,所以都只能看片段,沒辦法一層一層的往下找"真相",只有大約知道API怎麼CALL、用什麼樣的結構和演算法等等。
不過令人驚訝的是Linux kernel有超完整的架構,讓我這個初學者超佩服的,這時才知道自己的渺小。
未來,我會找時間來整理一些自己看kernel的想法...
2007年11月27日 星期二
2007年11月18日 星期日
2007年11月14日 星期三
Easy to build toolchain, cross-ng
因DIMM-PC只有32 MByte Flash Disk,
所以用glibc會太大,
因此改用jserv前輩所建議crosstool next generation[cross-ng],
這個crosstool可以編glibc和uclibc,
且介面跟編kernel很類似喔!!
真的方便超多的...^^
1. install
$ wget -c http://ymorin.is-a-geek.org/download/crosstool-ng/
crosstool-ng-0.3.2.tar.bz2
$ tar -jxvf crosstool-ng-0.3.2.tar.bz2
$ cd crosstool-ng-0.3.2
$ ./configure --prefix=/opt/cross-ng
$ make
# make install
2. using cross-ng
$ export PATH="${PATH}:/opt/cross-ng/bin"
$ mkdir toolchain-dev && cd ./toolchain-dev
$ ct-ng menuconfig
需要提供uclibc的設定檔路徑

$ ct-ng build
...
[INFO ] ===============================
[INFO ] Installing C library headers
[INFO ] Installing C library headers: done in 27.63s
[INFO ] ===============================
[INFO ] Core C compiler, pass 2
[INFO ] =============================
[INFO ] Installing static core C compiler
[INFO ] Installing static core C compiler: done in 316.46s
[INFO ] Core C compiler, pass 2: done in 316.50s
[INFO ] ===============================
[INFO ] Installing C library
[INFO ] Installing C library: done in 124.55s
[INFO ] ===============================
[INFO ] Installing final compiler
[INFO ] Installing final compiler: done in 737.85s
[INFO ] ===============================
[INFO ] Installing cross-gdb
[INFO ] Installing cross-gdb: done in 316.19s
[INFO ] ===============================
[INFO ] Installing gdbserver
[INFO ] Installing gdbserver: done in 11.50s
[INFO ] Build completed at 20071114.012858
[INFO ] (elapsed: 28:28.51)
成功囉!!
toolchain的路徑在$HOME/i386-DIMMPC-linux-uclibc
所以用glibc會太大,
因此改用jserv前輩所建議crosstool next generation[cross-ng],
這個crosstool可以編glibc和uclibc,
且介面跟編kernel很類似喔!!
真的方便超多的...^^
1. install
$ wget -c http://ymorin.is-a-geek.org/download/crosstool-ng/
crosstool-ng-0.3.2.tar.bz2
$ tar -jxvf crosstool-ng-0.3.2.tar.bz2
$ cd crosstool-ng-0.3.2
$ ./configure --prefix=/opt/cross-ng
$ make
# make install
2. using cross-ng
$ export PATH="${PATH}:/opt/cross-ng/bin"
$ mkdir toolchain-dev && cd ./toolchain-dev
$ ct-ng menuconfig
$ ct-ng build
...
[INFO ] ===============================
[INFO ] Installing C library headers
[INFO ] Installing C library headers: done in 27.63s
[INFO ] ===============================
[INFO ] Core C compiler, pass 2
[INFO ] =============================
[INFO ] Installing static core C compiler
[INFO ] Installing static core C compiler: done in 316.46s
[INFO ] Core C compiler, pass 2: done in 316.50s
[INFO ] ===============================
[INFO ] Installing C library
[INFO ] Installing C library: done in 124.55s
[INFO ] ===============================
[INFO ] Installing final compiler
[INFO ] Installing final compiler: done in 737.85s
[INFO ] ===============================
[INFO ] Installing cross-gdb
[INFO ] Installing cross-gdb: done in 316.19s
[INFO ] ===============================
[INFO ] Installing gdbserver
[INFO ] Installing gdbserver: done in 11.50s
[INFO ] Build completed at 20071114.012858
[INFO ] (elapsed: 28:28.51)
成功囉!!
toolchain的路徑在$HOME/i386-DIMMPC-linux-uclibc
2007年11月11日 星期日
ToolChain for DIMM-PC
由於x86的toolchain建立的文件相當少,
於是使用[crosstool]來建立toolchain可說是相當方便...
[更新]
$ svn co http://crosstool.googlecode.com/svn/trunk/src crosstool
$ cd crosstool
$ cp demo-i686.sh demo-i386.sh
$ vi demo-i386.sh
將eval `cat i686.dat gcc-4.1.0-glibc-2.3.6-tls.dat` sh all.sh --notest
修改成#eval `cat i686.dat gcc-4.1.0-glibc-2.3.6-tls.dat` sh all.sh --notest
將eval `cat i686.dat gcc-4.1.0-glibc-2.3.6.dat` sh all.sh --notest
修改成#eval `cat i386.dat gcc-4.1.0-glibc-2.3.6.dat` sh all.sh --notest
$ vi i386.dat
TARGET=i486-dimmpc-linux-gnu
TARGET_CFLAGS="-O"
$ sudo mkdir /opt/crosstool
$ sudo chown $USER /opt/crosstool
$ sh demo-i386.sh
...
Cross-toolchain build complete. Result in /opt/crosstool/gcc-4.1.0-glibc-2.3.6/i486-dimmpc-linux-gnu.
+ exit 0
+ cd /home/shulong/crosstool
+ sh testhello.sh
+ cd /opt/crosstool/gcc-4.1.0-glibc-2.3.6/i486-dimmpc-linux-gnu
+ test '!' -d tmp
+ mkdir tmp
+ cd tmp
+ test x '!=' x
+ cat
...
+ echo testhello: C compiler can in fact build a trivial program.
testhello: C compiler can in fact build a trivial program.
+ test '' = 1
+ test '' = 1
+ test '' = 1
+ test 1 = ''
+ echo Done.
Done.
看到這個msg就代表成功啦!!
toolchain的路徑在:
/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i486-dimmpc-linux-gnu/
感謝jserv大提供的方向...
於是使用[crosstool]來建立toolchain可說是相當方便...
[更新]
$ svn co http://crosstool.googlecode.com/svn/trunk/src crosstool
$ cd crosstool
$ cp demo-i686.sh demo-i386.sh
$ vi demo-i386.sh
將eval `cat i686.dat gcc-4.1.0-glibc-2.3.6-tls.dat` sh all.sh --notest
修改成#eval `cat i686.dat gcc-4.1.0-glibc-2.3.6-tls.dat` sh all.sh --notest
將eval `cat i686.dat gcc-4.1.0-glibc-2.3.6.dat` sh all.sh --notest
修改成#eval `cat i386.dat gcc-4.1.0-glibc-2.3.6.dat` sh all.sh --notest
$ vi i386.dat
TARGET=i486-dimmpc-linux-gnu
TARGET_CFLAGS="-O"
$ sudo mkdir /opt/crosstool
$ sudo chown $USER /opt/crosstool
$ sh demo-i386.sh
...
Cross-toolchain build complete. Result in /opt/crosstool/gcc-4.1.0-glibc-2.3.6/i486-dimmpc-linux-gnu.
+ exit 0
+ cd /home/shulong/crosstool
+ sh testhello.sh
+ cd /opt/crosstool/gcc-4.1.0-glibc-2.3.6/i486-dimmpc-linux-gnu
+ test '!' -d tmp
+ mkdir tmp
+ cd tmp
+ test x '!=' x
+ cat
...
+ echo testhello: C compiler can in fact build a trivial program.
testhello: C compiler can in fact build a trivial program.
+ test '' = 1
+ test '' = 1
+ test '' = 1
+ test 1 = ''
+ echo Done.
Done.
看到這個msg就代表成功啦!!
toolchain的路徑在:
/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i486-dimmpc-linux-gnu/
感謝jserv大提供的方向...
訂閱:
文章 (Atom)