新闻  |   论坛  |   博客  |   在线研讨会
在ARMulator中移植uClinux(2)
tvro_china | 2007-12-21 18:22:36    阅读:1329   发布文章

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.

[root@hyoklinux uClinux-dist]# tar -jxvf ~/incoming/linux-2.6.5.tar.bz2

Now we got the whole linux-2.6.5 codes, and need to patch the kernel.

[root@hyoklinux uClinux-dist]# gzip -dc ~/incoming/linux-2.6.5-hsc2.patch.gz | patch -p0

You should see the codes patched in directories that contain “armnommu” string. You can use the directory >So you don't need the linux-2.6.x directory which is included in the uClinux-dist. :

[root@hyoklinux uClinux-dist]# rm -rf linux-2.6.x/

And we re>

[root@hyoklinux uClinux-dist]# mv linux-2.6.5 linux-2.6.x

Confirm the configuration files

The current uClinux distribution does not contain the proper configuration files for uClinux/ARM 2.6. We need a simple fix-up. The default configuration for ARMulator is at vendors/GDB/ARMulator. We can fix-up the configuration files like this :

[root@hyoklinux uClinux-dist]# cp linux-2.6.x/arch/armnommu/configs/GDB_ARMulator_defconfig vendors/GDB/ARMulator/config.linux-2.6.x

Since we'll use a ramdisk for the rootfs, we need to fix the “rc” in the configuration directory to use ramdisk device number 1.

Edit the vendors/GDB/ARMulator/rc to just like :

[root@hyoklinux uClinux-dist]# vim vendors/GDB/ARMulator/rc

host>/bin/expand /etc/ramfs.img /dev/ram1
mount -t proc proc /proc
mount -t ext2 /dev/ram1 /var
mkdir /var/tmp
mkdir /var/log
mkdir /var/run
mkdir /var/lock
mkdir /var/empty
cat /etc/motd

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
与快乐握手
最近文章
怎样做一块好的PCB板
2009-05-18 17:14:25
ARM入门
2009-05-18 17:10:18
推荐文章
最近访客