在skyeye上用insmod 加载模块失败
// hello.c#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSK/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "hello,world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye,cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
经编译后,生成hello.ko文件。
# skyeye.conf
cpu: pxa25x
mach: pxa_lubbock
mem_bank: map=I, type=RW, addr=0x40000000, size=0x0c000000
mem_bank: map=M, type=RW, addr=0xc0000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0xc0800000, size=0x01000000, file=./initrd_minigui.img
mem_bank: map=M, type=RW, addr=0xc1000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0xc1800000, size=0x02800000
#mem_bank: map=M, type=RW, addr=0xd0000000, size=0x00100000
#lcd:state=on,type=pxa,mod=gtk
#dbct:state=on
运行
skyeye -e vmlinux
其中vmlinux是linux-2.6.12内核。
skyeye运行起来后,运行
insmod ./hello.ko
结果出错。请问这是什么原因呢?
------------------------- SkyEye -V1.2 ---------------------------
Usage: SkyEye program
Default mode is STANDALONE mode
------------------------------------------------------------------
Options:
-e exec-file the (ELF executable format)kernel file name.
-d in GDB Server mode (can be connected by GDB).
-c config-file the skyeye configure file name.
-h This Help Display
-v This shows arch and cpu supported
------------------------------------------------------------------
arch: arm
cpu info: xscale, pxa25x, 69052100, fffffff0, 2
mach info: name pxa_lubbock, mach_init addr 0x8078c14
SKYEYE: use xscale mmu ops
debugmode= 0, filename = (null), server TCP port is 12345
Loaded RAM ./initrd_minigui.img
exec file "vmlinux"'s format is elf32-little.
load section .init: addr = 0xc0008000size = 0x00012000.
load section .text: addr = 0xc001a000size = 0x00112f20.
load section __ex_table: addr = 0xc012cf20size = 0x000008a0.
not load section .pci_fixup: addr = 0xc012d7c0size = 0x00000000 .
load section __ksymtab: addr = 0xc012d7c0size = 0x000027a0.
load section __ksymtab_gpl: addr = 0xc012ff60size = 0x00000530.
not load section __kcrctab: addr = 0xc0130490size = 0x00000000 .
not load section __kcrctab_gpl: addr = 0xc0130490size = 0x00000000 .
load section __ksymtab_strings: addr = 0xc0130490size = 0x000061e0.
load section __param: addr = 0xc0136670size = 0x00000168.
load section .data: addr = 0xc0138000size = 0x0002c840.
not load section .bss: addr = 0xc0164840size = 0x0000ff6c .
not load section .comment: addr = 0x00000000size = 0x00001758 .
not load section .debug_abbrev: addr = 0x00000000size = 0x00053b21 .
not load section .debug_info: addr = 0x00000000size = 0x00b67736 .
not load section .debug_line: addr = 0x00000000size = 0x000a9497 .
not load section .debug_pubnames: addr = 0x00000000size = 0x0000f6b8 .
not load section .debug_str: addr = 0x00000000size = 0x00044b63 .
not load section .debug_aranges: addr = 0x00000000size = 0x000034e8 .
not load section .debug_frame: addr = 0x00000000size = 0x0003dd24 .
not load section .debug_ranges: addr = 0x00000000size = 0x00007528 .
start addr is set to 0xc0008000 by exec file.
`Linux version 2.6.12 ([email protected]) (gcc version 3.3.6) #8 Sat Feb 4 12:10:23 HKT 2006
CPU: XScale-PXA250 revision 0 (ARMv5TE)
CPU0: D VIVT undefined 5 cache
CPU0: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
CPU0: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
Machine: Intel DBPXA250 Development Platform (aka Lubbock)
Memory policy: ECC disabled, Data cache writeback
Memory clock: 99.53MHz (*27)
Run Mode clock: 99.53MHz (*1)
Turbo Mode clock: 99.53MHz (*1.0, inactive)
Built 1 zonelists
Kernel command line: root=/dev/ram0 console=ttyS0 initrd=0xc0800000,0x01000000 rw mem=64M
PID hash table entries: 512 (order: 9, 8192 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 64MB = 64MB total
Memory: 46976KB available (1137K code, 241K data, 72K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd
Freeing initrd memory: 16384K
Linux NoNET1.0 for Linux 2.6
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (C) 2001-2003 Red Hat, Inc.
ttyS0 at MMIO 0x40100000 (irq = 15) is a FFUART
ttyS1 at MMIO 0x40200000 (irq = 14) is a BTUART
ttyS2 at MMIO 0x40700000 (irq = 13) is a STUART
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
Lubbock configured to boot from ROM (bank 0)
Probing Lubbock Boot ROM at physical address 0x00000000 (32-bit bankwidth)
Probing Lubbock Application Flash at physical address 0x04000000 (32-bit bankwidth)
mice: PS/2 mouse device common for all mice
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 16384KiB into ram disk... done.
VFS: Mounted root (ext2 filesystem).
Freeing init memory: 72K
```cat: /etc/motd: No such file or directory
cat: /etc/version: No such file or directory
`
Give root password for system maintenance
(or type Control-D for normal startup):
sulogin: Normal startup
`
Please press Enter to activate this console.
BusyBox v1.00 (2006.02.01-04:13+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
/ # insmod ./hello.ko
Unable to handle kernel paging request at virtual address bf000000
pgd = c3004000
*pgd=00000000
Internal error: Oops: 807 [#1]
Modules linked in:
CPU: 0
PC is at __memzero+0x24/0x80
LR is at __init_begin+0x3fff8000/0x2c
pc : [<c00ccb64>] lr : [<00000000>] Not tainted
sp : c38c9efcip : 00000000fp : c38c9f80
r10: 00000019r9 : c4861c24r8 : c4851000
r7 : c4861d04r6 : c48510dcr5 : 000167a5r4 : 00000000
r3 : 00000000r2 : 00000000r1 : 0000042cr0 : bf000000
Flags: nzCvIRQs onFIQs onMode SVC_32Segment user
Control: 3907Table: C3004000DAC: 00000015
Process insmod (pid: 662, stack limit = 0xc38c8194)
Stack: (0xc38c9efc to 0xc38ca000)
9ee0: c004c6b4
9f00: c0014298 00000000 c022d6c0 c1753580 00000060 00000018 c38c8000 bf000000
9f20: 00000000 00000000 00000000 00000000 00000003 00000000 00000006 00000000
9f40: 00000000 00000000 00000018 00000017 c4867714 000e62e8 c38c8000 00000000
9f60: bf000000 00000000 c013d448 c38c8000 00000002 c38c9fa4 c38c9f84 c004cbd8
9f80: c004c1b4 00000003 00000000 00000100 00000080 c001ade4 00000000 c38c9fa8
9fa0: c001ac60 c004cb60 00000000 00000100 00900080 40000000 000167a5 000e62e8
9fc0: 00000003 00000000 00000100 bef9ced4 bef9cf91 000081cc 00000002 00000000
9fe0: bef9cc48 bef9cc3c 000219cc 00077690 00000010 00900080 e51b2030 e1a03005
Backtrace:
[<c004c1a8>] (load_module+0x0/0x974) from [<c004cbd8>] (sys_init_module+0x84/0x2dc)
[<c004cb54>] (sys_init_module+0x0/0x2dc) from [<c001ac60>] (ret_fast_syscall+0x0/0x2c)
r8 = C001ADE4r7 = 00000080r6 = 00000100r5 = 00000000
r4 = 00000003
Code: e52de004 e1a0c002 e1a0e002 e2511040 (a8a0500c)
Segmentation fault
/ # two hints(Maybe useless):
1. Did you select module support when you compile the kernel?
2. Did you indicate the correct path of include when you compile the hello kernel module? I mean you need to include the arm kernel header files not header files in your host path. 1. This bug already exsit before skeye 1.x.
2. I have test it using a real dev board(same initrd and kernel file). The kernel module can be load successfully. Thanks to Ksh and zlx.
Reply toksh:
I have checked according to your hints.
1. module was indeed selected when compiling kernel.
2. The kernel header path indeed pointed to arm kernel header files. hi, frankblue and zlx
please give me your linux kernel, skyeye.conf and file system image by email
my email is
yuchenATtsinghuaDOTeduDOTcn
thank you!
页:
[1]