登录 免费注册 首页 | 行业黑名单 | 帮助
维库电子市场网
技术交流 | 电路欣赏 | 工控天地 | 数字广电 | 通信技术 | 电源技术 | 测控之家 | EMC技术 | ARM技术 | EDA技术 | PCB技术 | 嵌入式系统
驱动编程 | 集成电路 | 器件替换 | 模拟技术 | 新手园地 | 单 片 机 | DSP技术 | MCU技术 | IC 设计 | IC 产业 | CAN-bus/DeviceNe

Getting Familiar with uClinux/ARM 2.6

作者:广州老赵 栏目:驱动编程
Getting Familiar with uClinux/ARM 2.6
http://opensrc.sec.samsung.com/Getting_Familiar_with_uClinuxARM2_6.html
-----------------------------------------------------------------
Getting Familiar with uClinux/ARM 2.6
by Hyok S. Choi <hyok.choi@samsung.com>
the author and maintainer of uClinux/ARM2.6

Why uClinux/ARM 2.6?
Why would you want to use uClinux? There could be many reasons to consider the uClinux for your embedded OS. Some of them could be as following:

Lightweight
You can make a complete linux 2.6 preemptible kernel image including console and some basic DEVICE drivers and ROMFS under 300KB! (zImage) and the applications in flat-binary format are approximately 30~50% lighter than typical conventional linux ELF binaries, thanks to lighter STANDARD C and C++ libraries.

XIP
With much smaller RAM, you can execute your kernel and even the applications by XIP(eXecution In Place). It could help you to boot up FASTer, although the access time for the FLASH or rom for boot image should be FAST enough and/or enough cache size. (There could be a trade-off between those values if we want to find the optimal balance.)

Cheaper
It is known that the MMU core size in typical ARM SoC wafer is about 30%. In typical network or embedded SYSTEMs more than a half of applications do not need the MMU. Many of RTOS do not use MMU in default, even if target CPU has one.

Full Linux API
You can use the full Linux APIs on your uClinux platform with few exceptions. You can use the pThread in uClibc and the STANDARD SYSTEM calls. There are plenty of applications which are ported to uClinux in the userland in uClinux distribution PACKAGE.

Easier to ADAPT
One of the interesting natures of uClinux is the possibility of user application accessing the whole SYSTEM, including registers in DEVICEs. With a bit of wrapper, we can make the firmware code run on uClinux as a plain application! Of course, you can add some DEVICE driver and call the linux SYSTEM calls and use many open Ips in mixed with the old firmware code. If you're planning to migrate your firmware codes to Linux, but you're not familiar with Linux SYSTEM PROGRAMMING, uClinux could be a GOOD starting point. ;-)

Full Linux 2.6 kernel features
Although, it is lighter, it supports almost full features of conventional linux 2.6 kernel, including preemptible kernel feature and so many file-SYSTEMs, DEVICE drivers. Porting of DEVICE drivers for conventional Linux is handy. Almost all codes should be compiled without change, except MEMORY mapping from virtual address to physical.

The First Compile Guide
If you decided to set up an uClinux development environment, this is the list that you have to grab on your linux host:

uClinux distribution
The easiest way to get started with uClinux is to play with a copy of uClinux-dist from the uClinux.org site at:
http://www.uclinux.org/pub/uClinux/dist/
Note that the kernel version in the distribution may not be the latest. You'll be able to gather the latest PATCH set and the vanilla Linux kernel from the kernel.org to make a latest copy of uClinux kernel.
At this time (20040427), the latest distribution is “http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20040408.tar.gz”. If you have some strange trouble with compilation, even after following this guide, simply use this distribution for your testing, and update later. :-)

the Kernel and PATCH
You could find the latest uClinux/ARM kernel PATCH at:
http://opensrc.sec.samsung.com/
At the download section, you'll find the LINK of latest “linux-2.6.x-hscx.PATCH.gz” and the original kernel PACKAGE like:
http://opensrc.sec.samsung.com/download/linux-2.6.5-hsc2.PATCH.gz
and
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.5.tar.bz2

ARM-ELF toolchain
Since the Linux 2.6 kernel code uses some of the new features from newer binutils, you need a newer ARM-ELF toolchain for kernel compilation than the one of uclinux.org. You could find the latest toolchain at the same place with the kernel and PATCH download section above, and the direct url at current time is :
http://opensrc.sec.samsung.com/download/arm-elf-tools-20040427.sh

HARDWARE Platform or an ARMulator
Of course, you need a platform to run the kernel on. Please REFER the notice section which platform is supported. Even if you can not find the one that you have, or if you don't have any HARDWARE platform, you can run a complete kernel on your Linux PC! : the ARMulator.
The ARMulator is a GDB based EMULATOR which emulates full ATMEL AT91x, arm7tdmi EB01. The url of ARMulator home is :
http://www.uclinux.org/pub/uClinux/utilities/armulator/
You can download directly at this urls:
http://www.uclinux.org/pub/uClinux/utilities/armulator/gdb-5.0.tar.bz2 (the original gdb-5.0 archive)
http://www.uclinux.org/pub/uClinux/utilities/armulator/gdb-5.0-uclinux-armulator-20021127.PATCH.gz (Patches against gdb-5.0)

