續:
好了,下面咱們再運行skyeye進行仿真,鍵入:skyeye -e linux
node
代碼:
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ skyeye -e linux
big_endian is false.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x8057550
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
can't find device module: (name:net, type:(null))
log_info: log is off.
log_info:log file is /tmp/test.log, fd is 0x80f9318
log_info: log start clock 3200000
log_info: log end clock 3330000
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM ./boot.rom
start addr is set to 0x01000000 by exec file.
Linux version 2.4.20-uc0 (chy@localhost.localdomain) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #7 ?? 8?? 1 19:43:07 CST 2003
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
zone(0): 0 pages.
zone(1): 1024 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 12.97 BogoMIPS
Memory: 4MB = 4MB total
Memory: 2984KB available (833K code, 181K data, 40K init)
Dentry cache hash table entries: 512 (order: 0, 4096 bytes)
Inode cache hash table entries: 512 (order: 0, 4096 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 1024 (order: 0, 4096 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Atmel USART driver version 0.99
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk p_w_picpaths:
0: 1400000-157D3FF [VIRTUAL 1400000-157D3FF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
SkyEye NE2k Ethernet driver version 0.2 (2003-04-27)
sene2k dev name: eth0: <6>NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
sys_mount:dev_name /dev/root,dir_name /root, type ext2, flag 0x8001, data 0
sys_mount:1 data_page 1122000, type_page 113bf74, dev_page 0, dir_page 8001
sys_mount:2 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:3 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:4 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:dev_name /dev/root,dir_name /root, type romfs, flag 0x8001, data 0
sys_mount:1 data_page 0, type_page 117f000, dev_page 117d000, dir_page 8001
sys_mount:2 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:3 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:4 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
VFS: Mounted root (romfs filesystem) readonly.
sys_mount:dev_name .,dir_name /, type <NULL>, flag 0x2000, data 0
sys_mount:1 data_page 111c120, type_page 0, dev_page 10e5d00, dir_page 10e5174
sys_mount:2 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000
sys_mount:3 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000
sys_mount:4 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000
Shell invoked to run file: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
sys_mount:dev_name /proc,dir_name /proc, type proc, flag 0xc0ed0000, data 11d0008
sys_mount:1 data_page 1000, type_page 1002, dev_page 118a008, dir_page c0ed0000
sys_mount:2 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000
sys_mount:3 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000
sys_mount:4 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000
mount: /etc/mtab: Read-only file system
Command: mount -t ext2 /dev/ram0 /var
sys_mount:dev_name /dev/ram0,dir_name /var, type ext2, flag 0xc0ed0000, data 11d0008
sys_mount:1 data_page 111c260, type_page 119fe40, dev_page 0, dir_page c0ed0000
sys_mount:2 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000
sys_mount:3 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000
sys_mount:4 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000
mount: /etc/mtab: Read-only file system
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: cat /etc/motd
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|
GDB/ARMulator support by <davidm@snapgear.com>
For further information check:
http://www.uclinux.org/
Command: /bin/ifconfig eth0 up 10.0.0.2
Execution Finished, Exiting
Sash command shell (version 1.1.1)
/>
在這裏面進行如下操做:
linux
代碼:
/> cd bin
/bin> ./test
i=0
Hello,embedded linux!
i=1
Hello,embedded linux!
i=2
Hello,embedded linux!
i=3
Hello,embedded linux!
i=4
Hello,embedded linux!
i=5
Hello,embedded linux!
/bin>
看到程序在運行了嗎?
5、編譯咱們的uClinux內核
首先解壓
shell
代碼:
tar zxvf uClinux-dist-20040408.tar.gz
這是在你解壓的目錄裏面會生成一個 uClinux-dist目錄
shell 中進 uClinux-dist目錄,執行make menuconfig進行配置,我猜你遇到了和我同樣的問題:
dom
代碼:
wenwu@wenwu-desktop:/source/uClinux-dist$ make menuconfig
config/mkconfig > config.in
make -C /source/uClinux-dist/config/scripts/lxdialog all
make[1]: Entering directory `/source/uClinux-dist/config/scripts/lxdialog'
/usr/bin/ld: cannot find -lncurses
collect2: ld 返回 1
-e
>> Unable to find the Ncurses libraries.
>>
>> You must have Ncurses installed in order
>> to use 'make menuconfig'
make[1]: *** [ncurses] 錯誤 1
make[1]: Leaving directory `/source/uClinux-dist/config/scripts/lxdialog'
make: *** [menuconfig] 錯誤 2
wenwu@wenwu-desktop:/source/uClinux-dist$
實際上是沒有安裝ncurses開發包,安裝就是了
在新立得軟件管理器中找到libncurses5-dev,安裝
用的朋友喜歡用make xconfig,直接運行會出現以下錯誤:
socket
代碼:ide
wenwu@wenwu-desktop:/source/uClinux-dist$ sudo make xconfig
config/mkconfig > config.in
make -C /source/uClinux-dist/config/scripts tkparse
make[1]: Entering directory `/source/uClinux-dist/config/scripts'
make[1]: 「tkparse」是最新的。
make[1]: Leaving directory `/source/uClinux-dist/config/scripts'
ARCH=dummy /source/uClinux-dist/config/scripts/tkparse < config.in > config.tmp
cat /source/uClinux-dist/config/scripts/header.tk >> ./config.tk
cat config.tmp >> config.tk
rm -f config.tmp
echo "set defaults \"/dev/null\"" >> config.tk
echo "set help_file \"config/Configure.help\"" >> config.tk
cat /source/uClinux-dist/config/scripts/tail.tk >> config.tk
chmod 755 config.tk
make: wish:命令未找到
make: *** [xconfig] 錯誤 127
解決辦法是在新立得軟件包管理器中找到如下幾項並安裝,而後再運行make xconfig就能夠看到圖形界面了。
tcl8.4
tcl8.4-dev
tk8.4
k8.4-dev
而後再進行配置:在下面這個選項裏面選擇GDB ARMulator,怎麼選擇應該不用再說了吧?
oop
代碼:
--- Select the Vendor you wish to target
(GDB) Vendor
--- Select the Product you wish to target
(ARMulator) GDB Products
Kernel選擇2.4內核,Libc Version選擇uC-libc
ui
代碼:
(linux-2.4.x) Kernel Version
(uC-libc) Libc Version
[ ] Default all settings (lose changes)
[ ] Customize Kernel Settings
[ ] Customize Vendor/User Settings
[ ] Update Default Vendor Settings
退出它會提示:
es5
代碼:
Do you wish to save your new kernel configuration?
< Yes > < No >
選擇Yes
這個時候就能夠進行編譯了,編譯首先用make dep
而後用make
很不幸,咱們的錯誤老是不斷存在!
spa
代碼:
arm/clone.S: Assembler messages:
arm/clone.S:34: Error: undefined symbol `EINVAL' in operation
make[3]: *** [arm/clone.o] 錯誤 1
make[3]: Leaving directory `/source/uClinux-dist/lib/libc/sysdeps'
make[2]: *** [subdirs] 錯誤 1
make[2]: Leaving directory `/source/uClinux-dist/lib/libc'
make[1]: *** [all] 錯誤 2
make[1]: Leaving directory `/source/uClinux-dist/lib'
make: *** [subdirs] 錯誤 1
但有時候,就是由於這些錯誤使咱們不斷前行。
其實不少人都遇到了這個錯誤 ,是上面的庫文件選擇錯了,什麼?錯了你還寫在上面?我是想讓你有更深的記憶!
make clean把上次編譯過程生成的中間文件刪除
而後make menuconfig
此次,咱們把Libc Version換成uClibc
代碼:
(uClibc) Libc Version
再重複上面的步驟:
代碼:
make dep
make
這個編譯過程比較長,耐心等待。
編譯成功後會在uClinux-dist目錄裏面生成一個p_w_picpaths目錄,這個目錄裏面有四個文件:
p_w_picpath.bin:這是包含內核映像和 romfs文件系統映像,能夠寫到Flash中的文件,
linux.data:包括內核全部的數據段
linux.text:包括內核全部的代碼段
romfs.img:文件系統
另外在uClinux-dist/linux-2.4.x目錄裏面生成了兩個文件:linux和system.map
linux:linux內核文件
system.map:內核符號表
而後在uClinux-dist目錄裏面建一個skyeye.conf文件,並鍵入如下配置文件
代碼:
#skyeye config file sample
cpu: arm7tdmi
mach: at91
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00004000
mem_bank: map=M, type=RW, addr=0x01000000, size=0x00400000
mem_bank: map=M, type=R, addr=0x01400000, size=0x00400000, file=./boot.rom
mem_bank: map=M, type=RW, addr=0x02000000, size=0x00400000
mem_bank: map=M, type=RW, addr=0x02400000, size=0x00008000
mem_bank: map=M, type=RW, addr=0x04000000, size=0x00400000
mem_bank: map=I, type=RW, addr=0xf0000000, size=0x10000000
注意這個配置文件中須要boot.rom 文件系統,可是咱們並無生成boot.rom文件系統,怎麼辦?
ln -s p_w_picpaths/romfs.img boot.rom
代碼:
wenwu@wenwu-desktop:/source/uClinux-dist$ ln -s p_w_picpaths/romfs.img boot.rom
這是就能夠在uClinux-dist 目錄裏面看到boot.rom這個文件
下面就能夠用skyeye運行咱們本身編譯出來的內核了。
代碼:
wenwu@wenwu-desktop:/source/uClinux-dist$ skyeye -e linux-2.4.x/linux
big_endian is false.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x8057550
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM ./boot.rom
start addr is set to 0x01000000 by exec file.
Linux version 2.4.24-uc0 (wenwu@wenwu-desktop) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #2 2007年 11月 11日 星期日 16:21:16 CST
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
zone(0): 0 pages.
zone(1): 1024 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 15.82 BogoMIPS
Memory: 4MB = 4MB total
Memory: 2968KB available (850K code, 180K data, 40K init)
Dentry cache hash table entries: 512 (order: 0, 4096 bytes)
Inode cache hash table entries: 512 (order: 0, 4096 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 1024 (order: 0, 4096 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Atmel USART driver version 0.99
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk p_w_picpaths:
0: 1400000-14AC3FF [VIRTUAL 1400000-14AC3FF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (romfs filesystem) readonly.
Shell invoked to run file: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: mkdir /var/empty
Command: cat /etc/motd
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|
GDB/ARMulator support by <davidm@snapgear.com>
For further information check:
http://www.uclinux.org/
Execution Finished, Exiting
Sash command shell (version 1.1.1)
/>
相信到這裏整個uClinux 開發環境的拱建以及在skyeye上的運行方法都已經很清楚了。