Build packages as modules when using global build settings

Hello, I'm kind of rooky using openwrt, I've a issue that I can not solve by myself, here it is ...

I've created a global config symbol EXTRA_PACKAGES that I would like to use as a trigger for building some packages as modules for my openwrt target.

I mean, when the EXTRA_PACKAGES symbol is set, these packages become automatically selected with in the menuconfig, otherwise they are not selected. I don't want to manually select each package. I don't want to have them in the built image.

I've tried using the DEPENDS symbol in the openwrt Makefile of these packages, but then, the packages become either, selected "built-in" <*>, either unselected ...

Is there any way to achieve this automatic package configuration as module?

thanks, have a good day

best to describe exactly what you mean by this in simpler language, as what you describe above jumbles some terminology/features ...

yes, let me try again ...

in menuconfig -> global build settings, I've created a new config symbol that I named EXTRA_PACKAGES. it is a boolean.

I have a package, named "PACKAGE_A", that depends on EXTRA_PACKAGES in its Makefile: DEPENDS := @EXTRA_PACKAGES as pointed out in "https://openwrt.org/docs/guide-developer/dependencies"

when EXTRA_PACKAGES is selected [*], "PACKAGE_A" then appears as <*> (selected as built-in) in menuconfig, I would like PACKAGE_A to appear as <M> (selected as a module) instead. Is it possible?

thanks

ok...

'module' can mean two things... 'm' = not built-in and *.ko...

while it's pretty obvious you are probably thinking of 'not-built-in'... just saying 'module' is ambiguous...

ok, got it.

and yes, you're right, I mean 'not-built-in'

have you tried something like this @ target/linux/YOURTARGET/image/Config.in ?

config PACKAGE_B
	bool "something darkside"
	default m if EXTRA_PACKAGES
	depends on PACKAGE_A

thanks, looking in that direction.