一年前在没有开发板的情况下,skyeye帮助我了解了linux。当时写了一些笔记,现在转到这里来。当时尝试全部用E文下,不管写得多烂啦。
----------------------
最近有空把skyeye那本书拿来翻翻,一时兴起想玩玩linux。于是就去下vmware安装装FC4。
在FC4下安装skyeye的最新版本,下载安装uClinux_gnutools,下载uClinux源码并用编译,编译完用挂上gdb远程调试一下,可以调试内核了啊,哈。
怕以后自己忘了将整个过程写下来发到skyeye社区上。
原文:debug uClinux with gdb
first we need:
--install uClinux_gnutools(I use arm-elf-tools-20011219.tar.gz)
--build uclinux(I use uClinux-dist-20030522.tar.gz)
--creat new link for linux:
# ln -s uClinux-dist/linux-2.4.x/linux linux
--build skyeye(I use skyeye-1.2.5_REL.tar.gz)
if you don't how to do these see https://www.ibm.com/developerworks/cn/linux/l-skyeye/part2/
next:
--run uClinux in skyeye with debug option:
[root@localhost uClinux-dist]# arm-elf-skyeye -d -e linux
Your elf file is little endian.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x805cb28
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM images/romfs.img
exec file "linux"'s format is elf32-little.
load section .init: addr = 0x01000000 size = 0x0000a000.
load section .text: addr = 0x0100a000 size = 0x000c5c10.
load section .data: addr = 0x010d0000 size = 0x00008320.
not load section .bss: addr = 0x010d8320 size = 0x00022198 .
not load section .debug_abbrev: addr = 0x00000000 size = 0x00039846 .
not load section .debug_info: addr = 0x00000000 size = 0x016b6881 .
not load section .debug_line: addr = 0x00000000 size = 0x002a8b67 .
not load section .debug_pubnames: addr = 0x00000000 size = 0x0000b40d .
not load section .debug_aranges: addr = 0x00000000 size = 0x000022e0 .
call ARMul_InitSymTable,kernel filename is linux.
start addr is set to 0x01000000 by exec file.
debugmode= 1, filename = skyeye.conf, server TCP port is 12345 //stop here wait gdb host conecte
Remote debugging using host:12345 //this show gdb has conected
--open other consle in your computer, go your uClinux dir
[root@localhost uClinux-dist]# arm-elf-gdb 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"...
(gdb) target remote 127.0.0.1:12345 //conecte target
Remote debugging using 127.0.0.1:12345
0x1000000 in stext () at af_packet.c:1891
1891 sock_unregister(PF_PACKET);
(gdb) break start_kernel //set breakpoint at start_kernel()
Breakpoint 1 at 0x100055c: file init/main.c, line 362.
(gdb) continue
Continuing.
Breakpoint 1, start_kernel () at init/main.c:362 //now program stop at start_kernel
362 printk(linux_banner);
(gdb) list
357
361