[pve-devel] [PATCH kernel] buildsys: don't litter my system and allow user builds

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Apr 1 15:19:38 CEST 2016


For some reason drbd uses the wrong variable for the source
tree...

(Build with `fakeroot make -j1`)
---
 Makefile | 40 +++++++++++-----------------------------
 1 file changed, 11 insertions(+), 29 deletions(-)

diff --git a/Makefile b/Makefile
index 12e4a30..43785e4 100644
--- a/Makefile
+++ b/Makefile
@@ -180,7 +180,7 @@ data: .compile_mark ixgbe.ko e1000e.ko ${SPL_MODULES} ${ZFS_MODULES} ${DRBD_MODU
 	# strip debug info
 	find tmp/lib/modules -name \*.ko -print | while read f ; do strip --strip-debug "$$f"; done
 	# finalize
-	depmod -b tmp/ ${KVNAME}
+	/sbin/depmod -b tmp/ ${KVNAME}
 	# Autogenerate blacklist for watchdog devices (see README)
 	install -m 0755 -d tmp/lib/modprobe.d
 	ls tmp/lib/modules/${KVNAME}/kernel/drivers/watchdog/ > watchdog-blacklist.tmp
@@ -261,67 +261,51 @@ 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
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	make -C ${TOP}/${KERNEL_SRC} M=${TOP}/${AACRAIDDIR} modules
+	make -C ${TOP}/${KERNEL_SRC} M=${TOP}/${AACRAIDDIR} KSRC=${TOP}/${KERNEL_SRC} modules
 	cp ${AACRAIDDIR}/aacraid.ko .
 
 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/'
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	make -C ${TOP}/${KERNEL_SRC} M=${TOP}/${HPSADIR}/drivers/scsi modules
+	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}
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	cd ${E1000EDIR}/src; make BUILD_KERNEL=${KVNAME}
+	cd ${E1000EDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
 	cp ${E1000EDIR}/src/e1000e.ko e1000e.ko
 
 igb.ko igb: .compile_mark ${IGBSRC}
 	rm -rf ${IGBDIR}
 	tar xf ${IGBSRC}
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	cd ${IGBDIR}/src; make BUILD_KERNEL=${KVNAME}
+	cd ${IGBDIR}/src; make BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
 	cp ${IGBDIR}/src/igb.ko igb.ko
 
 ixgbe.ko ixgbe: .compile_mark ${IXGBESRC}
 	rm -rf ${IXGBEDIR}
 	tar xf ${IXGBESRC}
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	cd ${IXGBEDIR}/src; make CFLAGS_EXTRA="-DIXGBE_NO_LRO" BUILD_KERNEL=${KVNAME}
+	cd ${IXGBEDIR}/src; make CFLAGS_EXTRA="-DIXGBE_NO_LRO" BUILD_KERNEL=${KVNAME} KSRC=${TOP}/${KERNEL_SRC}
 	cp ${IXGBEDIR}/src/ixgbe.ko ixgbe.ko
 
 i40e.ko i40e: .compile_mark ${I40ESRC}
 	rm -rf ${I40EDIR}
 	tar xf ${I40ESRC}
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	cd ${I40EDIR}/src; make BUILD_KERNEL=${KVNAME}
+	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}
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	cd ${BNX2DIR}; make -C bnx2/src KVER=${KVNAME}
-	cd ${BNX2DIR}; make -C bnx2x/src KVER=${KVNAME}
+	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` .
 
 arcmsr.ko: .compile_mark ${ARECASRC}
 	rm -rf ${ARECADIR}
 	mkdir ${ARECADIR}; cd ${ARECADIR}; unzip ../${ARECASRC}
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	cd ${ARECADIR}; make -C ${TOP}/${KERNEL_SRC} SUBDIRS=${TOP}/${ARECADIR} modules
+	cd ${ARECADIR}; make -C ${TOP}/${KERNEL_SRC} SUBDIRS=${TOP}/${ARECADIR} KSRC=${TOP}/${KERNEL_SRC} modules
 	cp ${ARECADIR}/arcmsr.ko arcmsr.ko
 
 ${SPL_MODULES}: .compile_mark ${SPLSRC}
@@ -357,9 +341,7 @@ update-drbd:
 drbd ${DRBD_MODULES}: .compile_mark ${DRBDSRC}
 	rm -rf ${DRBDDIR}
 	tar xzf ${DRBDSRC}
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
-	cd ${DRBDDIR}; make KVER=${KVNAME}
+	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