RE: Module loading and Unloading

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

 



Hi Vivek,
 
> I have kernel modules for USB Host, device and OTG.

> These platform drivers ( usb bus driver (h/w drivers)).

>

> As of now I am using EXPORT_SYMBOL to export a

> variable flag for doing Inter-Module-communication.

> Problem: other modules which are using this variable

> fail while doing insmod if original module exporting

> this variable is Not loaded.

>

> So I am looking a way in which I don’t have to worry

> if my original module is loaded or not.

 

So you are asking this: Module A exports symbol "x" and module "B" uses it. Now you want to be able to load module B irrespective of whether module A is loaded or not. Right?

 

But in the case module A is not loaded, where do you expect the module B to resolve the references to "x" from? You cannot have undefined references, and there HAS to be a definition for the module to be loaded.

 

> For this I need to check for the export symbol via c

> code (module code, or ko file code).

>

> Again I can check in System.map but I am on

> embedded board, so I don’t have System.map

>  on my up and running linux image.

 

Firstly you cannot read / write files from a kernel module. Secondly, the undefined references have to be resolved BEFORE the control reaches your module initialization code (MODULE_INIT). Thirdly, even if you some how were to magically determine that the symbol is not defined in the kernel, what do you plan to do in order to provide a definition of "x"?

Thanks,

 

Rajat

 

 

 

-----Original Message-----
From: Rajat Jain [mailto:Rajat.Jain@xxxxxxxxxxxx]
Sent:
Tuesday, May 27, 2008 7:09 PM
To:
Vivek Kumar Gupta; kernelnewbies
Subject: RE: Module loading and Unloading

 

Hi Vivek,

 

What you are trying to do is very unclear.

 

> 1. Is there a way of exporting symbol kernel?

 

Ofcourse, EXPORT_SYMBOL(). Wait, did I understand your question correctly?

 

> 2. Or is there any way which I can check if symbol is present in the kernel in c code?

 

Check it in kallsyms

 

> 3. Or Can I load the Module A from Module B [in c code] (without using modprobe).

 

Huh? Are you trying to load a module from C code in kernel space? N-O-!. Yes, a C code in application space can load modules.

 

Thanks,

 

Rajat


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux