|
楼主 |
发表于 2004-9-24 23:27:58
|
显示全部楼层
在SkyEye上模拟lubbock开发板的运行
1. 软件版本信息:
1) 模拟软件:
SkyEye: 0.7.7 (http://www.skyeye.org/download.htm);
2) 系统软件:
Linux Kernel:2.6.7(ftp://ftp.arm.linux.org.uk);
Busybox: 1.0.0 - rc3(http://www.busybox.net);
TinyLogin: 1.4 (http://tinylogin.busybox.net);
3) 系工具链软件:
xscale-gcc: 3.3.3;
Reading specs from:
/usr/local/xscale/3.3.3/lib/gcc-lib/arm-linux/3.3.3/specs
Configured with:
./configure
--target=arm-linux
--prefix=/usr/local/xscale/3.3.3
i686-linux
--with-headers=/usr/local/src/arm/linux/include --with-cpu=xscale
--with-softfloat-support=internal
--enable-languages=c,c++
--nfp
Thread model:
posix
Gcc version:3.3.3
arm-linux-gcc: 3.2.3;
Reading specs from:
/usr/local/arm/lib/gcc-lib/arm-linux/3.2.3/specs
Configured with:
./configure
--prefix=/usr/local/arm
--target=arm-linux
--enable-shared
--enable-threads=posix
--with-system-zlib
--disable-checking
--enable-__cxa_atexit --enable-languages=c,c++
Thread model:
posix
Gcc version:3.2.3
注:xscale-gcc-3.3.3的交叉编译器对fork()函数存在一些问题,所以需要另外一个版本的交叉编译器来编译BusyBox等应用软件,只在编译内核时使用xscale-gcc-3.3.3。xscale-gcc-3.3.3被安装到/usr/local/xscale/目录下,另一个交叉编译工具链被安装在/usr/local/arm目录下。
2. 工作目录的建立:
1) 建立软件包:
在“/”跟目录下建立一个工作目录lubbock,然后复制所需的软件包到lubbock目录中:
[root@localhost /]# mkdir lubbock
[root@localhost /]# …… (复制软件包)
[root@localhost /]# ls lubbock -l
total 46768
-rwxr--r-- 1 bucket bucket 1296439 Sep 1 03:14 busybox-1.00-rc3.tar.gz
-rwxr--r-- 1 bucket bucket 35092228 Jun 16 14:01 linux-2.6.7.tar.bz2
-rwxr--r-- 1 bucket bucket 11320794 Aug 22 09:04 skyeye-0.7.7.tar.bz2
-rwxr--r-- 1 bucket bucket 110491 Sep 20 2004
tinylogin-1.4.tar.gz
下面使用tar解开各压缩包,之后删除压缩包以节省空间:
[root@localhost lubbock]# cd lubbock
[root@localhost lubbock]# tar jxvf linux-2.6.7.tar.bz2
[root@localhost lubbock]# tar jxvf skyeye-0.7.7.tar.bz2
[root@localhost lubbock]# tar zxvf busybox-1.00-rc3.tar.gz
[root@localhost lubbock]# tar zxvf tinylogin-1.4.tar.gz
[root@localhost lubbock]# rm *.bz2 *.gz
[root@localhost lubbock]# ls -l
total 16
drwxr-xr-x 28 bucket bucket 4096 Aug 16 06:30
busybox-1.00-rc3
drwxrwxr-x 18 bucket bucket 4096 Jun 16 01:19
linux-2.6.7
drwxrwxr-x 16 bucket bucket 4096 Jul 20 22:44
skyeye
drwxr-xr-x 6 bucket bucket 4096 Jan 3 2003
tinylogin-1.4
2) 安装SkyEye的LCD和触摸屏补丁:(如果不需要LCD和触摸屏的支持,本步骤可以跳过)
在SkyEye-0.7.7中还没有对lubbock开发板的LCD和触摸屏进行支持,需要安装几个补丁文件。在这里要感谢陈渝版主和尹文超同学提供补丁文件和修改方法。
将补丁文件复制到lubbock/lcd_touchpad_patch目录中:
[root@localhost /]# ls luboock/lcd_touchpad_patch -R -l
lcd_touchpad_patch/:
total 8
drwxr-xr-x 2 root root 4096 Sep 5 16:27 lcd
drwxr-xr-x 2 root root 4096 Sep 5 16:27 touchpad
lcd_touchpad_patch/lcd:
total 92
-rwxr--r-- 1 bucket bucket 11437 Aug 27 02:30 armmem.c
-rwxr--r-- 1 bucket bucket 4512 Aug 27 02:30 pxa.h
-rwxr--r-- 1 bucket bucket 15724 Aug 27 02:28
skyeye_lcd.c
-rwxr--r-- 1 bucket bucket 18771 Aug 27 02:28 skyeye_mach_pxa.c
-rwxr--r-- 1 bucket bucket 33340 Aug 31 21:33 xscale_copro.c
lcd_touchpad_patch/touchpad:
total 156
-rwxr--r-- 1 bucket bucket 187 Aug 31 23:22 Makefile
-rwxr--r-- 1 bucket bucket 106297 Aug 31 23:18 pxa-sys.h
-rwxr--r-- 1 bucket bucket 26947 Aug 31 23:19 skyeye_ts_drv.c
-rwxr--r-- 1 bucket bucket 12967 Aug 31 23:19
skyeye_ts_drv.h
将lcd_touchpad_patch/lcd目录中的文件复制到skyeye的sim/arm目录下:
[root@localhost /]# cd /lubbock
[root@localhost lubbock]# cp lcd_touchpad/lcd/* skyeye/sim/arm -a -f
将lcd_touchpad_patch/touchpad目录中的文件复制到linux-2.6.7的drivers/misc目录下:
[root@localhost /]# cd /lubbock
[root@localhost lubbock]# cp lcd_touchpad/touchpad/*
linux-2.6.7/drivers/misc -a -f
3) 设置环境变量:
为了以后操作方便,设置一些环境变量。可以将下面的操作添加到工作用户的目录的.bashrc文件中(例如/root/.bashrc),省去下次登陆后还要进行相同的设置工作。
[root@localhost /]# export LUBBOCKDIR=/lubbock
[root@localhost /]# cd $LUBBOCKDIR
[root@localhost lubbock]# export KERNELDIR=$PWD/linux-2.6.7
[root@localhost lubbock]# export SKYEYEDIR=$PWD/skyeye
[root@localhost lubbock]# export BUSYBOXDIR=$PWD/busybox-1.00-rc3
[root@localhost lubbock]# export TINYLOGINDIR=$PWD/tinylogin-1.4
3. 编译系统软件:
1) 编译SkyEye:
在SkyEye的源码目录中配置并编译SkyEye:
[root@localhost /]# cd $SKYEYEDIR
[root@localhost skyeye]# ./configure \
--target=arm-elf \
--prefix=/usr/local
[root@localhost skyeye]# make
[root@localhost skyeye]# make install
configure时--target参数指定了SkyEye模拟执行ELF格式的文件,而--prefix参数指定了SkyEye的安装路径。编译并安装后的SkyEye的可执行文件放在/usr/local/bin目录中:
[root@localhost skyeye]# ls /usr/local/bin/skyeye -l
-rwxr-xr-x 1 root root 2168384 Sep 5 23:55
/usr/local/bin/skyeye
将/usr/local/bin目录加入环境变量PATH中,以后就可以在任意路径下运行SkyEye:
[root@localhost skyeye]# export PATH=/usr/local/bin:$PATH
注:由于SkyEye目前还没有完全模拟指令的全部功能,所以在SkyEye模拟的系统上运行一些应用程序时会有“SKYEYE ARMul_LDC,NOT ALLOW,……”之类的信息出现,不过不会影响应用程序的正常运行。如果觉得影响了程序的信息显示,可以将$SKYEYEDIR/sim/arm/armsupp.c中相应的printf语句注释即可。本例中将该文件中Line 493和Line 579两行的printf语句注释了。
2) 编译Linux内核:
由于Linux-2.6.7内核本身已经支持lubbock开发板,因此,只要在原有的默认设置基础上稍加修改即可。注意配置嵌入式开发板的内核时,需要设置ARCH参数为arm:
[root@localhost /]# cd $KERNELDIR
[root@localhost linux-2.6.7] make ARCH=arm lubbock_defconfig
[root@localhost linux-2.6.7] make ARCH=arm meunconfig
--->选择: General Setup(第二个)
--->修改
(root=/dev/nfs ip=bootp console=ttyS0,115200 mem=64M) Default
kernel command string
为:
(root=/dev/ram rw initrd=0xa1000000,0x01000000
console=ttyS0,115200 mem=64M)
--->选择: Block Devices
--->修改
[ ]RamDisk support
为RamDisk support
--->修改
(4096) Default Ram disk size(kbytes)
为
(16384) Default Ram disk size(kbytes)
--->修改
[ ] Initial Ram disk (initrd) support
为 Initial Ram disk (initrd) support
--->保存并退出
修改COMMAND_LINE告诉内核系统文件系统的位置及尺寸,修改Ramdisk Support使内核支持Ramdisk,并指定其尺寸。如果要系统支持lubbock的LCD显示设备,还要进行如下修改:
[root@localhost linux-2.6.7]# make ARCH=arm meunconfig
--->选择: Graphics Support
--->修改
[ ] Support for frame buffer devices
为 Support for frame buffer devices
--->修改
< > PXA LCD framebuffer support
为
<*> PXA LCD framebuffer support
--->修改
[ ] PXA LCD command line parameters
为 PXA LCD command line parameters
--->保存并退出
完成内核配置之后,使用make指令编译内核。由于内核运行在嵌入式开发板上,因此需要在设置ARCH参数的同时指明所需的交叉编译工具链。在此使用的是xscale-gcc-3.3.3:
[root@localhost linux-2.6.7]# make \
ARCH=arm \
CROSS_COMPILE=/usr/local/xscale/3.3.3/bin/arm-linux- \
zImage
编译生成的压缩内核文件放在arch/arm/boot/中,文件名称为zIamge:
[root@localhost linux-2.6.7]# ls arch/arm/boot/zIamge -l
-rwxr-xr-x 1 root root 947512 Sep 6 02:49
arch/arm/boot/zImage
注:内核配置中COMMAND_LINE的值很重要,它要与后面将要提到的SkyEye的配置文件内容必须一致,否则会导致内核无法正常加载。root参数指出根文件系统的位置及属性(如果不加rw参数,启动后的文件系统位只读属性), initrd参数指定了Ramdisk文件系统的在内存中的位置及尺寸。这里Ramdisk被映射到内存地址的0xa000000处,尺寸为0x01000000(16M)。
3) 编译BusyBox:
配置BusyBox需要指明交叉工具链的位置(本例使用工具链放在/usr/local/arm/bin目录中),同时由于BusyBox在内核刚完成加载后就立即启动,所以为了避免设置共享库链接的麻烦,应将BusyBox编译为Static Binary:
[root@localhost /]# cd $BUSYBOXDIR
[root@localhost busybox-1.00-rc3]# make menuconfig
--->选择: Build Options
--->修改
[ ] Build BusyBox as a static binary (no shared libs)
为 Build BusyBox as a static binary (no shared libs)
--->修改
[ ] Do you want to build BusyBox with a Cross Compiler?
为 Do you want to build BusyBox with a Cross Compiler?
(/usr/local/arm/bin/arm-linux-) Cross Compiler prefix
--->根据自己的需要修改其他的选项
--->保存并退出
编译并后安装BusyBox:
[root@localhost busybox-1.00-rc3]# make
[root@localhost busybox-1.00-rc3]# make install
生成的可执行文件被放在busybox-1.00-rc3/_install目录下
[root@localhost busybox-1.00-rc3]# ls _install -l
drwxr-xr-x 2 root root 4096 Sep 6 17:49 bin
lrwxrwxrwx 1 root root 11 Sep 6 17:49 linuxrc -> bin/busybox
drwxr-xr-x 2 root root 4096 Sep 6 17:49 sbin
drwxr-xr-x 4 root root 4096 Sep 6 17:49 usr
[root@localhost busybox-1.00-rc3]# ls _install/bin/busybox -l
-rwxr-xr-x 1 root root 931272 Sep 6 17:49
_install/bin/busybox
注:如果将BusyBox编译成共享库链接的二进制文件,需要将所需的共享库放在文件系统的/lib目录中。如果将共享库放在其他位置,则系统由可能无法找到共享库而无法运行BusyBox。由于BusyBox无法运行,系统的Shell也不可能加载,所以不能通过使用export或setenv来设置LD_LIBRARY_PATH变量。解决的办法是在内核的COMMAND_LINE设置该变量。例如共享库放在/usr/local/arm/lib目录中,则在COMMAND_LINE中添加LD_LIBRARY_PATH =/usr/local/arm/lib即可。
4) 编译TinyLogin:
编译TinyLogin,除了设置交叉编译工具链之外,还要修改Makefile中的几个参数,让TinyLogin使用自带的passwd和shadow函数库(如果不使用TinyLogin自带的函数库,TinyLogin会使用系统的函数库,则还要在开发板的文件系统中安装nss链接库,比较麻烦):
[root@localhost /]# cd $TINYLOGINDIR
[root@localhost tinylogin-1.4]# vi Makefile
--->修改
DOSTATIC=false
为
DOSTATIC=true(将TinyLogin编译成为静态的二进制文件)
--->修改
USE_SYSTEM_PWD_GRP=true
为
USE_SYSTEM_PWD_GRP=false(使用TinyLogin自带passwd函数库)
--->修改
USE_SYSTEM_SHADOW=true
为
USE_SYSTEM_SHADOW=false(使用TinyLogin自带shadow函数库)
--->修改
CROSS=
为
CROSS =/usr/local/arm/bin/arm-linux-
(设置交叉编译工具链的位置)
编译安装好的TinyLogin二进制文件放在tinylogin-1.4/_install目录中:
[root@localhost tinylogin-1.4]# make
[root@localhost tinylogin-1.4]# make install
[root@localhost tinylogin-1.4]# ls _install -l
total 12
drwxr-xr-x 2 root root 4096 Sep 6 19:24 bin
drwxr-xr-x 2 root root 4096 Sep 6 19:24 sbin
drwxr-xr-x 3 root root 4096 Sep 6 19:24 usr
[root@localhost tinylogin-1.4]# ls _install/bin/tinylogin -l
-rwsr-xr-x 1 root root 40036 Sep 6 19:24
_install/bin/tinylogin
4. 制作开发板的文件系统:
文件系统采用Ramdisk,首先生成一个基本的Ramdisk映像文件:
[root@localhost /]# cd $LUBBOCKDIR
[root@localhost lubbock]# dd if=/dev/zero of=ramdisk.img bs=1k count=16k
16384+0 records in
16384+0 records out
[root@localhost lubbock]# mke2fs ramdisk.img
mke2fs 1.32 (09-Nov-2002)
ramdisk.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
4096 inodes, 16384 blocks
819 blocks (5.00%) reserved for the super user
First data block=1
2 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost lubbock]# file ramdisk.img
ramdisk.img: Linux rev 1.0 ext2 filesystem data
然后编写一个脚本(initrootfs.sh)在文件系统中生成基本的目录结构和设备节点,脚本的内容如下:
[root@localhost lubbock]# cat initrootfs.sh
#!/bin/sh
cd ./rootfs
echo "Making directories needed for the system..."
mkdir bin
mkdir dev
mkdir etc
mkdir home
mkdir mnt
mkdir proc
mkdir root
mkdir sbin
mkdir tmp
mkdir usr
mkdir var
echo "Making device nodes needed for the system..."
cd dev
mknod console c 5 1
mknod ttyS0 c 4 64
mknod tty c 5 0
mknod ram0 b 1 0
mknod ram1 b 1 1
mknod mem c 1 1
mknod kmem c 1 2
mknod null c 1 3
mknod zero c 1 5
mknod fb0 c 29 0
mknod ptmx c 5 2
SUFFIXES="0 1 2 3 4 5 6 7 8 9 a b c d e f"
MAJOR=176
for i in $SUFFIXES; do
mknod ptya$i c 2 $MAJOR
MAJOR=`expr $MAJOR + 1`
done
# reset MAJOR
MAJOR=176
for i in $SUFFIXES; do
mknod ttya$i c 3 $MAJOR
MAJOR=`expr $MAJOR + 1`
done
# reset and make tty devices
SUFFIXES="0 1 2 3 4 5 6 7 8 9"
MAJOR=0
for i in $SUFFIXES; do
mknod tty$i c 4 $MAJOR
MAJOR=`expr $MAJOR + 1`
done
ln -s fb0 fb
ln -s ram1 ram
ln -s ram0 ramdisk
ln -s ../proc/kcore kcore
ln -s ../proc/self/fd/0 stdin
ln -s ../proc/self/fd/1 stdout
ln -s ../proc/self/fd/2 stderr
执行该脚本:
[root@localhost lubbock]# mkdir rootfs
[root@localhost lubbock]# mount ramdisk.img rootfs/ -o loop
[root@localhost lubbock]# ./initrootfs.sh
Making directories needed for the system...
Making device nodes needed for the system...
[root@localhost lubbock]# ls rootfs/ -l
total 23
drwxr-xr-x 2 root root 1024 Sep 6 21:39 bin
drwxr-xr-x 2 root root 1024 Sep 6 21:39 dev
drwxr-xr-x 2 root root 1024 Sep 6 21:39 etc
drwxr-xr-x 2 root root 1024 Sep 6 21:39 home
drwx------ 2 root root 12288 Sep 6 21:30 lost+found
drwxr-xr-x 2 root root 1024 Sep 6 21:39 mnt
drwxr-xr-x 2 root root 1024 Sep 6 21:39 proc
drwxr-xr-x 2 root root 1024 Sep 6 21:39 root
drwxr-xr-x 2 root root 1024 Sep 6 21:39 sbin
drwxr-xr-x 2 root root 1024 Sep 6 21:39 tmp
drwxr-xr-x 2 root root 1024 Sep 6 21:39 usr
drwxr-xr-x 2 root root 1024 Sep 6 21:39 var
[root@localhost lubbock]# ls rootfs/dev -l
total 0
crw-r--r-- 1 root root 5, 1 Sep 6 21:39 console
lrwxrwxrwx 1 root root 3 Sep 6 21:39 fb -> fb0
crw-r--r-- 1 root root 29, 0 Sep 6 21:39 fb0
lrwxrwxrwx 1 root root 13 Sep 6 21:39 kcore -> ../proc/kcore
crw-r--r-- 1 root root 1, 2 Sep 6 21:39 kmem
crw-r--r-- 1 root root 1, 1 Sep 6 21:39 mem
crw-r--r-- 1 root root 1, 3 Sep 6 21:39 null
crw-r--r-- 1 root root 5, 2 Sep 6 21:39 ptmx
crw-r--r-- 1 root root 2, 176 Sep 6 21:39 ptya0
crw-r--r-- 1 root root 2, 177 Sep 6 21:39 ptya1
crw-r--r-- 1 root root 2, 178 Sep 6 21:39 ptya2
crw-r--r-- 1 root root 2, 179 Sep 6 21:39 ptya3
crw-r--r-- 1 root root 2, 180 Sep 6 21:39 ptya4
crw-r--r-- 1 root root 2, 181 Sep 6 21:39 ptya5
crw-r--r-- 1 root root 2, 182 Sep 6 21:39 ptya6
crw-r--r-- 1 root root 2, 183 Sep 6 21:39 ptya7
crw-r--r-- 1 root root 2, 184 Sep 6 21:39 ptya8
crw-r--r-- 1 root root 2, 185 Sep 6 21:39 ptya9
crw-r--r-- 1 root root 2, 186 Sep 6 21:39 ptyaa
crw-r--r-- 1 root root 2, 187 Sep 6 21:39 ptyab
crw-r--r-- 1 root root 2, 188 Sep 6 21:39 ptyac
crw-r--r-- 1 root root 2, 189 Sep 6 21:39 ptyad
crw-r--r-- 1 root root 2, 190 Sep 6 21:39 ptyae
crw-r--r-- 1 root root 2, 191 Sep 6 21:39 ptyaf
lrwxrwxrwx 1 root root 4 Sep 6 21:39 ram -> ram1
brw-r--r-- 1 root root 1, 0 Sep 6 21:39 ram0
brw-r--r-- 1 root root 1, 1 Sep 6 21:39 ram1
lrwxrwxrwx 1 root root 4 Sep 6 21:39 ramdisk -> ram0
lrwxrwxrwx 1 root root 17 Sep 6 21:39 stderr -> ../proc/self/fd/2
lrwxrwxrwx 1 root root 17 Sep 6 21:39 stdin -> ../proc/self/fd/0
lrwxrwxrwx 1 root root 17 Sep 6 21:39 stdout -> ../proc/self/fd/1
crw-r--r-- 1 root root 5, 0 Sep 6 21:39 tty
crw-r--r-- 1 root root 4, 0 Sep 6 21:39 tty0
crw-r--r-- 1 root root 4, 1 Sep 6 21:39 tty1
crw-r--r-- 1 root root 4, 2 Sep 6 21:39 tty2
crw-r--r-- 1 root root 4, 3 Sep 6 21:39 tty3
crw-r--r-- 1 root root 4, 4 Sep 6 21:39 tty4
crw-r--r-- 1 root root 4, 5 Sep 6 21:39 tty5
crw-r--r-- 1 root root 4, 6 Sep 6 21:39 tty6
crw-r--r-- 1 root root 4, 7 Sep 6 21:39 tty7
crw-r--r-- 1 root root 4, 8 Sep 6 21:39 tty8
crw-r--r-- 1 root root 4, 9 Sep 6 21:39 tty9
crw-r--r-- 1 root root 3, 176 Sep 6 21:39 ttya0
crw-r--r-- 1 root root 3, 177 Sep 6 21:39 ttya1
crw-r--r-- 1 root root 3, 178 Sep 6 21:39 ttya2
crw-r--r-- 1 root root 3, 179 Sep 6 21:39 ttya3
crw-r--r-- 1 root root 3, 180 Sep 6 21:39 ttya4
crw-r--r-- 1 root root 3, 181 Sep 6 21:39 ttya5
crw-r--r-- 1 root root 3, 182 Sep 6 21:39 ttya6
crw-r--r-- 1 root root 3, 183 Sep 6 21:39 ttya7
crw-r--r-- 1 root root 3, 184 Sep 6 21:39 ttya8
crw-r--r-- 1 root root 3, 185 Sep 6 21:39 ttya9
crw-r--r-- 1 root root 3, 186 Sep 6 21:39 ttyaa
crw-r--r-- 1 root root 3, 187 Sep 6 21:39 ttyab
crw-r--r-- 1 root root 3, 188 Sep 6 21:39 ttyac
crw-r--r-- 1 root root 3, 189 Sep 6 21:39 ttyad
crw-r--r-- 1 root root 3, 190 Sep 6 21:39 ttyae
crw-r--r-- 1 root root 3, 191 Sep 6 21:39 ttyaf
crw-r--r-- 1 root root 4, 64 Sep 6 21:39 ttyS0
crw-r--r-- 1 root root 1, 5 Sep 6 21:39 zero
复制BusyBox和TinyLogin的相关文件到文件系统相应的目录中:
[root@localhost lubbock]# cp $BUSYBOXDIR/_install/* rootfs/ -a
[root@localhost lubbock]# cp $TINYLOGINDIR/_install/* rootfs/ -a
BusyBox启动时需要根据开发板文件系统/etc目录中inittab文件中的设置,执行相应的应用程序或脚本文件。BusyBox调用inittab中设置的顺序为sysinit->wait->once->respawn->askfirst。本例这里就设置了sysinit,wait,askfirst三项:
[root@localhost lubbock]# cd rootfs/etc
[root@localhost etc]# cat inittab
# Boot-time system configuration/initialization script.
# This is run first except when booting in single-user mode.
#
::sysinit:/etc/init.d/rcS
# Start an "askfirst" shell on the console (whatever that may be)
::askfirst:/bin/sh
# Single User Login
::wait:/sbin/sulogin
# Stuff to do before rebooting
::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1
::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1
接下来设置系统初始化脚本/etc/init.d/rcS文件。
[root@localhost etc]# mkdir init.d
[root@localhost etc]# cat init.d/rcS
#! /bin/sh
# Mount the /proc file system
mount -t proc proc /proc
# Set Hostname
hostname Xscale
# Show version information
cat /etc/motd
cat /etc/version
# Fall through to a shell prompt
exit 0
由于使用了TinyLogin,所以还需要配置/etc目录中几个相关的用户和密码文件。它们包括passwd,shadow,group,内容如下(系统中只有两个用户。root用户,密码为123456;Lubbock用户,密码为lubbock):
[root@localhost lubbock]# cat rootfs/etc/passwd
root:0:0:root:/root:/bin/sh
Lubbock:500:500:Linux User,,,:/home/Lubbock:/bin/sh
[root@localhost lubbock]# cat rootfs/etc/shadow
root:$1$DCwsqZWC$IiPgfLKlqYEZrg.kI77Kd0:12668:0:99999:7:::
Lubbock:zAGbe1QCfqwjs:0:0:99999:7:::
[root@localhost lubbock]# cat rootfs/etc/group
root::0:root
基本的内容已经完成,保存修改文件系统内容,生成最终的文件系统映像文件:
[root@localhost lubbock]# umount ramdisk
5. 配置SkyEye,模拟lubbock运行:
编写lubbock开发板的SkyEye配置文件:
[root@localhost /]# cd $LUBBOCKDIR
[root@localhost lubbock]# cat skyeye.conf
cpu: xscale
mach: pxa_lubbock
mem_bank: map=I, type=RW, addr=0x40000000, size=0x0c000000
mem_bank: map=M, type=RW, addr=0xa0000000, size=0x00200000
mem_bank: map=M, type=RW, addr=0xa0200000, size=0x00100000, file=zImage, boot=yes
mem_bank: map=M, type=RW, addr=0xa0300000, size=0x00d00000
mem_bank: map=M, type=RW, addr=0xa1000000, size=0x01000000, file=./ramdisk.img
mem_bank: map=M, type=RW, addr=0xa2000000, size=0x02000000
mem_bank: map=M, type=RW, addr=0xc0000000, size=0x00096000
lcd: state=on
设置内核连接,模拟运行lubbock开发板:
[root@localhost /]# cd $LUBBOCKDIR
[root@localhost lubbock]# ln -s $KERNELDIR/arch/arm/boot/zImage
./zImage
[root@localhost lubbock]# skyeye
***************************************************************
**** ****
**** SkyEye Simulator Ver 0.7.7 with GDB 5.3 Interface ****
**** ****
***************************************************************
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This SkyEye was configured as "--host=i686-pc-linux-gnu --target=arm-elf".
(SkyEye) tar s
cpu info: xscale, xscale, 69052100, fffffff0, 2
mach info: name pxa_lubbock, mach_init addr 0x81639b0
lcd info: turn on lcd!
SKYEYE: use xscale mmu ops
Loaded ROM zImage
rLoaded ROM ./ramdisk.img
Connected to the simulator.
(SkyEye) run
Starting program:
warning: No executable file specified.
warning: No program loaded.
Uncompressing Linux................................................................. done, booting the kernel.
Linux version 2.6.7 ([email protected]) (gcc version 3.3.3) #8 Mon Sep 6 20:04:38 EDT 2004
CPU: XScale-PXA250 [69052100] revision 0 (ARMv5TE)
CPU: D undefined 5 cache
CPU: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
CPU: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
Machine: Intel DBPXA250 Development Platform (aka Lubbock)
Memory policy: ECC disabled, Data cache writeback
Memory clock: 99.53MHz (*27)
Run Mode clock: 99.53MHz (*1)
Turbo Mode clock: 99.53MHz (*1.0, inactive)
On node 0 totalpages: 16384
DMA zone: 16384 pages, LIFO batch:4
Normal zone: 0 pages, LIFO batch:1
HighMem zone: 0 pages, LIFO batch:1
Built 1 zonelists
Kernel command line: root=/dev/ram rw initrd=0xa1000000,0x01000000 console=ttyS0,115200 mem=64M
PID hash table entries: 512 (order 9: 4096 bytes)
Console: colour dummy device 80x30
Memory: 64MB = 64MB total
Memory: 46432KB available (1607K code, 371K data, 80K init)
Calibrating delay loop... 7.29 BogoMIPS
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
Freeing initrd memory: 16384K
NET: Registered protocol family 16
Linux Kernel Card Services
options: none
SKYEYE: lcd_addr_begin 0xc0000000,lcd_addr_end 0xc0095fff, width 640, height 480, depth 16
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (C) 2001-2003 Red Hat, Inc.
ttyS0 at MMIO 0x40100000 (irq = 15) is a FFUART
ttyS1 at MMIO 0x40200000 (irq = 14) is a BTUART
ttyS2 at MMIO 0x40700000 (irq = 13) is a STUART
RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
drivers/misc/skyeye_ts_drv.c: SkyEye touch screen driver initialize
drivers/misc/skyeye_ts_drv.c: Device register with name: skyeye touch screen and number: 10 9
Using anticipatory io scheduler
Lubbock configured to boot from ROM (bank 0)
Probing Lubbock Boot ROM at physical address 0x00000000 (32-bit buswidth)
CFI: Found no Lubbock Boot ROM device at location zero
Probing Lubbock Application Flash at physical address 0x04000000 (32-bit buswidth)
CFI: Found no Lubbock Application Flash device at location zero
pxa2xx_udc: version 14-Dec-2003
gs_bind: Gadget Serial v0.1 bound
gs_module_init: Gadget Serial v0.1 loaded
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 4096 bind 8192)
NET: Registered protocol family 1
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 16384 blocks [1 disk] into ram disk... done.
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem).
Freeing init memory: 80K
Welcome to
_ _____ __ __ _ _
/ \ / __ \ / \_/ \ | | |_|
/ _ \ | | | | / /\ /\ \ | | _ ____ _ _ _ _
/ /_\ \ | |__| | / / \_/ \ \| | | | _ \| | | |\ \/ /
/ /___\ \ | |__\ \ | | | || |___ | | |_| | |_| |/ \
/_/ \_\| | \_\|_| |_||_____||_|_| |_|\____|\_/\_/
ARMLinux for Skyeye
For further information check:
http://hpclab.cs.tsinghua.edu.cn/~skyeye/
Version: ARMLinux 2.6.7
Give root password for system maintenance
(or type Control-D for normal startup):
Entering System Maintenance Mode
sulogin[128]: System Maintenance Mode
/ #
6. 在SkyEye模拟的Lubbock开发板上运行应用程序:
编译一个HelloWolrd的程序,并编译应用程序并放到开发板文件系统中:
[root@localhost /]# cd $LUBBOCKDIR
[root@localhost lubbock]# cat hello.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf(“Hello, Wordl!\n”);
exit(EXIT_SUCCESS);
}
[root@localhost lubbock]# /usr/local/arm/bin/arm-linux-gcc -O2 -o hello hello.c
[root@localhost lubbock]# /usr/local/arm/bin/arm-linux-strip hello
[root@localhost lubbock]# mount ramdisk.img rootfs/ -o loop
[root@localhost lubbock]# mkdir rootfs/example
[root@localhost lubbock]# cp hello rootfs/example
复制应用程序需要的共享库到文件系统中,并建立相应的链接:
[root@localhost lubbock]# cp \
/usr/local/arm/arm-linux/lib/ld-2.2.5.so \
/usr/local/arm/arm-linux/lib/libc-2.2.5.so .
[root@localhost lubbock]# /usr/local/arm/bin/arm-linux-strip \
/usr/local/arm/arm-linux/lib/ld-2.2.5.so
[root@localhost lubbock]# /usr/local/arm/bin/arm-linux-strip \
/usr/local/arm/arm-linux/lib/libc-2.2.5.so
[root@localhost lubbock]# mv ld-2.2.5.so libc-2.2.5.so rootfs/lib
[root@localhost lubbock]# cd rootfs/lib
[root@localhost lib]# ln -s ld-2.2.5.so ld-linux.so.2
[root@localhost lib]# ln -s libc-2.2.5.so libc.so.6
[root@localhost lib]# ls -l
total 1140
-rwxr-xr-x 1 root root 79848 Sep 8 19:03
ld-2.2.5.so
lrwxrwxrwx 1 root root 11 Sep 8 19:05 ld-linux.so.2 -> ld-2.2.5.so
-rwxr-xr-x 1 root root 1079792 Sep 8 19:03 libc-2.2.5.so
lrwxrwxrwx 1 root root 13 Sep 8 19:05
libc.so.6 -> libc-2.2.5.so
保存对文件系统的修改,生成新的映像文件:
[root@localhost /]# cd $LUBBOCKDIR
[root@localhost lubbock]# umount ramdisk.img
启动SkyEye模拟Lubbock并运行应用程序:
[root@localhost /]# cd $LUBBOCKDIR
[root@localhost /]# skyeye
……
Welcome to
_ _____ __ __ _ _
/ \ / __ \ / \_/ \ | | |_|
/ _ \ | | | | / /\ /\ \ | | _ ____ _ _ _ _
/ /_\ \ | |__| | / / \_/ \ \| | | | _ \| | | |\ \/ /
/ /___\ \ | |__\ \ | | | || |___ | | |_| | |_| |/ \
/_/ \_\| | \_\|_| |_||_____||_|_| |_|\____|\_/\_/
ARMLinux for Skyeye
For further information check:
http://hpclab.cs.tsinghua.edu.cn/~skyeye/
Version: ARMLinux 2.6.7
Give root password for system maintenance
(or type Control-D for normal startup):
Entering System Maintenance Mode
sulogin[128]: System Maintenance Mode
/ # cd example
/example # ./hello
Hello, World!
/example #
注:应用程序和共享库在放到开发板的文件系统之前都应该先用arm-linux-strip将其中的附加的调试信息等内容去掉,这样可以大大节省文件系统的使用空间。例如libc-2.2.5使用arm-linux-strip后,尺寸由原来的15M缩小到1M。 |
|