2021-10-02 03:37:17

by Ajay Garg

[permalink] [raw]
Subject: Recommended way to do kernel-development for static modules

Hello All,

Let's say, I want to make a simple printk change to drivers/pci/bus.c,
compile it, load it, test it.

Now, since bus.o is built as a result of CONFIG_PCI=y in
drivers/pci/Makefile, so this module is statically built, and as a
result doing a "make M=drivers/pci" does-not-pick-up-the-change /
have-any-effect.

Doing a simple "make" takes too long, everytime for even a trivial change.


So, what is the recommended way to do kernel-development for static modules?


Will be grateful for pointers.


Thanks and Regards,
Ajay


2021-10-02 04:35:56

by Randy Dunlap

[permalink] [raw]
Subject: Re: Recommended way to do kernel-development for static modules

On 10/1/21 8:31 PM, Ajay Garg wrote:
> Hello All,
>
> Let's say, I want to make a simple printk change to drivers/pci/bus.c,
> compile it, load it, test it.
>
> Now, since bus.o is built as a result of CONFIG_PCI=y in
> drivers/pci/Makefile, so this module is statically built, and as a
> result doing a "make M=drivers/pci" does-not-pick-up-the-change /
> have-any-effect.
>
> Doing a simple "make" takes too long, everytime for even a trivial change.
>
>
> So, what is the recommended way to do kernel-development for static modules?
>
>
> Will be grateful for pointers.

Just to build drivers/pci/bus.o, you do
$ make drivers/pci/bus.o

That will tell you if you have any build errors/warnings.

For run-time testing, AFAIK you don't have any choice but to
build a full kernel and boot it.

--
~Randy

2021-10-02 04:38:38

by Ajay Garg

[permalink] [raw]
Subject: Re: Recommended way to do kernel-development for static modules

Thanks Randy.

On Sat, Oct 2, 2021 at 10:03 AM Randy Dunlap <[email protected]> wrote:
>
> On 10/1/21 8:31 PM, Ajay Garg wrote:
> > Hello All,
> >
> > Let's say, I want to make a simple printk change to drivers/pci/bus.c,
> > compile it, load it, test it.
> >
> > Now, since bus.o is built as a result of CONFIG_PCI=y in
> > drivers/pci/Makefile, so this module is statically built, and as a
> > result doing a "make M=drivers/pci" does-not-pick-up-the-change /
> > have-any-effect.
> >
> > Doing a simple "make" takes too long, everytime for even a trivial change.
> >
> >
> > So, what is the recommended way to do kernel-development for static modules?
> >
> >
> > Will be grateful for pointers.
>
> Just to build drivers/pci/bus.o, you do
> $ make drivers/pci/bus.o
>
> That will tell you if you have any build errors/warnings.
>
> For run-time testing, AFAIK you don't have any choice but to
> build a full kernel and boot it.
>
> --
> ~Randy