QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5679|回复: 14

请教高手,有关与UClinux 编译问题

[复制链接]
发表于 2005-6-26 13:11:27 | 显示全部楼层 |阅读模式
1.我用的是:uClinux-dist-20040408.tar.gz与arm-elf-tools-20030314.sh
以下是我的编译uClinux 过程:

3. 执行脚本即可完成交叉编译器的安装
./arm-elf-tools-20030314.sh

4. 测试一下,输入 arm-elf-gcc 看看是否能够自动补齐?
[admin@localhost admin]$ arm-elf-gcc -v
Reading specs from /usr/local/lib/gcc-lib/arm-elf/2.95.3/specs
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/)

[admin@localhost admin]$ which arm-elf-gcc
/usr/local/bin/arm-elf-gcc

表明 arm-elf-gcc 已经安装在 /usr/local/bin/ 目录下了。


Step 1 : 交叉编译 uClinux 内核
1. 下载 uClinux-dist-20040408.tar.gz 到当前工作目录下

2. 解压 uClinux-dist-20040408.tar.gz 文件到 uClinux-dist 目录
tar xvzf uClinux-dist-20040408.tar.gz
此时当前工作目录下增加了一个名为 uClinux-dist 的目录。

3. 进入 uClinux-dist 目录
cd uClinux-dist

4. 修改 vmlinux-armv.lds.in 文件,
vi linux-2.4.x/arch/armnommu/vmlinux-armv.lds.in

*(got) /* Global Offset table */
之后添加如下语句:
romfs_data = .;
romfs.o
romfs_data_end = .;
即修改为:
65 *(.got) /* Global offset table */
66
68 romfs_data = .;
69 romfs.o
70 romfs_data_end = .;

