[pve-devel] [PATCH stable-4 kernel 3/5] build: allow building as regular user

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Apr 25 12:59:43 CEST 2017


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
build with "fakeroot make" to get correct permissions

 Makefile | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 4dd3b40..681ad6c 100644
--- a/Makefile
+++ b/Makefile
@@ -236,6 +236,7 @@ PVE_CONFIG_OPTS= \
 --set-str CONFIG_DEFAULT_SECURITY apparmor
 
 .compile_mark: ${KERNEL_SRC}/README ${KERNEL_CFG_ORG}
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	cp ${KERNEL_CFG_ORG} ${KERNEL_SRC}/.config
 	cd ${KERNEL_SRC}; ./scripts/config ${PVE_CONFIG_OPTS}
 	cd ${KERNEL_SRC}; make oldconfig
@@ -276,7 +277,7 @@ aacraid.ko: .compile_mark ${AACRAIDSRC}
 	cd ${AACRAIDDIR};tar xzf ../${AACRAIDSRC}
 	cd ${AACRAIDDIR};rpm2cpio aacraid-${AACRAIDVER}.src.rpm|cpio -i
 	cd ${AACRAIDDIR};tar xf aacraid_source.tgz
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	make -C ${TOP}/${KERNEL_SRC} M=${TOP}/${AACRAIDDIR} KSRC=${TOP}/${KERNEL_SRC} modules
 	cp ${AACRAIDDIR}/aacraid.ko .
 
@@ -284,14 +285,14 @@ hpsa.ko hpsa: .compile_mark ${HPSASRC}
 	rm -rf ${HPSADIR}
 	tar xf ${HPSASRC}
 #	sed -i ${HPSADIR}/drivers/scsi/hpsa_kernel_compat.h -e 's/^\/\* #define RHEL7.*/#define RHEL7/'
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	make -C ${TOP}/${KERNEL_SRC} M=${TOP}/${HPSADIR}/drivers/scsi KSRC=${TOP}/${KERNEL_SRC} modules
 	cp ${HPSADIR}/drivers/scsi/hpsa.ko hpsa.ko
 
 e1000e.ko e1000e: .compile_mark ${E1000ESRC}
 	rm -rf ${E1000EDIR}
 	tar xf ${E1000ESRC}
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	# patch used for igb and e1000e!
 	cd ${E1000EDIR}; patch -p1 < ../igb_e1000e-kcompat-version-check-fix.patch
 	cd ${E1000EDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
@@ -300,7 +301,7 @@ e1000e.ko e1000e: .compile_mark ${E1000ESRC}
 igb.ko igb: .compile_mark ${IGBSRC}
 	rm -rf ${IGBDIR}
 	tar xf ${IGBSRC}
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	# patch used for igb and e1000e!
 	cd ${IGBDIR}; patch -p1 < ../igb_e1000e-kcompat-version-check-fix.patch
 	cd ${IGBDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
@@ -309,7 +310,7 @@ igb.ko igb: .compile_mark ${IGBSRC}
 ixgbe.ko ixgbe: .compile_mark ${IXGBESRC}
 	rm -rf ${IXGBEDIR}
 	tar xf ${IXGBESRC}
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	# HACK: for kernel < 4.6, we need to set UTS_UBUNTU_RELEASE_ABI manually
 	# to make it compile
 	cd ${IXGBEDIR}/src; make CFLAGS_EXTRA="-DIXGBE_NO_LRO -DUTS_UBUNTU_RELEASE_ABI=22" BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
@@ -318,14 +319,14 @@ ixgbe.ko ixgbe: .compile_mark ${IXGBESRC}
 i40e.ko i40e: .compile_mark ${I40ESRC}
 	rm -rf ${I40EDIR}
 	tar xf ${I40ESRC}
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	cd ${I40EDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
 	cp ${I40EDIR}/src/i40e.ko i40e.ko
 
 bnx2.ko cnic.ko bnx2x.ko: ${BNX2SRC}
 	rm -rf ${BNX2DIR}
 	tar xf ${BNX2SRC}
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	cd ${BNX2DIR}; make -C bnx2/src KVER=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
 	cd ${BNX2DIR}; make -C bnx2x/src KVER=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
 	cp `find ${BNX2DIR} -name bnx2.ko -o -name cnic.ko -o -name bnx2x.ko` .
@@ -333,7 +334,7 @@ bnx2.ko cnic.ko bnx2x.ko: ${BNX2SRC}
 arcmsr.ko: .compile_mark ${ARECASRC}
 	rm -rf ${ARECADIR}
 	mkdir ${ARECADIR}; cd ${ARECADIR}; unzip ../${ARECASRC}
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	cd ${ARECADIR}; make -C ${TOP}/${KERNEL_SRC} SUBDIRS=${TOP}/${ARECADIR} KSRC=${TOP}/${KERNEL_SRC} modules
 	cp ${ARECADIR}/arcmsr.ko arcmsr.ko
 
@@ -370,7 +371,7 @@ update-drbd:
 drbd ${DRBD_MODULES}: .compile_mark ${DRBDSRC}
 	rm -rf ${DRBDDIR}
 	tar xzf ${DRBDSRC}
-	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || (echo "please remove /lib/modules/${KVNAME}/build" && false)
 	cd ${DRBDDIR}; make KVER=${KVNAME} KDIR=${TOP}/${KERNEL_SRC}
 	mv ${DRBDDIR}/drbd/drbd.ko drbd.ko
 	mv ${DRBDDIR}/drbd/drbd_transport_tcp.ko drbd_transport_tcp.ko
-- 
2.1.4





More information about the pve-devel mailing list