Skip to contentSkip to conversation

bttv build error (CONFIG_NET=n)

DISCUSSION Randy Dunlap 3 participants 6 messages Oct 31, 2007 – Nov 2, 2007

lore
Share & tools
lore
#0 lore raw

drivers/media/video/bt8xx/bttv-cards.c calls ip_compute_csum(). However, when CONFIG_NET=n, that produces:

ERROR: "ip_compute_csum" [drivers/media/video/bt8xx/bttv.ko] undefined!

Config symbol VIDEO_BT848 can be made to depend on NET, or the osprey_eeprom() function can be built depending on some new config symbol, or bttv could have its own checksum function...

.config attached.

---
~Randy

#1 lore raw
Quoted 8 lines · Randy Dunlap

drivers/media/video/bt8xx/bttv-cards.c calls ip_compute_csum(). However, when CONFIG_NET=n, that produces:

ERROR: "ip_compute_csum" [drivers/media/video/bt8xx/bttv.ko] undefined!

Config symbol VIDEO_BT848 can be made to depend on NET, or the osprey_eeprom() function can be built depending on some new config symbol, or bttv could have its own checksum function...

The real problem here is that ip_compute_csum is part of lib-y, but is also exported for modules. This problem has come up before, for instance your patch for csum_partial()
http://lkml.org/lkml/2007/4/3/209

Or the problem with kasprintf and the lg module:
http://lkml.org/lkml/2007/9/24/15

The general lib-y vs EXPORT_SYMBOL problem:
http://lkml.org/lkml/2007/9/25/17

The only reason the net stuff works, is because CONFIG_NET includes igmp.c, which can't be compiled as a module. That means ip_compute_csum() will get pulled out of the lib.a file for igmp, and thus be present for the net modules that use it too. If igmp could be turned off, made a module, or stopped using ip_compute_csum(), then the users of ip_compute_csum() that do depend on CONFIG_NET would have the same problem as bttv does.

It seems a shame to create a new ip checksum function in the bttv driver when a perfectly good one already exists and will already be present in just about every kernel out there. Honestly, how common is NET=n and VIDEO_BT848=m outside of randconfig?

#2 lore raw
Quoted 21 lines · On Wed, 31 Oct 2007 04:51:45 -0700 (PDT) Trent Piepho wrote:
Quoted 8 lines · Randy Dunlap

drivers/media/video/bt8xx/bttv-cards.c calls ip_compute_csum(). However, when CONFIG_NET=n, that produces:

ERROR: "ip_compute_csum" [drivers/media/video/bt8xx/bttv.ko] undefined!

Config symbol VIDEO_BT848 can be made to depend on NET, or the osprey_eeprom() function can be built depending on some new config symbol, or bttv could have its own checksum function...

The real problem here is that ip_compute_csum is part of lib-y, but is also exported for modules. This problem has come up before, for instance your patch for csum_partial()
http://lkml.org/lkml/2007/4/3/209

Or the problem with kasprintf and the lg module:
http://lkml.org/lkml/2007/9/24/15

The general lib-y vs EXPORT_SYMBOL problem:
http://lkml.org/lkml/2007/9/25/17

Quoted 6 lines

The only reason the net stuff works, is because CONFIG_NET includes igmp.c, which can't be compiled as a module. That means ip_compute_csum() will get pulled out of the lib.a file for igmp, and thus be present for the net modules that use it too. If igmp could be turned off, made a module, or stopped using ip_compute_csum(), then the users of ip_compute_csum() that do depend on CONFIG_NET would have the same problem as bttv does.

