[root@hyoklinux uClinux-dist]# ls -al images
total 3036
drwxr-xr-x 2 root root 4096 Apr 27 22:13 .
drwxr-xr-x 17 1000 users 4096 Apr 27 22:13 ..
-rw-r--r-- 1 root root 1540272 Apr 27 22:13 image.bin
-rwxr-xr-x 1 root root 45912 Apr 27 22:13 linux.data
-rwxr-xr-x 1 root root 704856 Apr 27 22:13 linux.text
-rw-r--r-- 1 root root 789504 Apr 27 22:13 romfs.img
[root@hyoklinux uClinux-dist]# ls -al linux-2.6.x/linux
-rwxr-xr-x 2 root root 15499433 Apr 27 22:11 linux-2.6.x/linux
如果你得到了相同的文件,那么你就有了整个内核和rootfs镜像。
12、让我们来使用ARMulator!
安装ARMulator,我们需要另外一个目录来编译GDB/ARMulator。然而这时我们将在uClinux-dist的临时使用的目录里安装它。
[root@hyoklinux uClinux-dist]# tar -jxvf ~/incoming/gdb-5.0.tar.bz2
打上补丁:
[root@hyoklinux uClinux-dist]# gzip -dc ~/incoming/gdb-5.0-uclinux-armulator-20021127.patch.gz | patch -p0
执行另外的一步:
[root@hyoklinux uClinux-dist]# gzip -dc ~/incoming/gdb-5.0-uclinux-armulator-ramdisk-20040412.patch.gz | patch -p0
好,现在所要编译的代码已经准备好了,让我们执行它:
[root@hyoklinux uClinux-dist]# cd gdb-5.0/
[root@hyoklinux gdb-5.0]# ./configure --target=arm-elf
[root@hyoklinux gdb-5.0]# make
[root@hyoklinux gdb-5.0]# make install
现在可以运行ARMulator了!
在运行ARMulator之前,我们需要一个能链接到镜像文件“romfs.img”的标志。
[root@hyoklinux gdb-5.0]# cd ..
[root@hyoklinux uClinux-dist]# ln -s images/romfs.img boot.rom
以及制作一个初始化GDB的脚本:
[root@hyoklinux uClinux-dist]# cat > .gdbinit
target sim
load
^D
通过下面的命令,就可以运行我们的内核了。
[root@hyoklinux uClinux-dist]# arm-elf-gdb linux-2.6.x/linux
GNU gdb 5.0
Copyright 2000 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 GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf"...
Loaded ROM boot.rom to 0x01300000
Loaded ROM boot.rom to 0x01400000
Loaded ROM boot.rom to 0x04000000
Loaded ROM boot.rom to 0x01300000
Loaded ROM boot.rom to 0x01400000
Loaded ROM boot.rom to 0x04000000
Connected to the simulator.
Loading section .init, size 0xb000 vma 0x1000000
Loading section .text, size 0xa0b98 vma 0x100b000
Loading section __ex_table, size 0x5b8 vma 0x10abba0
Loading section .data, size 0x8ef8 vma 0x10ae000
Start address 0x1000000
Transfer rate: 5931584 bits in <1 sec.
(gdb) run
Starting program: /uClinux-dist/linux-2.6.x/linux
Linux version 2.6.5-hsc1 (root@hyoklinux) (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/))
#9 Mon May 3 11:00:29 KST 2004
CPU: Atmel-AT91M40xxx [14000040] revision 0 (ARMvundefined/unknown)
Machine: ATMEL EB01
On node 0 totalpages: 1024
DMA zone: 0 pages, LIFO batch:1
Normal zone: 1024 pages, LIFO batch:1
HighMem zone: 0 pages, LIFO batch:1
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x01300000,800K keepinitrd
PID hash table entries: 32 (order 5: 256 bytes)
Memory: 4MB = 4MB total
Memory: 2448KB available (642K code, 92K data, 44K init)
Calibrating delay loop... 15.87 BogoMIPS
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn’t (ungzip failed); looks like an initrd
POSIX conformance testing by UNIFIX
Linux NoNET1.0 for Linux 2.6
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
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
RAMDISK: romfs filesystem found at block 0
RAMDISK: Loading 771 blocks [1 disk] into ram disk... done.
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 44K
Shell invoked to run file&: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram1
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram1 /var
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
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|
GDB/ARMulator support by <davidm@snapgear.com>
For further information check:
http://www.uclinux.org/
Execution Finished, Exiting
Sash command shell (version 1.1.1)
/> ps
PID PORT STAT SIZE SHARED %CPU COMMAND
1 S 163K 0K 48.0 /sbin/init
2 S 0K 0K 0.0 ksoftirqd/0
3 S 0K 0K 1.0 events/0
4 S 0K 0K 0.0 kblockd/0
5 S 0K 0K 0.0 pdflush
6 S 0K 0K 0.0 pdflush
7 S 0K 0K 0.0 kswapd0
8 S 0K 0K 0.0 aio/0
11 S0 R 165K 0K 0.0 /bin/sh
/> cd bin
/bin> ls -al
drwxr-xr-x 1 0 0 32 Jan 1 00:00 .
drwxr-xr-x 1 0 0 32 Jan 1 00:00 ..
-rwxr-xr-x 1 0 0 105980 Jan 1 00:00 boa
-rwxr-xr-x 1 0 0 91104 Jan 1 00:00 dhcpcd
-rwxr-xr-x 1 0 0 29624 Jan 1 00:00 expand
-rwxr-xr-x 1 0 0 40504 Jan 1 00:00 gdbserver
-rwxr-xr-x 1 0 0 73748 Jan 1 00:00 ifconfig
-rwxr-xr-x 1 0 0 41144 Jan 1 00:00 inetd
-rwxr-xr-x 1 0 0 31176 Jan 1 00:00 init
-rwxr-xr-x 1 0 0 56380 Jan 1 00:00 login
-rwxr-xr-x 1 0 0 64656 Jan 1 00:00 ping
-rwxr-xr-x 1 0 0 34280 Jan 1 00:00 reboot
-rwxr-xr-x 1 0 0 73860 Jan 1 00:00 route
-rwxr-xr-x 1 0 0 79852 Jan 1 00:00 sh
-rwxr-xr-x 1 0 0 51216 Jan 1 00:00 telnetd
/bin> cat /proc/meminfo
MemTotal: 2516 kB
MemFree: 560 kB
Buffers: 900 kB
Cached: 188 kB
SwapCached: 0 kB
Active: 984 kB
Inactive: 44 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 2516 kB
LowFree: 560 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
Mapped: 0 kB
Slab: 752 kB
Committed_AS: 0 kB
PageTables: 0 kB
VmallocTotal: 4194303 kB
VmallocUsed: 0 kB
VmallocChunk: 4194303 kB
/bin>
不错的**,值得读一下,翻译时来来回回读了好几遍,每次都有不同的收获,感觉不错
由于时间仓促,未能测试,请大家和我关注这个贴子,使它能更准确、更完善!
PIII550/384M/60G+40G/TNT2/8139/Fedora1.0
LFS5.0+BLFS1.0ing……
|