这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » 在S3C4510B上运行uClinux-2.6的过程(romfs直接链入imag

共13条 1/2 1 2 跳转至

在S3C4510B上运行uClinux-2.6的过程(romfs直接链入image.ram)

菜鸟
2005-08-20 00:19:07     打赏

在S3C4510B上运行uClinux-2.6的过程(romfs直接链入image.ram)

假设工作目录为/root

step 1 将下面4个文件下载到/root目录中
http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20041215.tar.gz
http://opensrc.sec.samsung.com/download/arm-uclinux-tools-base-gcc3.4.0-20040713.sh
http://opensrc.sec.samsung.com/download/linux-2.6.9-hsc0.patch.gz
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.9.tar.bz2

step 2 安装arm-uclinux编译器
执行 sh arm-uclinux-tools-base-gcc3.4.0-20040713.sh
修改 /root/.bash_profile,修改环境变量PATH
PATH=$PATH:$HOME/bin:$HOME/arm-uclinux-tool/bin
可以测试一下arm-uclinux-gcc -v,应该可以其版本信息

step 3 释放内核源代码
依次执行如下命令
tar -zxvf uClinux-dist-20041215.tar.gz
cd uClinux-dist
tar -jxvf ../linux-2.6.9.tar.bz2
gzip -dc ../linux-2.6.9-hsc0.patch.gz | patch -p0
rm -rf linux-2.6.x
mv linux-2.6.9 linux-2.6.x
cp linux-2.6.x/arch/armnommu/configs/espd_4510b_defconfig vendor/Samsung/4510B/config.linux-2.6.x (kernel配置)
cp vendor/Samsung/4510B/config.vendor-2.4.x vendor/Samsung/4510B/config.vendor-2.6.x (vendor配置,保持与2.4一致即可)

step 4 修改内核
修改vendor/Samsung/4510B/Makefile,添加如下内容
63 image:
64 [ -d $(IMAGEDIR) ] || mkdir -p $(IMAGEDIR)
65 genromfs -v -V "ROMdisk" -f $(ROMFSIMG) -d $(ROMFSDIR)
66 arm-uclinux-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

修改vendor/Samsung/4510B/rc,将最后一行的dhcpcd屏蔽掉
11 cat /etc/motd
12 ifconfig lo 127.0.0.1
13 route add -net 127.0.0.0 netmask 255.255.255.0 lo
14 #dhcpcd &

修改vendor/config/armnommu/config.arch, 将arm-elf改为arm-uclinux
40 MACHINE = arm
41 ARCH = armnommu
42 CROSS_COMPILE = arm-uclinux-
43 CROSS = $(CROSS_COMPILE)

修改linux-2.6.x/arch/armnommu/arch/kernel/vmlinux-lds, 添加romfs.o
78 *(.got) /* Global offset table */
79
80 romfs_start = .;
81 romfs.o
82 romfs_end = .;

修改linux-2.6.x/arch/armnommu/kernel/setup.c,添加变量romfs_start,romfs_end及设置default_command_line
64 extern int _stext, _text, _etext, _edata, _end;
65 extern int romfs_start,romfs_end;

682 char *from = default_command_line;
683 sprintf(default_command_line, "root=/dev/ram0 initrd=0x%08lx,%ldk keepinitrd", (unsigned

long)&romfs_start,((unsigned long)&romfs_end - (unsigned long)&romfs_start)>>10);

step 5 配置内核

执行make menconfig,以下全选上,然后保存退出,其余具体各项配置暂不更改
(linux-2.6.x) Kernel Version
(uClibc) Libc Version
[*] Default all settings (lose changes) (NEW)
[*] Customize Kernel Settings (NEW)
[*] Customize Vendor/User Settings (NEW)
[*] Update Default Vendor Settings (NEW)
第一次配置退出可能还会要求选择板类型,直接按数字选espd_4510b即可

step 6 编译
执行 make
执行完后images目录中会有image.ram文件,利用bootloader将其加载到0x8000地址处执行,接上串口就能看到如下信息了

Linux version 2.6.9-hsc0 (root@localhost.localdomain) (gcc version 3.4
.3) #24 Thu Jun 30 00:04:47 EDT 2005
CPU: Samsung-S3C4510B [36807001] revision 1 (ARMv4T)
Machine: ESPD 4510B(S3C4510B)
Warning: bad configuration page, trying to continue
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x0011d000,884k keepinitrd
PID hash table entries: 128 (order: 7, 2048 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 16MB = 16MB total
Memory: 14080KB available (1936K code, 122K data, 56K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
NET: Registered protocol family 16
ttyS0 at I/O 0x3ffd000 (irq = 4) is a Samsung S3C4510B Internal UART
ttyS1 at I/O 0x3ffe000 (irq = 6) is a Samsung S3C4510B Internal UART
RAMDISK driver initialized: 16 RAM disks of 1024K size 1024 blocksize
loop: loaded (max 8 devices)
Samsung S3C4510B Ethernet Driver version 0.2 (2004-06-13) <curt@cucy.com>
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 1024 bind 2048)
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: romfs filesystem found at block 0
RAMDISK: Loading 881KiB [1 disk] into ram disk... done.
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 56K
Shell invoked to run file: /etc/rc
Command: hostname Samsung
Command: /bin/expand /etc/ramfs.img /dev/ram1
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram1 /var
Command: mkdir /var/config
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
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|

For further information check:
http://www.uclinux.org/

Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/>

[dvnews_page]




关键词: S3C4510B     运行     uClinux-2.6         

菜鸟
2005-08-21 22:32:00     打赏
2楼

step4中修改的应该是

linux-2.6.x/arch/armnommu/kernel/vmlinux.lds.s文件才对吧?

而且按照楼主的说明,在执行make lib_only的时候发生错误,/root/uClinux-dist/uClibc/libc/sysdeps/linuex/common中的文件create_module.c发生错误,没有声明__NR__create_module,所以停止编译。麻烦楼主看看吧。


菜鸟
2005-08-25 17:38:00     打赏
3楼

2.6不需要make lib_only


菜鸟
2005-09-03 00:45:00     打赏
4楼
根据楼主的步骤编译时,在make时出错,说是找不到romfs_start= ,不知道这是怎么回事?
LD vmlinux
/root/bin/arm-uclinux-tool/bin/arm-uclinux-ld.real: cannot find romfs_start=


菜鸟
2005-09-19 19:40:00     打赏
5楼
根据楼住得方法,出现下面得错误,能帮忙看看吗?
/usr/local/bin/arm-uclinux-ld.real: cannot find romfs.o


菜鸟
2005-09-19 22:25:00     打赏
6楼
原来是编译器出错,问题解决,换了最新得编译器就好了,
但是不知道怎么生成象2.4内核一样得image.rom,好刷进flash
只生成了
linux.data
linux.text
romfs.img
image.bin
四个文件,哪个是直接烧进flash,(不用bootloader得哦,)可以用得阿?

菜鸟
2005-11-04 12:26:00     打赏
7楼
换了最新哪个编译器? Please.

菜鸟
2005-12-03 00:48:00     打赏
8楼

根据楼住得方法,出现下面得错误,能帮忙看看吗?
/usr/local/bin/arm-uclinux-ld.real: cannot find romfs.o

我也出现这个问题

求助!急


菜鸟
2005-12-03 00:49:00     打赏
9楼
用的就是上面的编译器

菜鸟
2005-12-17 23:10:00     打赏
10楼
我也出现了5楼的问题!

共13条 1/2 1 2 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]