Home > OS >  How to compile only. O file into the kernel
How to compile only. O file into the kernel

Time:11-22

Drive chip manufacturers provide the compiled softd. O file (they don't want to give the source), how to compile it into the boot image inside?

CodePudding user response:

Write directly in the makefile: obj - y +=softd. O

This is ok

CodePudding user response:

Here to give an example:
 GCC -c test1. 
c - o test1. OGCC -c test2. C - o test2. O
GCC test1. O test2. O - o test

Can see the -c option only compile the compiler does not link, and do not add any options of GCC command can take several. O file link into the target problem,
In addition, for. O file, theoretically you can through the objdump - t softd. O see them in the file created in the function (in fact is the symbol), know that this information will help you compile (connection) pass it can find the specific reason,

CodePudding user response:

The softd. O filename to softd. O_shipped, then a makefile in obj - y +=softd. O

CodePudding user response:

Linux drive main modify the driver code compilation is a Makefile and Kconfig files in the directory,

According to the other driver is written, for example:
Kconfig
The config YOUR_DRIVER
The default y

(the default value y corresponding compiled into the kernel)

The Makefile:
Obj - $(CONFIG_YOUR_DRIVER) +=softd. O

The top-level directory compiled, view the Linux source. The config file, confirm CONFIG_YOUR_DRIVER value is y,

If it is, it shows that have successfully compiled into the kernel,

CodePudding user response:

Directly in the Makefile to add with respect to OK:

Obj - y +=softd. O
  • Related