INSMOD failing on MIPS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,
 
I encountered a strange problem when i tried  to insert a module on MIPS
79S334A board with linux kernel version 2.4.3
 
When a single test file "temp.c" is compiled as
 
mipsel-linux-gcc -I /home/idt/linux/include/asm/gcc -D__KERNEL__
-I/home/idt/linux/include -Wall -Wstrict-prototypes -O2
-fno-strict-aliasing -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic
-mcpu=r4600 -mips2 -Wa,--trap -pipe -DMODULE -mlong-calls -o temp.o -c
temp.c
 
and i try to insmod the output 'temp.o' file, insmod is working fine.
 
But when i link two '.o' files with ld as
"mipsel-linux-ld -r -o temp.o temp.o temp1.o"
and insert the output 'temp.o' it is crashing.
 
While debugging i came to know that the Global Variable is allocated
memory at an address 0x4 which is an invalid memory in MIPS.
The error displayed on console is
>Unable to handle kernel paging request at virtual address 00000004, epc
== c00000b4, ra == 80216e54
>Oops in fault.c:do_page_fault, line 172
 
If i declare the variable as "static" the memory allocation is in proper
memory map as it will go into DATA section.
This means some problem is coming for the relocatable symbols while
linking.
Please suggest any more options to be added/deleted while
compiling/linking the module or any other missing thing.
 
The C file content is :
 
#include <linux/kernel.h>
#ifdef MODULE
#include <linux/module.h>
#else
# include <linux/init.h>
#endif
 
int MyGlobalVar;
 
int init_module (void)
{
 
  printk("<1>My Test Module Inserted\n");
  printk("<1>MyGlobalVar Address : %x\n", &MyGlobalVar);
 
  MyGlobalVar = NULL;
  return 0;
}
 
void cleanup_module()
{
  printk("<1>My Test Module Removed\n");
}
 
Thanks and Regards,
--Rajesh





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux