Skip to contentSkip to conversation

compat-drivers: Add possibility to build every subsystem separately

PATCH In review Ozan Çağlayan 4 participants 10 messages Feb 3, 2013 – Mar 15, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat-drivers: Add possibility to build every subsystem separately

Currently we're enabling both drm and network drivers in scripts/admin-update.sh by default.

One of the problems is that I don't want to build network drivers at all. If I change admin-update.sh to disable network drivers, another problem arises: Makefile tries to add objects without looking at all what subsystem is enabled.

This patch addresses this problem by keeping the names of enabled subsystems in a text file called ".enabled_subsystems". Makefile then looks in it to conditionally enable drm, network or both.

---
 Makefile                | 22 +++++++++++++---------
 scripts/admin-clean.sh  |  1 +
 scripts/admin-update.sh |  8 +++++---
 3 files changed, 19 insertions(+), 12 deletions(-)
Makefile +13 -9
index e986a09..1f42511 100644
@@ -40,10 +40,13 @@ NOSTDINC_FLAGS := \
 
 obj-y := compat/
 
-obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
-obj-$(CONFIG_COMPAT_VIDEO_MODULES) += drivers/gpu/drm/
 
-ifeq ($(BT),)
+ifneq (,$(findstring drm, $(SUBSYSTEMS)))
+	obj-$(CONFIG_COMPAT_VIDEO_MODULES) += drivers/gpu/drm/
+endif
+
+ifneq (,$(findstring network, $(SUBSYSTEMS)))
+obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
 obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/
 obj-$(CONFIG_COMPAT_WIRELESS_MODULES) += drivers/net/wireless/
 
@@ -56,14 +59,14 @@ obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/
 obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/bcma/
 obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/misc/eeprom/
 
+obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
+obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
+
 ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),)
 endif
 
 endif
 
-obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
-obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
-
 else
 
 export PWD :=	$(shell pwd)
@@ -90,6 +93,7 @@ export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
 export CREL=$(shell cat $(PWD)/.compat_version)
 export CREL_PRE:=.compat_autoconf_
 export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL)
+export SUBSYSTEMS = $(shell cat $(PWD)/.enabled_subsystems)
 
 all: modules
 
@@ -102,7 +106,7 @@ modules: $(CREL_CHECK)
 
 bt: $(CREL_CHECK)
 	+@./scripts/check_config.sh
-	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules
+	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
 	@touch $@
 
 # We use a CREL_CHECK variable which will depend on the environment used to
@@ -124,7 +128,7 @@ $(CREL_CHECK):
 btinstall: btuninstall bt-install-modules
 
 bt-install-modules: bt
-	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \
+	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
 		modules_install
 	@/sbin/depmod -ae
 	@echo
@@ -145,7 +149,7 @@ btuninstall:
 	@echo
 
 btclean:
-	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
+	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
 	@rm -f $(CREL_PRE)*
 
 install: uninstall install-modules install-scripts
scripts/admin-clean.sh +1 -0
index dd26670..2579046 100755
@@ -10,5 +10,6 @@ rm -rf udev
 rm -f .compat_base_tree
 rm -f .compat_base_tree_version
 rm -f .compat_version
+rm -f .enabled_subsystems
 rm -f code-metrics.txt
 echo "Cleaned compat-drivers"
scripts/admin-update.sh +5 -3
index 73f0cea..5a63064 100755
@@ -222,8 +222,8 @@ copyDirectories() {
 # drivers will be fetched in from the GIT repository. To retain
 # compatibility with compat-wireless, wlan/bt/eth drivers are
 # fetched in by default.
-ENABLE_NETWORK=1
-ENABLE_DRM=1
+ENABLE_NETWORK=0
+ENABLE_DRM=0
 ENABLE_UNIFIED=0
 SUBSYSTEMS=
 UNIFIED_DRIVERS=
@@ -576,7 +576,6 @@ if [ $# -ge 1 ]; then
 				;;
 			"network")
 				ENABLE_NETWORK=1
-				ENABLE_DRM=0
 				shift
 				;;
 			"drm")
@@ -606,6 +605,9 @@ if [[ "$ENABLE_DRM" == "1" ]]; then
 	SUBSYSTEMS+=" drm"
 fi
 
+# Write down enabled subsystems
+echo "$SUBSYSTEMS" > .enabled_subsystems
+
 if [[ "$ENABLE_NETWORK" == "1" ]]; then
 	# WLAN and bluetooth files
 	copyFiles "$INCLUDE_LINUX_WLAN"			"include/linux"
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 41 lines · Ozan Çağlayan

Currently we're enabling both drm and network drivers in scripts/admin-update.sh by default.

One of the problems is that I don't want to build network drivers at all. If I change admin-update.sh to disable network drivers, another problem arises: Makefile tries to add objects without looking at all what subsystem is enabled.

This patch addresses this problem by keeping the names of enabled subsystems in a text file called ".enabled_subsystems". Makefile then looks in it to conditionally enable drm, network or both.

