在ubuntu上搭建uClinux编译开发环境并用Skyeye (3)

五、编译我们的uClinux内核

首先解压
代码:
tar zxvf uClinux-dist-20040408.tar.gz

这是在你解压的目录里面会生成一个 uClinux-dist目录
shell 中进 uClinux-dist目录,执行make menuconfig进行配置,我猜你遇到了和我一样的问题:

代码:
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,直接运行会出现如下错误:
代码:
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,怎么选择应该不用再说了吧?
代码:
  --- 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
代码:
(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   

退出它会提示:
代码:

   Do you wish to save your new kernel configuration?
                   < Yes >      No                           

选择Yes
这个时候就可以进行编译了,编译首先用make dep
然后用make
很不幸,我们的错误总是不断存在!

代码:
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目录里面生成一个images目录,这个目录里面有四个文件:
image.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 images/romfs.img boot.rom
代码:
wenwu@wenwu-desktop:/source/uClinux-dist$ ln -s images/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 images:
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上的运行方法都已经很清楚了。

http://forum.ubuntu.org.cn/viewtopic.php?t=88369  转载
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值