Skip to contentSkip to conversation

problem with building kernel modules.

Buildroot Sagaert Johan 3 participants 3 messages Nov 15, 2013

lore
Share & tools
lore
#0 lore raw

Hi

I have a kernel module that I build and install trough the build system. This works fine, the module gets build, installed and depmod is run for it.

The problem occurs if I change the kernel config, the kernel build system removes all target/lib/modules/2.6.36.../kernel/* files , including my built modules.

As a result, my modules are missing.

How can this be solved ?

########################################################################
#

# fm25clxx
#
########################################################################

FM25CLXX_VERSION = 1.0.1
FM25CLXX_SITE = /root/workspace2/FM25FRAMDriver-$(FM25CLXX_VERSION) FM25CLXX_SITE_METHOD = local
FM25CLXX_DEPENDENCIES = linux

FM25CLXX_MOD_INSTALL_DIR=mydrivers

FM25CLXX_MAKE_OPTS += ARCH=$(KERNEL_ARCH) FM25CLXX_MAKE_OPTS += CROSS_COMPILE=$(TARGET_CROSS)

FM25CLXX_INSTALL_OPTS += -C $(LINUX_DIR)
FM25CLXX_INSTALL_OPTS += M=$(@D)
FM25CLXX_INSTALL_OPTS += INSTALL_MOD_PATH=$(TARGET_DIR) FM25CLXX_INSTALL_OPTS += INSTALL_MOD_STRIP=1 FM25CLXX_INSTALL_OPTS += INSTALL_MOD_DIR=kernel/$(FM25CLXX_MOD_INSTALL_DIR)

# see https://www.kernel.org/doc/Documentation/kbuild/modules.txt

define FM25CLXX_CONFIGURE_CMDS

	$(MAKE) KERNELDIR=$(LINUX_DIR) $(DIGITAL_IO_MAKE_OPTS) PWD=$(@D) -C $(@D)  clean

endef

define FM25CLXX_BUILD_CMDS

	$(MAKE) KERNELDIR=$(LINUX_DIR) $(FM25CLXX_MAKE_OPTS) PWD=$(@D) -C $(@D)  all

endef

define FM25CLXX_INSTALL_TARGET_CMDS

	$(MAKE) $(FM25CLXX_MAKE_OPTS) $(FM25CLXX_INSTALL_OPTS) modules_install

endef

define FM25CLXX_UNINSTALL_TARGET_CMDS

	rm -rf $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/$(FM25CLXX_MOD_INSTALL_DIR)

endef

$(eval $(generic-package))

Regards
Sagaert Johan

#1 lore raw

Sagaert, All,

On 2013-11-15 21:24 +0100, Sagaert Johan spake thusly:

Quoted 9 lines

I have a kernel module that I build and install trough the build system. This works fine, the module gets build, installed and depmod is run for it.

The problem occurs if I change the kernel config, the kernel build system removes all target/lib/modules/2.6.36.../kernel/* files , including my built modules.

As a result, my modules are missing.

How can this be solved ?

There's no guarantee built into Buildroot that rebuilding a package will rebuild other packages that depend on it.

The only option for you is to explicitly tell Buildroot to rebuild your module:
make fm25clxx-clean-for-reconfigure fm25clxx all

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

Dear Yann E. MORIN,

Quoted 3 lines · Yann E. MORIN

The only option for you is to explicitly tell Buildroot to rebuild your module:
make fm25clxx-clean-for-reconfigure fm25clxx all

Or, more simply:

make fm25clxx-reconfigure all

The "-clean-for-reconfigure" and "-clean-for-rebuild" are meant to be internal targets. The ones that should be used are "-reconfigure" and "-rebuild".

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com