---
 Makefile                | 22 +++++++++++++---------
 scripts/admin-clean.sh  |  1 +
 scripts/admin-update.sh |  8 +++++---
 3 files changed, 19 insertions(+), 12 deletions(-)
Makefile +6 -3
index e986a09..1f42511 100644
@@ -40,10 +40,13 @@ NOSTDINC_FLAGS := \
 
 obj-y := compat/
 
-obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
-obj-$(CONFIG_COMPAT_VIDEO_MODULES) += drivers/gpu/drm/
 
-ifeq ($(BT),)
+ifneq (,$(findstring drm, $(SUBSYSTEMS)))
+	obj-$(CONFIG_COMPAT_VIDEO_MODULES) += drivers/gpu/drm/
+endif
+
+ifneq (,$(findstring network, $(SUBSYSTEMS)))
+obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
 obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/
 obj-$(CONFIG_COMPAT_WIRELESS_MODULES) += drivers/net/wireless/
 

Makefile obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/ · line 64

Quoted 6 lines
Makefile +3 -0
@@ -56,14 +59,14 @@ obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/
 obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/bcma/
 obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/misc/eeprom/
 
+obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
+obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
+

Why are you removing the ifeq ($(BT),) here?

Quoted 62 lines
Makefile +4 -6
 ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),)
 endif
 
 endif
 
-obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
-obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
-
 else
 
 export PWD :=	$(shell pwd)
@@ -90,6 +93,7 @@ export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
 export CREL=$(shell cat $(PWD)/.compat_version)
 export CREL_PRE:=.compat_autoconf_
 export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL)
+export SUBSYSTEMS = $(shell cat $(PWD)/.enabled_subsystems)
 
 all: modules
 
@@ -102,7 +106,7 @@ modules: $(CREL_CHECK)
 
 bt: $(CREL_CHECK)
 	+@./scripts/check_config.sh
-	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules
+	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
 	@touch $@
 
 # We use a CREL_CHECK variable which will depend on the environment used to
@@ -124,7 +128,7 @@ $(CREL_CHECK):
 btinstall: btuninstall bt-install-modules
 
 bt-install-modules: bt
-	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \
+	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
 		modules_install
 	@/sbin/depmod -ae
 	@echo
@@ -145,7 +149,7 @@ btuninstall:
 	@echo
 
 btclean:
-	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
+	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
 	@rm -f $(CREL_PRE)*
 
 install: uninstall install-modules install-scripts
scripts/admin-clean.sh +1 -0
index dd26670..2579046 100755
@@ -10,5 +10,6 @@ rm -rf udev
 rm -f .compat_base_tree
 rm -f .compat_base_tree_version
 rm -f .compat_version
+rm -f .enabled_subsystems
 rm -f code-metrics.txt
 echo "Cleaned compat-drivers"
scripts/admin-update.sh +0 -0
index 73f0cea..5a63064 100755

scripts/admin-update.sh copyDirectories() { · line 226

Quoted 7 lines
scripts/admin-update.sh +2 -2
@@ -222,8 +222,8 @@ copyDirectories() {
 # drivers will be fetched in from the GIT repository. To retain
 # compatibility with compat-wireless, wlan/bt/eth drivers are
 # fetched in by default.
-ENABLE_NETWORK=1
-ENABLE_DRM=1
+ENABLE_NETWORK=0
+ENABLE_DRM=0

I think it is better to add all (gpu and network) when nothing specific was given, this way the script does the same when the same parameters are given than it did before.

Quoted 22 lines
scripts/admin-update.sh +3 -1
 ENABLE_UNIFIED=0
 SUBSYSTEMS=
 UNIFIED_DRIVERS=
@@ -576,7 +576,6 @@ if [ $# -ge 1 ]; then
 				;;
 			"network")
 				ENABLE_NETWORK=1
-				ENABLE_DRM=0
 				shift
 				;;
 			"drm")
@@ -606,6 +605,9 @@ if [[ "$ENABLE_DRM" == "1" ]]; then
 	SUBSYSTEMS+=" drm"
 fi
 
+# Write down enabled subsystems
+echo "$SUBSYSTEMS" > .enabled_subsystems
+
 if [[ "$ENABLE_NETWORK" == "1" ]]; then
 	# WLAN and bluetooth files
 	copyFiles "$INCLUDE_LINUX_WLAN"			"include/linux"
#2 lore raw
Quoted 2 lines

Why are you removing the ifeq ($(BT),) here?

Well I didn't get what it does. (It seems to switch on/off bluetooth but not in an intuitive way) Also it was always set to True without user's intervention so I removed it to provoke a discussion about its functionality :p

Quoted 3 lines

I think it is better to add all (gpu and network) when nothing specific was given, this way the script does the same when the same parameters are given than it did before.

Well yes you are right but then we have to change the parameter logic to support disabling subsystems, e.g.

admin-update.sh --disable-network.

--
Ozan Çağlayan
Research Assistant
Galatasaray University - Computer Engineering Dept.
http://www.ozancaglayan.com

#3 lore raw
Quoted 7 lines · Ozan Çağlayan
Quoted 2 lines

Why are you removing the ifeq ($(BT),) here?

Well I didn't get what it does. (It seems to switch on/off bluetooth but not in an intuitive way) Also it was always set to True without user's intervention so I removed it to provoke a discussion about its functionality :p

I do not get it neither. ;-)
Could you remove it in a separate patch., in the long term it be nice to deactivate it like gpu and network independently from the other network stuff.