Thanks for the analysis and summary.
(I'm still waiting for those lkml.org links to load... timed out)

Quoted 4 lines

It seems a shame to create a new ip checksum function in the bttv driver when a perfectly good one already exists and will already be present in just about every kernel out there. Honestly, how common is NET=n and VIDEO_BT848=m outside of randconfig?

so just adding "depends on NET" should be OK then?

---
~Randy

#3 lore raw

Randy,

Quoted 7 lines
Quoted 6 lines

The only reason the net stuff works, is because CONFIG_NET includes igmp.c, which can't be compiled as a module. That means ip_compute_csum() will get pulled out of the lib.a file for igmp, and thus be present for the net modules that use it too. If igmp could be turned off, made a module, or stopped using ip_compute_csum(), then the users of ip_compute_csum() that do depend on CONFIG_NET would have the same problem as bttv does.

Quoted 7 lines

Thanks for the analysis and summary.
(I'm still waiting for those lkml.org links to load... timed out)

Quoted 4 lines

It seems a shame to create a new ip checksum function in the bttv driver when a perfectly good one already exists and will already be present in just about every kernel out there. Honestly, how common is NET=n and VIDEO_BT848=m outside of randconfig?

This might happen on embedded devices, like a set top box or a PVR, using a bttv hardware.

Quoted 1 line

so just adding "depends on NET" should be OK then?

Seems very weird to have bttv module dependent on NET, just because a checksum calculus function is defined there.

One possible solution would be to move this function to another place and having both NET, BTTV and other places selecting it.

Signature · 2 lines
Cheers,
Mauro
#4 lore raw
Quoted 16 lines · Mauro Carvalho Chehab

Randy,

Quoted 6 lines
Quoted 6 lines

The only reason the net stuff works, is because CONFIG_NET includes igmp.c, which can't be compiled as a module. That means ip_compute_csum() will get pulled out of the lib.a file for igmp, and thus be present for the net modules that use it too. If igmp could be turned off, made a module, or stopped using ip_compute_csum(), then the users of ip_compute_csum() that do depend on CONFIG_NET would have the same problem as bttv does.

Quoted 7 lines

Thanks for the analysis and summary.
(I'm still waiting for those lkml.org links to load... timed out)

Quoted 4 lines

It seems a shame to create a new ip checksum function in the bttv driver when a perfectly good one already exists and will already be present in just about every kernel out there. Honestly, how common is NET=n and VIDEO_BT848=m outside of randconfig?

Quoted 7 lines

This might happen on embedded devices, like a set top box or a PVR, using a bttv hardware.

Quoted 1 line

so just adding "depends on NET" should be OK then?

Seems very weird to have bttv module dependent on NET, just because a checksum calculus function is defined there.

Oh, I agree with that. My comment above possibly needed a smiley.

Quoted 2 lines

One possible solution would be to move this function to another place and having both NET, BTTV and other places selecting it.

I gave 3 possible solutions in the beginning email. I would probably just modify bttv to support osprey only when CONFIG_NET=y.

or fix the linking problem that Trent pointed out.

Signature · 1 line
~Randy
#5 lore raw
In reply to Mauro Carvalho Chehab
Quoted 16 lines · Mauro Carvalho Chehab

Randy,

Quoted 7 lines
Quoted 6 lines

The only reason the net stuff works, is because CONFIG_NET includes igmp.c, which can't be compiled as a module. That means ip_compute_csum() will get pulled out of the lib.a file for igmp, and thus be present for the net modules that use it too. If igmp could be turned off, made a module, or stopped using ip_compute_csum(), then the users of ip_compute_csum() that do depend on CONFIG_NET would have the same problem as bttv does.

Quoted 7 lines

Thanks for the analysis and summary.
(I'm still waiting for those lkml.org links to load... timed out)

Quoted 4 lines

It seems a shame to create a new ip checksum function in the bttv driver when a perfectly good one already exists and will already be present in just about every kernel out there. Honestly, how common is NET=n and VIDEO_BT848=m outside of randconfig?

Quoted 7 lines

This might happen on embedded devices, like a set top box or a PVR, using a bttv hardware.

Quoted 1 line

so just adding "depends on NET" should be OK then?

Seems very weird to have bttv module dependent on NET, just because a checksum calculus function is defined there.

Mauro, read the first message I linked too:
http://lkml.org/lkml/2007/4/3/209 or http://article.gmane.org/gmane.linux.kernel/511684

Randy had this exact same problem with the md driver and a different ip checksum function.

ip_compute_csum() _isn't_ defined under NET. It's part of the kernel's arch specific library. So it should be available for all modules to use as part of the kernel core. Except due to a flaw in the build system, symbols that are part of a library can't be used by modules unless there is at least one non-module user. There would be the same problem with strcat() or tons of other functions, if one were able to compile all users of these functions are modules.

I wonder if the build system could be modified to take every object that's part of lib-y an turn it into a .ko file?

The process would be something like this:
build lib-y objects like they are and make lib.a

filter out of lib-y all objects that don't export symbols. Since the objects are already compiled, this shouldn't be hard.

obj-m += lib-y

Now all the lib files will be modules, and if any module needs a symbol from one and it's not in the kernel, modprobe will load it. Minimum bloat, since the library code isn't loaded into the kernel until something is in the kernel that needs it. And we don't need to create kconfig symbols for library functions and remember to select them. Let depmod keep track of what library functions a module needs.