[pve-devel] [RFC PATCH kernel 2/2] buildsys: delete /lib/modules/KERNEL/build

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Apr 8 14:55:40 CEST 2016


Instead of force-creating the symlink, attempt to delete it
if it exists. This at least allows users who don't have that
link to build the package. (It's a compromise).
---
 Makefile | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index 1caa2a5..ae94a6d 100644
--- a/Makefile
+++ b/Makefile
@@ -261,8 +261,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
-	mkdir -p /lib/modules/${KVNAME}
-	ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	make -C ${TOP}/${KERNEL_SRC} M=${TOP}/${AACRAIDDIR} KSRC=${TOP}/${KERNEL_SRC} modules
 	cp ${AACRAIDDIR}/aacraid.ko .
 
@@ -270,48 +269,42 @@ 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
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	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
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	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
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	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
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	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
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	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
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	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` .
@@ -319,8 +312,7 @@ bnx2.ko cnic.ko bnx2x.ko: ${BNX2SRC}
 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
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	cd ${ARECADIR}; make -C ${TOP}/${KERNEL_SRC} SUBDIRS=${TOP}/${ARECADIR} KSRC=${TOP}/${KERNEL_SRC} modules
 	cp ${ARECADIR}/arcmsr.ko arcmsr.ko
 
@@ -357,8 +349,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
+	[ ! -e /lib/modules/${KVNAME}/build ] || rm /lib/modules/${KVNAME}/build
 	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