Quoted 8 lines
Quoted 3 lines

I think it is better to add all (gpu and network) when nothing specific was given, this way the script does the same when the same parameters are given than it did before.

Well yes you are right but then we have to change the parameter logic to support disabling subsystems, e.g.

admin-update.sh --disable-network.

Isn't there a away to treat everything as selected if nothing is given and if something was given just build that particular subsystem.

Hmm, the longer I think about it this also does not sound very nice. I think your first approach is better, just add the selected subsystems But a help page should be displayed when nothing was given explaining what to do.

Hauke

#5 lore raw

On Tue, Mar 12, 2013 at 2:13 AM, Ozan =C3=87a=C4=9Flayan <[email protected]=

Quoted 2 lines

wrote:
Bringing this again. Luis, what do you think?

I read this thread when I got back from the mountains and agreed with Hauke's recommendation.

Luis

#6 lore raw
Quoted 4 lines

I read this thread when I got back from the mountains and agreed with Hauke's recommendation.

Luis

Can you clarify what does $BT, BT=3DTrue achieve? It looks like it was some kind of switch to enable/disable BT but I can't be sure.

On the other part, Hauke first suggested a different thing and then another=
way.

Should we enable all by default and --disable the unwanted ones or should we disable and print a usage by default and add --enable switches to enable subsystems?

Thanks :)

--=20
Ozan =C3=87a=C4=9Flayan
Research Assistant
Galatasaray University - Computer Engineering Dept.
http://www.ozancaglayan.com

#7 lore raw
Quoted 7 lines · Ozan Çağlayan
Quoted 4 lines

I read this thread when I got back from the mountains and agreed with Hauke's recommendation.

Luis

Can you clarify what does $BT, BT=True achieve? It looks like it was some kind of switch to enable/disable BT but I can't be sure.

Yeah that's legacy junk, nuke it at your liking.

Quoted 2 lines

On the other part, Hauke first suggested a different thing and then another way.

I think the concern was to not build everything on the stock vanilla release.

Quoted 3 lines

Should we enable all by default and --disable the unwanted ones or should we disable and print a usage by default and add --enable switches to enable subsystems?

How about something very simple:

* Enable all by default

* Use Kconfig to allow us to select 4 subsystems:
- Ethernet
- WiFi
- Bluetooth
- DRM

This way we'd keep the logic easy for an initial implementation to support Kconfig (scripts/kconfig/mconf.c) and then build on top of it to expand specifics.

Luis

#8 lore raw
Quoted 4 lines · Luis R. Rodriguez
Quoted 3 lines · On Tue, Mar 12, 2013 at 02:12:15PM +0200, Ozan =C3=87a=C4=9Flayan wrote:
Quoted 3 lines

I read this thread when I got back from the mountains and agreed with Hauke's recommendation.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Luis

Can you clarify what does $BT, BT=3DTrue achieve? It looks like it was some kind of switch to enable/disable BT but I can't be sure.

Yeah that's legacy junk, nuke it at your liking.

Quoted 1 line

On the other part, Hauke first suggested a different thing and then anot=

her

Quoted 19 lines
Quoted 1 line

way.

I think the concern was to not build everything on the stock vanilla release.

Quoted 3 lines

Should we enable all by default and --disable the unwanted ones or should we disable and print a usage by default and add --enable switches to enable subsystems?

How about something very simple:

* Enable all by default

* Use Kconfig to allow us to select 4 subsystems:
- Ethernet
- WiFi
- Bluetooth
- DRM

Quoted 3 lines

This way we'd keep the logic easy for an initial implementation to support Kconfig (scripts/kconfig/mconf.c) and then build on top of it to expand specifics.

But I think I get the issue you were pointing out though -- its not about the building you are concerned about separating, its about the admin work of fixing patches that might be broken for other subystems. You want the option to say you don't care about a subsystem at admin-update time. Is that right?

Luis

#9 lore raw
Quoted 5 lines

But I think I get the issue you were pointing out though -- its not about the building you are concerned about separating, its about the admin work of fixing patches that might be broken for other subystems. You want the option to say you don't care about a subsystem at admin-update time. Is that right?

No not at all. Just for building. I just want to build DRM drivers for example and it is not quiet easy to do this by hand. You have to modify the makefile, etc.

--=20
Ozan =C3=87a=C4=9Flayan
Research Assistant
Galatasaray University - Computer Engineering Dept.
http://www.ozancaglayan.com