星期四, 10月 13, 2005

Build Kernel for ARM

本以為很簡單,結果第一關就猜錯:Kernel config裡沒有ARM type可以選。
因為:
(You only need this step if you are using a kernel prior to 2.6.0-test2. There are no -rmk or -vrs patches for later kernels.)
ARM Kernel的mantain在 http://www.arm.linux.org.uk ,所以裡面有 build kernel from mainline source的說明
當然cross-toolchain要先build起來,follow emdebian的說明, download 完tool source後,
#cd binutils-2.16.1cvs20050902
#TARGET=arm-linux fakeroot debian/rules bindary-cross
make: *** No rules to make target 'binary-cross' stop
Google 一下:http://lists.debian.org/debian-embedded/2005/10/msg00012.html
看看cross toolchain..
#aptitude intall toolchain-source
!!結果要download 128M.....
download完後,自動安裝,竟然要remove 正在用的2.6 kernel image....只好讓他作了,否則肥辦法作接下來的安裝。 -- remove image後重開(進入2.4 kernel).
#dpkg -L toolchain | grep doc
toolchain沒有安裝。因為安裝的是toolchain-source,所以
#dpkg -L toolchain-source | grep doc
出現一堆path,應該是在 /usr/share/doc/toolchain-source,到那裡去看...
改follow README的做法..
#apt-get install toolchain-source
#tpkg-make arm-linux
解開並且config完target,在binutils-arm-linux-2.15 gcc-arm-linux-3.4.3
#cd binutils-arm-linux-2.15
#debuild
Fail ! 說找不到pgp or gpg...試著裝裝看
#apt-get install pgp
果然沒裝,裝了pgpgpg,再試
#debuild
出現secret key not available..好像是build debian package需要一個public key,google 一下...
這一篇 http://lists.arm.linux.org.uk/pipermail/linux-arm/2005-September/010682.html 有提到,skip, 用
#dpkg-buildpackage -us -uc -rfakeroot
完成,好像是打包完成。接著作安裝
#debi
?? 這個版本是不是沒有patch ?

到gcc 中,一樣..
#cd gcc-arm-linux-3.4.3
#debuild
更慘,發生build error: mutex not declared....

改 follow http://kegel.com/crosstool/crosstool-0.38/doc/crosstool-howto.html 用他的script
因為用sudo太麻煩,所以值機接用root作,結果:
Don't run all.sh or crosstool.sh as root, it's dangerous
所以只好裝sudo
#apt-get install sudo
裝完後,還要修改/etc/sudoers,參考 http://www.study-area.org/tips/sudo.htm。這個檔案要用visudo這個command來改(他還會check 格式)。visudo在安裝sudo時已經安裝。visudo會用VISUAL這個環境變數作為編輯器,所以
# export VISUAL="vi"
指定使用vi,接著執行
#visudo
內容是
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

# Host alias specification

# User alias specification
User_Alias ADMINS = charles

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL
ADMINS ALL=ALL
就可以run sudo了(只有charles可以run)
Follow crosstool-howto http://kegel.com/crosstool/crosstool-0.38/doc/crosstool-howto.html
$sudo mkdir /opt/crosstool
$sudo chown $USER /opt/crosstool
$sh demo-arm.sh
..又開始wget download .....
結果連kernel都download下來(作test build用),但是在glibc-2.3.2/configure時發生gcc version bad (or too old).
checking version of gcc... 4.0.2, bad.
所以?改用其他的

沒有留言:

網誌存檔