[xenial v2 2/7] UBUNTU: SAUCE: bnxt_en_bpo: Drop distro out-of-tree detection logic

Juerg Haefliger juerg.haefliger at canonical.com
Thu Aug 17 11:32:27 UTC 2017


BugLink: http://bugs.launchpad.net/bugs/1711056

The provided Makefile is a generic out-of-tree Makefile that tries
to be smart and detect the source code location plus a few other
things based on the current distro. We don't need any of this since
we're adding the driver as an in-tree module, so get rid of it.

Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
---
 ubuntu/bnxt/Makefile | 90 ++--------------------------------------------------
 1 file changed, 2 insertions(+), 88 deletions(-)

diff --git a/ubuntu/bnxt/Makefile b/ubuntu/bnxt/Makefile
index 3531e72ffa15..e295011f99d9 100644
--- a/ubuntu/bnxt/Makefile
+++ b/ubuntu/bnxt/Makefile
@@ -1,42 +1,8 @@
 #!/usr/bin/make
 # Makefile for building Linux Broadcom Gigabit ethernet driver as a module.
 # $id$
-KVER=
-ifeq ($(KVER),)
-  KVER=$(shell uname -r)
-endif
-
-__ARCH=$(shell uname -m)
-
-# PREFIX may be set by the RPM build to set the effective root.
-PREFIX=
-ifeq ($(shell ls /lib/modules/$(KVER)/build > /dev/null 2>&1 && echo build),)
-# SuSE source RPMs
-  _KVER=$(shell echo $(KVER) | cut -d "-" -f1,2)
-  _KFLA=$(shell echo $(KVER) | cut -d "-" -f3)
-  _ARCH=$(shell file -b /lib/modules/$(shell uname -r)/build | cut -d "/" -f5)
-  ifeq ($(_ARCH),)
-    _ARCH=$(__ARCH)
-  endif
-  ifeq ($(shell ls /usr/src/linux-$(_KVER)-obj > /dev/null 2>&1 && echo linux),)
-    ifeq ($(shell ls /usr/src/kernels/$(KVER)-$(__ARCH) > /dev/null 2>&1 && echo linux),)
-      LINUX=
-    else
-      LINUX=/usr/src/kernels/$(KVER)-$(__ARCH)
-      LINUXSRC=$(LINUX)
-    endif
-  else
-    LINUX=/usr/src/linux-$(_KVER)-obj/$(_ARCH)/$(_KFLA)
-    LINUXSRC=/usr/src/linux-$(_KVER)
-  endif
-else
-  LINUX=/lib/modules/$(KVER)/build
-  ifeq ($(shell ls /lib/modules/$(KVER)/source > /dev/null 2>&1 && echo source),)
-    LINUXSRC=$(LINUX)
-  else
-    LINUXSRC=/lib/modules/$(KVER)/source
-  endif
-endif
+
+LINUXSRC := $(srctree)
 
 ifeq ($(shell ls $(LINUXSRC)/include/uapi/linux > /dev/null 2>&1 && echo uapi),)
   UAPI=
@@ -44,22 +10,6 @@ else
   UAPI=uapi
 endif
 
-ifeq ($(BCMMODDIR),)
-  ifeq ($(shell ls /lib/modules/$(KVER)/updates > /dev/null 2>&1 && echo 1),1)
-    BCMMODDIR=/lib/modules/$(KVER)/updates
-  else
-    ifeq ($(shell grep -q "search.*[[:space:]]updates" /etc/depmod.conf > /dev/null 2>&1 && echo 1),1)
-      BCMMODDIR=/lib/modules/$(KVER)/updates
-    else
-      ifeq ($(shell grep -q "search.*[[:space:]]updates" /etc/depmod.d/* > /dev/null 2>&1 && echo 1),1)
-        BCMMODDIR=/lib/modules/$(KVER)/updates
-      else
-        BCMMODDIR=/lib/modules/$(KVER)/kernel/drivers/net
-      endif
-    endif
-  endif
-endif
-
 ifneq ($(shell grep -o "pci_enable_msix_range" $(LINUXSRC)/include/linux/pci.h),)
   DISTRO_CFLAG = -DHAVE_MSIX_RANGE
 else
@@ -457,41 +407,5 @@ EXTRA_CFLAGS += ${DISTRO_CFLAG} -g -DCHIMP_FW -D__LINUX -DCONFIG_BNXT_SRIOV -DCO
 
 cflags-y += $(EXTRA_CFLAGS)
 
-BCM_DRV = bnxt_en.ko
-ifneq ($(KERNELRELEASE),)
-
 obj-m += bnxt_en.o
 bnxt_en-y := bnxt.o bnxt_ethtool.o bnxt_sriov.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_ptp.o #decode_hsi.o
-
-else
-
-default:
-ifeq ($(CROSS_COMPILE),)
-	make -C $(LINUX) SUBDIRS=$(shell pwd) modules
-else ifneq ($(CROSS_COMPILE),)
-	make -C $(LINUXSRC) SUBDIRS=$(shell pwd) modules CROSS_COMPILE=$(CROSS_COMPILE) ARCH=$(ARCH)
-endif
-
-yocto_all:
-	$(MAKE) -C $(LINUXSRC) M=$(shell pwd)
-
-modules_install:
-	$(MAKE) -C $(LINUXSRC) M=$(shell pwd) modules_install
-
-endif
-
-install: default
-	mkdir -p $(PREFIX)/$(BCMMODDIR);
-	install -m 444 $(BCM_DRV) $(PREFIX)/$(BCMMODDIR);
-	@if [ "$(PREFIX)" = "" ]; then /sbin/depmod -a ;\
-	else echo " *** Run '/sbin/depmod -a' to update the module database.";\
-	fi
-
-.PHONEY: all clean install
-
-clean:
-	-rm -f bnxt.o bnxt.mod.c bnxt.mod.o .bnxt.*.cmd *.cmd *.markers *.order *.symvers decode_hsi.o .decode_*
-	-rm -rf .tmp_versions
-	-rm -rf bnxt_en.o bnxt_en.ko bnxt_en.mod.o bnxt_en.mod.c .bnxt_en.* bnxt_sriov.o .bnxt_sriov.* bnxt_ethtool.o .bnxt_ethtool.* bnxt_dcb.o .bnxt_dcb.* bnxt_ulp.o .bnxt_ulp.* bnxt_xdp.o .bnxt_xdp.*
-	-rm -f Module.markers Module.symvers modules.order
-
-- 
2.11.0





More information about the kernel-team mailing list