在uClinux性能里有一个有趣的特性,是应用程序可以访问整个系统,包括设备里的寄存器,with a bit of wrapper ,我们能制作固件代码做为无格式的应用程序运行在 uClinux上!当然,你能加一些设备驱动和系统调用来调用以及使用许多打开的Ips在混和的旧的固件代码里。如果你计划移动你的固件代码到linux,但你没有熟悉的linux系统程序,uClinux是一个很好的出发点。
[root@hyoklinux uClinux-dist]# make menuconfig 首先在“Main Menu”找到“Vendor/Product”所在行,选择“GDB/ARMulator”,像这样: --- Select the Vendor you wish to target (GDB) Vendor --- Select the Product you wish to target (ARMulator) GDB Products 你可以按’esc’键或是“Exit”按钮返回主菜单。
通过下面的命令,就可以运行我们的内核了。 [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>