2010年5月12日 星期三

建立一個簡單的distribution for arm (續)

這裡繼續完成之前系統所需要的rootfs,我主要是用Emdebian。

Host: Ubuntu 9.10 karmic for x86
Target: Debian 5.0 lenny for arm

有許多東西,是從Nabe大大的網誌學到的
http://nabeko-notebook.blogspot.com/2010/04/emdebian-on-arm-by-debootstrap.html


直接開始吧!
rootfs install
Root$ mkdir -p ~/Emdebian
Root$ cd ~/Emdebian
Root$ debootstrap --arch=armel --foreign --include=vim,openssh-server lenny rootfs/ http://www.emdebian.org/grip/


kernel modules install
Root$ cd $Kenrel_dir
Root$ make INSTALL_MOD_PATH=~/Emdebian/rootfs modules_install

***這邊的$Kenrel_dir 就是上一篇文章ltib所編出來的kernel位置($ur_ltib_location/ltib/rpm/BUILD/linux-2.6.31/)。


rootfs setup
Root$ cp /usr/bin/qemu-arm-static ~/Emdebian/rootfs/usr/bin/
Root$ chroot ~/Emdebian/rootfs /bin/sh
I have no name!$ echo "proc /proc proc none 0 0" >> etc/fstab
I have no name!$ echo $your_hostname > etc/hostname
I have no name!$ echo 'deb http://www.emdebian.org/grip/ lenny main' >> etc/apt/sources.list
I have no name!$ echo 'deb http://ftp.tw.debian.org/debian lenny main' >> etc/apt/sources.list
I have no name!$ mknod dev/console c 5 1
I have no name!$ mknod dev/ttymxc0 c 207 16 (imx51 板子上UART 1的裝置節點)
I have no name!$ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
I have no name!$ /debootstrap/debootstrap --second-stage
I have no name!$ echo ttymxc0 >>etc/securetty
I have no name!$ printf "T0:123:respawn:/sbin/getty 115200 ttymxc0\n" >> /etc/inittab
I have no name!$ exit
Root$ cd ~/Emdebian/rootfs
Root$ tar jcvf ../basic-debian.tar.bz2 . (做個備份)
Root$ cd ..
Root$ tar jxvf basic-debian.tar.bz2 -C /media/disk/ && sync && sync (假設SD卡巳經準備好了)
Root$ umount /dev/sdb

到現在為止,一個基本的rootfs巳經差不多完成了,只是等等還有些東西要再調一下。


boot from imx51 board
開機後,會發現一些問題,
1. 系統的網路預設會讀取 eth0 node,但找不到,後來發現是只有 eth1,而不是 eth0。
---> 原因在於,當初整個系統是用 chroot完成的,而在本機的電腦上就巳經有 eth0這個節點,所以,如果要再建立一個網路節點,系統就會給 "eth1"。
解決方法,
sh-3.2# vim /etc/udev/rules.d/70-persistent-net.rules

# PCI device 0x1969:0x1026 (ATL1E)
#mark thie line
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:23:54:0d:2d:
3c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

#change eth1 to eth0
# Unknown net device (/devices/platform/fec.0/net/eth0) (fec)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:04:9f:01:00:b
3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


2. enable network
sh-3.2# vim /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 140.92.XXX.XXX
netmask 255.255.255.0
gateway 140.92.XXX.XXX

sh-3.2# vim /etc/resolv.conf
#DNS server
nameserver 140.92.XXX.XXX


3. Qt env setup
如果之前有把QT porting進來,順便寫個script,讓電腦登⼊時,設定一下執行環境
sh-3.2# vim ~/.bashrc

export QTDIR=/ur_qt_location
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

echo "moblin" | sudo -S chmod 777 /tmp
echo "moblin" | sudo -S chmod 777 /dev/fb0
echo "moblin" | sudo -S chmod 777 /dev/input/mice
echo "moblin" | sudo -S chmod 777 /dev/tty0

***之前巳經有提過,在沒有toucn screen 的情況下,用鍵盤和滑鼠代替,即一些權限的設定。


最後,重新開機吧,寶貝!

沒有留言:

張貼留言