加入收藏 | 设为首页 | 会员中心 | 我要投稿 | RSSRSS-巴斯仪表网
您当前的位置:首页 > 电子发烧 > 单片机学习

uClinux编译方法

时间:2013-11-23  来源:123485.com  作者:9stone

在http://www.uclinux.org/pub/uClinux/arm-elf-tools/ 下载arm-elf-tools-20030314.sh

在http://www.uclinux.org/pub/uClinux/dist/ 下载uClinux-dist-20041215.tar.gz

执行./arm-elf-tools-20030314.sh,安装工具链,执行tar zxvf uClinux-dist-20041215.tar.gz并进入uClinux-dist目录。 

  • 在linux-2.4.x/arch/armnommu/vmlinux-armv.lds.in文件中找到以下行:

*(got) /* Global Offset table */

在其之后添加如下语句:

 

romfs_data = .;

romfs.o

romfs_data_end = .;

注意,等号两边都要有空格。

 

  • 在vendors/Samsung/4510B/Makefile 文件中添加image目标的第三行,增加一条语句:arm-elf-ld -r -o $(ROOTDIR)/$(LINUXDIR)/romfs.o -b binary $(ROMFSIMG)

如下为增加之后:

image:

[ -d $(IMAGEDIR) ] || mkdir -p $(IMAGEDIR)

genromfs -v -V "ROMdisk" -f $(ROMFSIMG) -d $(ROMFSDIR)

arm-elf-ld –r –o /root/uclinux/uClinux-dist/linux-2.4.x/romfs.o –b binary /root/uclinux/uClinux-dist/images/romfs.img

(/root/uclinux是我存放uClinux-dist的目录) 

  •  修改linux-2.4.x/drivers/char/serial_samsung.c, 找到uart_config数组,把如下项:

{ "S3C4510B", 1, 0}, /* Samsung S3C4510B uart support */

修改为:

{ "S3C4510B", 128, 0}, /* Samsung S3C4510B uart support */

 

  • 执行make menuconfig

                此处设置成S3C44B0X 

  • 修改config/.config,注释掉CONFIG_USER_OLD_PASSWORDS
  •  执行make dep
  •  执行make lib_only
  •  执行make user_only
  •  执行make romfs
  • 修改linux-2.4.x/arch/armnommu/mach-S3C44B0X/arch.c

                         将23行的S3C44B0X改为S3C44B0

                         在代码末尾添加”}”

                         修改linux-2.4.x/arch/armnommu/kernel/head-armv.S

                         将206行以及439行的S3C44B0X改为S3C44B0 

  •  执行make

 make成功后,uClinux-dist目录里将出现一个images目录。

我编译的是uClinux-dist-20041215.tar.gz
在编译过程中并没有出现错误。


代码:

***********************************************************************
****                                                               ****
****   SkyEye  Simulator Ver 0.9.5 with  GDB/Insight 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) target sim
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x8160154
nic[0] info: state=1, ethmod num=1, mac addr=0:5:3:2:1:f, hostip=192.168.0.99
nic_init_begin
tapif_init begin
tapif_init: fd 6
tapif_init: system("ifconfig tap0 inet 192.168.0.99");
tapif_init end
nic_init_end
SKYEYE: use arm7100 mmu ops
Loaded ROM   ./boot.rom
Connected to the simulator.
(SkyEye) load
Loading section .init, size 0xa000 vma 0x1000000
Loading section .text, size 0xd72e8 vma 0x100a000
Loading section .data, size 0x9b30 vma 0x10e2000
Start address 0x1000000
Transfer rate: 7696576 bits in <1 sec.
(SkyEye) r
Starting program: /root/uClinux/Source/uclinux/uClinux-dist/linux-2.4.x/linux
Linux version 2.4.24-uc0 (root@TEST) (gcc version 2.95.3 20010315 (release)) #11 Fri Jul 1 15:35:29 CST 2005
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: 2952KB available (860K code, 185K 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-15103FF [VIRTUAL 1400000-15103FF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
pktgen.c: v1.3: Packet Generator for packet performance testing.
pktgen: Error: your machine does not have working cycle counter.
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.
BINFMT_FLAT: reloc outside program 0x74790000 (0 - 0x1bb5c/0x6d50), killing init!
BINFMT_FLAT: reloc outside program 0x74790000 (0 - 0x1bb5c/0x6d50), killing init!
BINFMT_FLAT: reloc outside program 0x74790000 (0 - 0x1bb5c/0x6d50), killing init!
BINFMT_FLAT: reloc outside program 0x74790000 (0 - 0x1bb5c/0x6d50), killing init!
BINFMT_FLAT: reloc outside program 0x84340100 (0 - 0x14248/0x10950), killing sh!
BINFMT_FLAT: reloc outside program 0x84340100 (0 - 0x14248/0x10950), killing sh!
Kernel panic: No init found.  Try passing init= option to kernel.


代码:

#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  #romfs.img并没有超过这个size
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
#set nic info state=on/off  mac=xx:xx:xx:xx:xx:xx  ethmod=tuntap/vnet hostip=dd.dd.dd.dd
net: state=on, mac=0:5:3:2:1:f, ethmod=tuntap, hostip=192.168.0.99
我的tool-chain是都是下面这个URL的RPM包

代码:

http://www.uclinux.org/pub/uClinux/arm-tools/RPMS/
arm-elf-binutils-2.12.1-5.i386.rpm  
arm-elf-gcc-2.95.3-5.i386.rpm
arm-elf-gdb-5.2-0.i386.rpm
arm-elf-uClibc-0.9.20-2.i386.rpm


操作系统是FC1 for x86
skyeye的版本是0.9.5
可能是tool-chain中的rpm包又问题
我换了一个tool-chain(arm-elf-tools-20030314.sh)可以正常运行了。。


分享到:
来顶一下
返回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
栏目导航->单片机学习
  • 电子应用基础
  • 电源技术
  • 无线传输技术
  • 信号处理
  • PCB设计
  • EDA技术
  • 单片机学习
  • 电子工具设备
  • 技术文章
  • 精彩拆解欣赏
  • 推荐资讯
    使用普通运放的仪表放大器
    使用普通运放的仪表放
    3V与5V混合系统中逻辑器接口问题
    3V与5V混合系统中逻辑
    数字PID控制及其改进算法的应用
    数字PID控制及其改进
    恶劣环境下的高性价比AD信号处理数据采集系统
    恶劣环境下的高性价比
    栏目更新
    栏目热门