5. 修改 vendors/Samsung/4510B/Makefile 文件,
vi vendors/Samsung/4510B/Makefile
在 image 目标的第三行,增加一条语句:
arm-elf-ld -r -o $(ROOTDIR)/$(LINUXDIR)/romfs.o -b binary $(ROMFSIMG)
如下为增加之后:
63 image:
64 [ -d $(IMAGEDIR) ] || mkdir -p $(IMAGEDIR)
65 genromfs -v -V "ROMdisk" -f $(ROMFSIMG) -d $(ROMFSDIR)
66 arm-elf-ld -r -o $(ROOTDIR)/$(LINUXDIR)/romfs.o -b binary $(ROMFSIMG)
67 $(CROSS_COMPILE)objcopy -O binary --remove-section=.romvec \
68 --remove-section=.text --remove-section=.ramvec \
69 --remove-section=.init \
70 --remove-section=.bss --remove-section=.eram \
71 $(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.data

6. make menuconfig
在 Vendor/Product Selection ---> 中选择
--- Select the Vendor you wish to target
(Samsung) Vendor
--- Select the Product you wish to target
(4510B) Samsung Products

在 Kernel/Library/Defaults Selection ---> 中选择
(linux-2.4.x) Kernel Version
(uClibc) Libc Version

其他选项都不变,按照缺省设置,选择退出,保存配置。

7. make dep

8. make lib_only

9. make user_only
[说明] 编译login,boa程序时可能出现 undefined reference to 'crypt_old'的错误,
boa.elf2flt: In function `auth_check_userpass':
/tmp/liming/uClinux-dist/user/boa/src/auth.c:281: undefined reference to `crypt_old'
可以修改
config/.config
注释掉第25行的 CONFIG_USER_OLD_PASSWORDS
如下:
24 CONFIG_USER_LOGIN_LOGIN=y
25 # CONFIG_USER_OLD_PASSWORDS=y
26 # CONFIG_USER_ONLY_ROOT is not set
然后再
cd user/boa/src/
rm *.o
重新编译 make user_only 一下这个目录里面的 obj 文件就可以了。

10. make romfs

11. make
.............

最终会出现以下问题,小弟实在搞不定拉,请教大虾指点

entry-armv.S: Assembler messages:
entry-armv.S:1283: Error: Internal_relocation (type 187) not fixed up (OFFSET_IMM)
entry-armv.S:1285: Error: Internal_relocation (type 185) not fixed up (IMMEDIATE)
entry-armv.S:1336: Error: Internal_relocation (type 187) not fixed up (OFFSET_IMM)
entry-armv.S:1337: Error: Internal_relocation (type 187) not fixed up (OFFSET_IMM)
entry-armv.S:1608: Error: Can not represent SWI relocation in this object file format (0)
make[2]: *** [entry-armv.o] Error 1
make[2]: Leaving directory `/usr/lizhaohui_App/linux_demo/uClinux-dist/linux-2.4.x/arch/armnommu/kernel'
make[1]: *** [_dir_arch/armnommu/kernel] Error 2
make[1]: Leaving directory `/usr/lizhaohui_App/linux_demo/uClinux-dist/linux-2.4.x'
make: *** [linux] Error 1
发表于 2005-6-26 13:18:43 | 显示全部楼层
我是昨天刚在RedHat9.0下,按这个步骤进行编译的,最后成功了,没出问题呀
回复

使用道具 举报

 楼主| 发表于 2005-6-26 15:46:12 | 显示全部楼层
大虾啊,我的linux RedHat9.0,是装载虚拟机VM下的哦!!你们有谁在虚拟机VM下编译uClinux成功经验啊!!
回复

使用道具 举报

发表于 2005-6-27 10:50:11 | 显示全部楼层
这种问题我以前似乎碰到过,同样的步骤在两台不同的机子上一个成功了,一个就死活出不来。
建议你换一台机器试试看,其他也没什么好办法了  :-(
回复

使用道具 举报

发表于 2005-6-27 11:25:44 | 显示全部楼层
我昨天也成功完成。

winxp+VMWARE work station 5+redhat(标注是13),具体内核版本2。4。X的,下载了uclinux的开发软件之后依照lumit提供的文档进行处理,一切OK。

在配置vmware中linux网络的时候倒是出了一些问题,对vmware的网络模式混淆了好长一段时间。现在终于可以从wimxp上telnet和ftp到vm的linux。

注意,在step2的时候是否需要考虑先打一个patch,lumit的教程中谈到了这点,同时我在做的时候也是打上patch之后再继续的。
回复

使用道具 举报

发表于 2005-7-4 10:14:02 | 显示全部楼层
升级GCC试下啦!
回复

使用道具 举报

 楼主| 发表于 2005-7-4 13:37:10 | 显示全部楼层
我下载了最新的Uclinux :uClinux-dist-20041215.tar.gz 去编译哦,可以OK拉,
多谢大虾指点啊,但uClinux-dist-20040408.tar.gz在我的VM下死活不行哦
回复

使用道具 举报

发表于 2005-7-4 17:58:49 | 显示全部楼层
有些问题总是莫名其妙,不用深究习惯了就好。。。
回复

使用道具 举报

发表于 2005-8-27 19:40:15 | 显示全部楼层
一定要vmware吗?我是新装的redhat 9.0,前面和楼顶上的情况一样,最后的错误:
arm-elf-objcopy:/home/sxwglxq/uClinux-dist/linux-2.4.x/linux???
make[1]:***[image] Error 1
make[1]: Leaving directory /home/sxwglxq/uClinux-dist/vendors/Samsung/4510B'
make:***[image] Error 2
不知道怎么搞得?搞了一个下午,我觉得pdf里说的构详细了,怎么会有问题?
高手帮看看阿
回复

使用道具 举报

发表于 2005-9-11 17:49:45 | 显示全部楼层
我用的就是vmware,make的错误和sxwqlxq一样?
请指教
回复

使用道具 举报

发表于 2005-9-13 10:33:33 | 显示全部楼层
是不是编译环境一定要在redhat下,才可以我在fc3下编译几次都没有成功.
回复

使用道具 举报

发表于 2005-9-15 13:50:20 | 显示全部楼层
我的问题更奇怪, make menuconfig就没反应,以下是具体情况:

[root@localhost uClinux-dist]# make menuconfig
config/mkconfig > config.in
make -C /home/rock/lumit/uclinux/uClinux-dist/config/scripts/lxdialog all
make[1]: Entering directory `/home/rock/lumit/uclinux/uClinux-dist/config/scripts/lxdialog'
/bin/sh: line 1: cc: command not found

>> Unable to find the Ncurses libraries.
>>
>> You must have Ncurses installed in order
>> to use 'make menuconfig'

make[1]: *** [ncurses] Error 1
make[1]: Leaving directory `/home/rock/lumit/uclinux/uClinux-dist/config/scripts/lxdialog'
make: *** [menuconfig] Error 2
[root@localhost uClinux-dist]#
哪位高手能指导一下啊
回复

使用道具 举报

发表于 2005-9-25 09:57:46 | 显示全部楼层
楼上的,你的问题不是很清楚吗?你机器上没有安装ncurses包,你安上了就能使用了,不过你现在也可以用make config
回复

使用道具 举报

发表于 2005-9-27 14:43:52 | 显示全部楼层
arm-elf-objcopy:/home/sxwglxq/uClinux-dist/linux-2.4.x/linux???
make[1]:***[image] Error 1
make[1]: Leaving directory /home/sxwglxq/uClinux-dist/vendors/Samsung/4510B'
make:***[image] Error 2

上面的错误是编译的时候没有生成linux的kernel,你可以把原来的head.S覆盖一下,然后重新编译两次试一下,我当时就是这么干的!!我觉得好像是在make clean的时候搞的鬼!!
回复

使用道具 举报

发表于 2005-10-16 22:53:01 | 显示全部楼层
除了www.uClinux.org可以下载到uClinux-dist-20040408.tar.gz与arm-elf-tools-20030314.sh 之外,哪里还可以下载到?为何www.uClinux.org网站经常打不开?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-27 23:22 , Processed in 0.086428 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表