And another PATCH if you want to run the kernel with ramdisk on the ARMulator :
http://opensrc.sec.samsung.com/download/gdb-5.0-uclinux-armulator-ramdisk-20040412.PATCH.gz

That's all for your first compilation.

Okay, here we go step by step.
(This guide is assuming that the downloaded files are located at ~/incoming and the ARMulator is used for platform to run on.)

INSTALL the toolchain

su to log in as the root then execute the arm-elf-tools-20040427.sh like:

[root@hyoklinux /]# /bin/sh ~/incoming/arm-elf-tools-20040427.sh

You should see the list of files that is INSTALLed. The toolchain binaries for execution are INSTALLed to /usr/local/bin. So you need the directory to be included in your search path, usually it is default for common Linux distribution like Redhat.

Untar the uClinux distribution

On a directory which has enough free available space(about 2GB?), untar the uclinux distribution :
[root@hyoklinux /]# tar -zxvf ~/incoming/uClinux-dist-20040408.tar.gz

Let's look around what we have on the uClinux-dist directory:

[root@hyoklinux /]# cd uClinux-dist/

[root@hyoklinux uClinux-dist]# ls -al

total 104
drwxr-xr-x 15 1000 users 4096 Apr 8 09:27 .
drwxr-xr-x 28 root root 4096 Apr 27 20:32 ..
-rw-r--r-- 1 1000 users 18007 Apr 8 09:13 COPYING
drwxr-xr-x 3 1000 users 4096 Apr 8 09:13 Documentation
-rw-r--r-- 1 1000 users 9305 Apr 8 09:13 Makefile
-rw-r--r-- 1 1000 users 4934 Apr 8 09:13 README
-rw-r--r-- 1 1000 users 1743 Apr 8 09:13 SOURCE
drwxr-xr-x 2 1000 users 4096 Apr 15 15:19 bin
drwxr-xr-x 3 1000 users 4096 Apr 8 09:27 config <-- the configuration files for userland and etc.
drwxr-xr-x 11 1000 users 4096 Apr 8 09:27 freeswan <-- IPsec implementation
drwxr-xr-x 68 1000 users 4096 Apr 8 09:23 glibc <-- Yes, the GNU C library.
drwxr-xr-x 18 1000 users 4096 Apr 8 09:28 lib <-- many libraries ported to uClinux include uC-libc.
drwxr-xr-x 15 1000 users 4096 Apr 8 09:27 linux-2.0.x <-- uClinux 2.0.x kernel
drwxr-xr-x 16 1000 users 4096 Apr 8 09:27 linux-2.4.x <-- uClinux 2.4.x kernel
drwxr-xr-x 18 1000 users 4096 Apr 8 09:27 linux-2.6.x <-- uClinux 2.6.x kernel
drwxr-xr-x 3 1000 users 4096 Apr 8 09:26 tools <-- utilities for romfs INSTALL and etc.
drwxr-xr-x 17 1000 users 4096 Apr 8 09:27 uClibc <-- the uClibc, from uclibc.org. Differ to uC-libc.
drwxr-xr-x 174 1000 users 4096 Apr 8 09:27 user <-- the “userland”. The applications that is ported.
drwxr-xr-x 44 1000 users 4096 Apr 8 09:27 vendors <-- the configuration files for each vendor/models.

Make a new linux-2.6.x kernel from the scratch

The kernel version of linux-2.6.x directory in the 20040408 distribution is “linux-2.6.2-uc0”. We need another kernel with newer kernel version for uClinux/ARM 2.6, here.

[ro
2楼: >>参与讨论
宇宙飞船
楼主可否把文章内这段话用最好的译文质量译成中文呢!谢谢!
XIP
With much smaller RAM, you can execute your kernel and even the applications by XIP(eXecution In Place). It could help you to boot up FASTer, although the access time for the FLASH or rom for boot image should be FAST enough and/or enough cache size. (There could be a trade-off between those values if we want to find the optimal balance.)



3楼: >>参与讨论
广州老赵
翻译就看: 转贴,陈渝大侠翻译的 uClinux2.6入门
我的英文太差了,就不要为难我了.没考过4级(中专没有4级的考).

4楼: >>参与讨论
宇宙飞船
谢谢您!
 
参与讨论
昵称:
讨论内容:
 
 
相关帖子
uClinux在44B0上怎么实现多任务或多进程呀!谢了!
急死了,和领导意见有冲突 ,我该怎么办…   请大家帮帮忙
uClinux在44B0上加载失败,高手看看怎么回事
请各位老师帮忙了!关于uclinux调试!
是不是在LINUX下的应用程序都应该公开源程序呢?
免费注册为维库电子开发网会员,参与电子工程师社区讨论,点此进入


Copyright © 1998-2006 www.dzsc.com 浙ICP证030469号