]> git.proxmox.com Git - pve-kernel-jessie.git/blob - Makefile
add proxmox-ve package
[pve-kernel-jessie.git] / Makefile
1 RELEASE=4.0
2
3 KERNEL_VER=4.0.2
4 PKGREL=1
5 # also include firmware of previous versrion into
6 # the fw package: fwlist-2.6.32-PREV-pve
7 KREL=1
8
9 KERNELSRCTAR=linux_${KERNEL_VER}.orig.tar.xz
10 KERNELDEBTAR=linux_${KERNEL_VER}-1.debian.tar.xz
11
12 EXTRAVERSION=-${KREL}-pve
13 KVNAME=${KERNEL_VER}${EXTRAVERSION}
14 PACKAGE=pve-kernel-${KVNAME}
15 HDRPACKAGE=pve-headers-${KVNAME}
16
17 ARCH=amd64
18 GITVERSION:=$(shell cat .git/refs/heads/master)
19
20 TOP=$(shell pwd)
21
22 KERNEL_SRC=linux-${KERNEL_VER}
23
24 KERNEL_CFG_ORG=config-${KERNEL_VER}.org
25
26 FW_VER=1.1
27 FW_REL=5
28 FW_DEB=pve-firmware_${FW_VER}-${FW_REL}_all.deb
29
30 #E1000EDIR=e1000e-3.1.0.2
31 #E1000ESRC=${E1000EDIR}.tar.gz
32
33 IGBDIR=igb-5.2.18
34 IGBSRC=${IGBDIR}.tar.gz
35
36 IXGBEDIR=ixgbe-4.0.3
37 IXGBESRC=${IXGBEDIR}.tar.gz
38
39 I40EDIR=i40e-1.2.38
40 I40ESRC=${I40EDIR}.tar.gz
41
42 BNX2DIR=netxtreme2-7.11.05
43 BNX2SRC=${BNX2DIR}.tar.gz
44
45 AACRAIDVER=1.2.1-40700
46 AACRAIDDIR=aacraid-${AACRAIDVER}.src
47 AACRAIDSRC=aacraid-linux-src-${AACRAIDVER}.tgz
48
49 HPSAVER=3.4.6
50 HPSADIR=hpsa-${HPSAVER}
51 HPSASRC=${HPSADIR}-170.tar.bz2
52
53 # driver does not compile
54 #MEGARAID_DIR=megaraid_sas-06.703.11.00
55 #MEGARAID_SRC=${MEGARAID_DIR}-src.tar.gz
56
57 ARECADIR=arcmsr-1.30.0X.19-140509
58 ARECASRC=${ARECADIR}.zip
59
60 # this one does not compile with newer 3.10 kernels!
61 #RR272XSRC=RR272x_1x-Linux-Src-v1.5-130325-0732.tar.gz
62 #RR272XDIR=rr272x_1x-linux-src-v1.5
63
64 # this project look dead - no updates since 3 years
65 #ISCSITARGETDIR=iscsitarget-1.4.20.2
66 #ISCSITARGETSRC=${ISCSITARGETDIR}.tar.gz
67
68 ZFSVER=0.6.4
69 SPLDIR=spl-spl-${ZFSVER}
70 SPLSRC=spl-${ZFSVER}.tar.gz
71 ZFSDIR=zfs-zfs-${ZFSVER}
72 ZFSSRC=zfs-${ZFSVER}.tar.gz
73 ZFS_MODULES=zfs.ko zavl.ko znvpair.ko zunicode.ko zcommon.ko zpios.ko
74 SPL_MODULES=spl.ko splat.ko
75
76 # DRBD9
77 DRBDVER=9.0.0rc2
78 DRBDDIR=drbd-${DRBDVER}
79 DRBDSRC=${DRBDDIR}.tar.gz
80 DRBD_MODULES=drbd.ko drbd_transport_tcp.ko
81
82 DST_DEB=${PACKAGE}_${KERNEL_VER}-${PKGREL}_${ARCH}.deb
83 HDR_DEB=${HDRPACKAGE}_${KERNEL_VER}-${PKGREL}_${ARCH}.deb
84 PVEPKG=proxmox-ve
85 PVE_DEB=${PVEPKG}_${RELEASE}-${PKGREL}_all.deb
86
87 all: check_gcc ${DST_DEB} ${FW_DEB} ${HDR_DEB} ${PVE_DEB}
88
89 ${PVE_DEB} pve: proxmox-ve/control proxmox-ve/postinst
90 rm -rf proxmox-ve/data
91 mkdir -p proxmox-ve/data/DEBIAN
92 mkdir -p proxmox-ve/data/usr/share/doc/${PVEPKG}/
93 install -m 0644 proxmox-ve/proxmox-release\@proxmox.com.pubkey proxmox-ve/data/usr/share/doc/${PVEPKG}
94 sed -e 's/@KVNAME@/${KVNAME}/' -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@RELEASE@/${RELEASE}/' -e 's/@PKGREL@/${PKGREL}/' <proxmox-ve/control >proxmox-ve/data/DEBIAN/control
95 install -m 0755 proxmox-ve/postinst proxmox-ve/data/DEBIAN/postinst
96 echo "git clone git://git.proxmox.com/git/pve-kernel-4.0.git\\ngit checkout ${GITVERSION}" > proxmox-ve/data/usr/share/doc/${PVEPKG}/SOURCE
97 install -m 0644 proxmox-ve/copyright proxmox-ve/data/usr/share/doc/${PVEPKG}
98 install -m 0644 proxmox-ve/changelog.Debian proxmox-ve/data/usr/share/doc/${PVEPKG}
99 gzip --best proxmox-ve/data/usr/share/doc/${PVEPKG}/changelog.Debian
100 dpkg-deb --build proxmox-ve/data ${PVE_DEB}
101
102 .PHONY: download
103 download:
104 fixmestophere
105
106 check_gcc:
107 ifeq ($(CC), cc)
108 gcc --version|grep "4\.9" || false
109 else
110 $(CC) --version|grep "4\.9" || false
111 endif
112
113 ${DST_DEB}: data control.in prerm.in postinst.in postrm.in copyright changelog.Debian
114 mkdir -p data/DEBIAN
115 sed -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@KVNAME@/${KVNAME}/' -e 's/@PKGREL@/${PKGREL}/' <control.in >data/DEBIAN/control
116 sed -e 's/@@KVNAME@@/${KVNAME}/g' <prerm.in >data/DEBIAN/prerm
117 chmod 0755 data/DEBIAN/prerm
118 sed -e 's/@@KVNAME@@/${KVNAME}/g' <postinst.in >data/DEBIAN/postinst
119 chmod 0755 data/DEBIAN/postinst
120 sed -e 's/@@KVNAME@@/${KVNAME}/g' <postrm.in >data/DEBIAN/postrm
121 chmod 0755 data/DEBIAN/postrm
122 install -D -m 644 copyright data/usr/share/doc/${PACKAGE}/copyright
123 install -D -m 644 changelog.Debian data/usr/share/doc/${PACKAGE}/changelog.Debian
124 echo "git clone git://git.proxmox.com/git/pve-kernel-3.2.0.git\\ngit checkout ${GITVERSION}" > data/usr/share/doc/${PACKAGE}/SOURCE
125 gzip -f --best data/usr/share/doc/${PACKAGE}/changelog.Debian
126 rm -f data/lib/modules/${KVNAME}/source
127 rm -f data/lib/modules/${KVNAME}/build
128 dpkg-deb --build data ${DST_DEB}
129 lintian ${DST_DEB}
130
131
132 fwlist-${KVNAME}: data
133 ./find-firmware.pl data/lib/modules/${KVNAME} >fwlist.tmp
134 mv fwlist.tmp $@
135
136 # fixme: bnx2.ko cnic.ko bnx2x.ko
137 data: .compile_mark ${SPL_MODULES} ${ZFS_MODULES} ${DRBD_MODULES}
138 rm -rf data tmp; mkdir -p tmp/lib/modules/${KVNAME}
139 mkdir tmp/boot
140 install -m 644 ${KERNEL_SRC}/.config tmp/boot/config-${KVNAME}
141 install -m 644 ${KERNEL_SRC}/System.map tmp/boot/System.map-${KVNAME}
142 install -m 644 ${KERNEL_SRC}/arch/x86_64/boot/bzImage tmp/boot/vmlinuz-${KVNAME}
143 cd ${KERNEL_SRC}; make INSTALL_MOD_PATH=../tmp/ modules_install
144 # install zfs drivers
145 install -d -m 0755 tmp/lib/modules/${KVNAME}/zfs
146 install -m 644 ${SPL_MODULES} ${ZFS_MODULES} tmp/lib/modules/${KVNAME}/zfs
147 # install drbd9
148 install -m 644 ${DRBD_MODULES} tmp/lib/modules/${KVNAME}/kernel/drivers/block/drbd
149 # remove firmware
150 rm -rf tmp/lib/firmware
151 # strip debug info
152 find tmp/lib/modules -name \*.ko -print | while read f ; do strip --strip-debug "$$f"; done
153 # finalize
154 depmod -b tmp/ ${KVNAME}
155 mv tmp data
156
157 PVE_CONFIG_OPTS= \
158 -m CONFIG_CEPH_FS \
159 -m CONFIG_BLK_DEV_NBD \
160 -m CONFIG_BLK_DEV_RBD \
161 -m CONFIG_BCACHE \
162 -m CONFIG_JFS_FS \
163 -m CONFIG_HFS_FS \
164 -m CONFIG_HFSPLUS_FS \
165 -e CONFIG_BRIDGE \
166 -e CONFIG_BRIDGE_NETFILTER \
167 -e CONFIG_BLK_DEV_SD \
168 -e CONFIG_BLK_DEV_SR \
169 -e CONFIG_BLK_DEV_DM \
170 -d CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND \
171 -e CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE \
172 --set-val CONFIG_BLK_DEV_LOOP_MIN_COUNT 255 \
173 -d CONFIG_MODULE_SIG \
174 -d CONFIG_MEMCG_DISABLED \
175 -e CONFIG_MEMCG_SWAP_ENABLED \
176 -e CONFIG_MEMCG_KMEM \
177 -d CONFIG_DEFAULT_CFQ \
178 --set-str CONFIG_DEFAULT_IOSCHED deadline \
179 -d CONFIG_DEFAULT_SECURITY_DAC \
180 -e CONFIG_DEFAULT_SECURITY_APPARMOR \
181 --set-str CONFIG_DEFAULT_SECURITY apparmor
182
183 .compile_mark: ${KERNEL_SRC}/README ${KERNEL_CFG_ORG}
184 cp ${KERNEL_CFG_ORG} ${KERNEL_SRC}/.config
185 cd ${KERNEL_SRC}; ./scripts/config ${PVE_CONFIG_OPTS}
186 cd ${KERNEL_SRC}; make oldconfig
187 cd ${KERNEL_SRC}; make -j 8
188 touch $@
189
190 ${KERNEL_SRC}/README: ${KERNEL_SRC}.org/README
191 rm -rf ${KERNEL_SRC}
192 cp -a ${KERNEL_SRC}.org ${KERNEL_SRC}
193 cd ${KERNEL_SRC}; patch -p1 <../bridge-patch.diff
194 #cd ${KERNEL_SRC}; patch -p1 <../bridge-forward-ipv6-neighbor-solicitation.patch
195 #cd ${KERNEL_SRC}; patch -p1 <../add-empty-ndo_poll_controller-to-veth.patch
196 #cd ${KERNEL_SRC}; patch -p1 <../override_for_missing_acs_capabilities.patch
197 #cd ${KERNEL_SRC}; patch -p1 <../vhost-net-extend-device-allocation-to-vmalloc.patch
198 sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'
199 touch $@
200
201 ${KERNEL_SRC}.org/README ${KERNEL_CFG_ORG}: ${KERNELSRCTAR} ${KERNELDEBTAR}
202 rm -rf ${KERNEL_SRC}.org ${KERNEL_SRC}.tmp orig
203 mkdir ${KERNEL_SRC}.tmp
204 tar xf ${KERNELDEBTAR} -C ${KERNEL_SRC}.tmp
205 cd ${KERNEL_SRC}.tmp; ./debian/rules orig
206 cd ${KERNEL_SRC}.tmp; ./debian/rules setup
207 cp ${KERNEL_SRC}.tmp/debian/build/build_amd64_none_amd64/.config ${KERNEL_CFG_ORG}
208 rm -rf orig
209 rm -rf ${KERNEL_SRC}.tmp/debian
210 mv ${KERNEL_SRC}.tmp ${KERNEL_SRC}.org
211 touch $@
212
213 ${SPL_MODULES}: .compile_mark ${SPLSRC}
214 rm -rf ${SPLDIR}
215 tar xf ${SPLSRC}
216 cd ${SPLDIR}; ./autogen.sh
217 cd ${SPLDIR}; ./configure --with-config=kernel --with-linux=${TOP}/${KERNEL_SRC} --with-linux-obj=${TOP}/${KERNEL_SRC}
218 cd ${SPLDIR}; make
219 cp ${SPLDIR}/module/spl/spl.ko spl.ko
220 cp ${SPLDIR}/module/splat/splat.ko splat.ko
221
222 ${ZFS_MODULES}: .compile_mark ${ZFSSRC}
223 rm -rf ${ZFSDIR}
224 tar xf ${ZFSSRC}
225 cd ${ZFSDIR}; ./autogen.sh
226 cd ${ZFSDIR}; ./configure --with-spl=${TOP}/${SPLDIR} --with-spl-obj=${TOP}/${SPLDIR} --with-config=kernel --with-linux=${TOP}/${KERNEL_SRC} --with-linux-obj=${TOP}/${KERNEL_SRC}
227 cd ${ZFSDIR}; make
228 cp ${ZFSDIR}/module/zfs/zfs.ko zfs.ko
229 cp ${ZFSDIR}/module/avl/zavl.ko zavl.ko
230 cp ${ZFSDIR}/module/nvpair/znvpair.ko znvpair.ko
231 cp ${ZFSDIR}/module/unicode/zunicode.ko zunicode.ko
232 cp ${ZFSDIR}/module/zcommon/zcommon.ko zcommon.ko
233 cp ${ZFSDIR}/module/zpios/zpios.ko zpios.ko
234
235 .PHONY: update-drbd
236 update-drbd:
237 rm -rf ${DRBDDIR} ${DRBDSRC} drbd-9.0
238 git clone --recursive git://git.drbd.org/drbd-9.0
239 cd drbd-9.0; make tarball
240 mv drbd-9.0/${DRBDSRC} ${DRBDSRC}
241
242 .PHONY: drbd
243 drbd ${DRBD_MODULES}: .compile_mark ${DRBDSRC}
244 rm -rf ${DRBDDIR}
245 tar xzf ${DRBDSRC}
246 mkdir -p /lib/modules/${KVNAME}
247 ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
248 cd ${DRBDDIR}; make KVER=${KVNAME}
249 mv ${DRBDDIR}/drbd/drbd.ko drbd.ko
250 mv ${DRBDDIR}/drbd/drbd_transport_tcp.ko drbd_transport_tcp.ko
251
252 #iscsi_trgt.ko: .compile_mark ${ISCSITARGETSRC}
253 # rm -rf ${ISCSITARGETDIR}
254 # tar xf ${ISCSITARGETSRC}
255 # cd ${ISCSITARGETDIR}; make KSRC=${TOP}/${KERNEL_SRC}
256 # cp ${ISCSITARGETDIR}/kernel/iscsi_trgt.ko iscsi_trgt.ko
257
258 headers_tmp := $(CURDIR)/tmp-headers
259 headers_dir := $(headers_tmp)/usr/src/linux-headers-${KVNAME}
260
261 ${HDR_DEB} hdr: .compile_mark headers-control.in headers-postinst.in
262 rm -rf $(headers_tmp)
263 install -d $(headers_tmp)/DEBIAN $(headers_dir)/include/
264 sed -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@KVNAME@/${KVNAME}/' -e 's/@PKGREL@/${PKGREL}/' <headers-control.in >$(headers_tmp)/DEBIAN/control
265 sed -e 's/@@KVNAME@@/${KVNAME}/g' <headers-postinst.in >$(headers_tmp)/DEBIAN/postinst
266 chmod 0755 $(headers_tmp)/DEBIAN/postinst
267 install -D -m 644 copyright $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/copyright
268 install -D -m 644 changelog.Debian $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/changelog.Debian
269 echo "git clone git://git.proxmox.com/git/pve-kernel-3.10.0.git\\ngit checkout ${GITVERSION}" > $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/SOURCE
270 gzip -f --best $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/changelog.Debian
271 install -m 0644 ${KERNEL_SRC}/.config $(headers_dir)
272 install -m 0644 ${KERNEL_SRC}/Module.symvers $(headers_dir)
273 cd ${KERNEL_SRC}; find . -path './debian/*' -prune -o -path './include/*' -prune -o -path './Documentation' -prune \
274 -o -path './scripts' -prune -o -type f \
275 \( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
276 -name '*.sh' -o -name '*.pl' \) \
277 -print | cpio -pd --preserve-modification-time $(headers_dir)
278 cd ${KERNEL_SRC}; cp -a include scripts $(headers_dir)
279 cd ${KERNEL_SRC}; (find arch/x86 -name include -type d -print | \
280 xargs -n1 -i: find : -type f) | \
281 cpio -pd --preserve-modification-time $(headers_dir)
282 dpkg-deb --build $(headers_tmp) ${HDR_DEB}
283 #lintian ${HDR_DEB}
284
285 dvb-firmware.git/README:
286 git clone https://github.com/OpenELEC/dvb-firmware.git dvb-firmware.git
287
288 linux-firmware.git/WHENCE:
289 git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git linux-firmware.git
290
291 ${FW_DEB} fw: control.firmware linux-firmware.git/WHENCE dvb-firmware.git/README changelog.firmware fwlist-2.6.18-2-pve fwlist-2.6.24-12-pve fwlist-2.6.32-3-pve fwlist-2.6.32-4-pve fwlist-2.6.32-6-pve fwlist-2.6.32-13-pve fwlist-2.6.32-14-pve fwlist-2.6.32-20-pve fwlist-2.6.32-21-pve fwlist-3.10.0-3-pve fwlist-3.10.0-7-pve fwlist-3.10.0-8-pve fwlist-${KVNAME}
292 rm -rf fwdata
293 mkdir -p fwdata/lib/firmware
294 ./assemble-firmware.pl fwlist-${KVNAME} fwdata/lib/firmware
295 # include any files from older/newer kernels here
296 ./assemble-firmware.pl fwlist-2.6.18-2-pve fwdata/lib/firmware
297 ./assemble-firmware.pl fwlist-2.6.24-12-pve fwdata/lib/firmware
298 ./assemble-firmware.pl fwlist-2.6.32-3-pve fwdata/lib/firmware
299 ./assemble-firmware.pl fwlist-2.6.32-4-pve fwdata/lib/firmware
300 ./assemble-firmware.pl fwlist-2.6.32-6-pve fwdata/lib/firmware
301 ./assemble-firmware.pl fwlist-2.6.32-13-pve fwdata/lib/firmware
302 ./assemble-firmware.pl fwlist-2.6.32-14-pve fwdata/lib/firmware
303 ./assemble-firmware.pl fwlist-2.6.32-20-pve fwdata/lib/firmware
304 ./assemble-firmware.pl fwlist-2.6.32-21-pve fwdata/lib/firmware
305 ./assemble-firmware.pl fwlist-3.10.0-3-pve fwdata/lib/firmware
306 ./assemble-firmware.pl fwlist-3.10.0-7-pve fwdata/lib/firmware
307 ./assemble-firmware.pl fwlist-3.10.0-8-pve fwdata/lib/firmware
308 install -d fwdata/usr/share/doc/pve-firmware
309 cp linux-firmware.git/WHENCE fwdata/usr/share/doc/pve-firmware/README
310 install -d fwdata/usr/share/doc/pve-firmware/licenses
311 cp linux-firmware.git/LICEN[CS]E* fwdata/usr/share/doc/pve-firmware/licenses
312 install -D -m 0644 changelog.firmware fwdata/usr/share/doc/pve-firmware/changelog.Debian
313 gzip -9 fwdata/usr/share/doc/pve-firmware/changelog.Debian
314 echo "git clone git://git.proxmox.com/git/pve-kernel-2.6.32.git\\ngit checkout ${GITVERSION}" >fwdata/usr/share/doc/pve-firmware/SOURCE
315 install -d fwdata/DEBIAN
316 sed -e 's/@VERSION@/${FW_VER}-${FW_REL}/' <control.firmware >fwdata/DEBIAN/control
317 dpkg-deb --build fwdata ${FW_DEB}
318
319 .PHONY: upload
320 upload: ${DST_DEB} ${HDR_DEB} ${FW_DEB} ${PVE_DEB}
321 umount /pve/${RELEASE}; mount /pve/${RELEASE} -o rw
322 mkdir -p /pve/${RELEASE}/extra
323 mkdir -p /pve/${RELEASE}/install
324 rm -rf /pve/${RELEASE}/extra/${PACKAGE}_*.deb
325 rm -rf /pve/${RELEASE}/extra/${HDRPACKAGE}_*.deb
326 rm -rf /pve/${RELEASE}/extra/${PVEPKG}_*.deb
327 rm -rf /pve/${RELEASE}/extra/pve-firmware*.deb
328 rm -rf /pve/${RELEASE}/extra/Packages*
329 cp ${DST_DEB} ${FW_DEB} ${HDR_DEB} ${PVE_DEB} /pve/${RELEASE}/extra
330 cd /pve/${RELEASE}/extra; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
331 umount /pve/${RELEASE}; mount /pve/${RELEASE} -o ro
332
333 .PHONY: distclean
334 distclean: clean
335 rm -rf linux-firmware.git dvb-firmware.git ${KERNEL_SRC}.org
336
337 .PHONY: clean
338 clean:
339 rm -rf *~ .compile_mark ${KERNEL_CFG_ORG} ${KERNEL_SRC} ${KERNEL_SRC}.tmp ${KERNEL_SRC}.org orig tmp data proxmox-ve/data *.deb ${headers_tmp} fwdata fwlist.tmp *.ko fwlist-${KVNAME} ${ZFSDIR} ${SPLDIR} ${SPL_MODULES} ${ZFS_MODULES} hpsa.ko ${HPSADIR} ${DRBDDIR} drbd-9.0
340
341
342
343
344