]> git.proxmox.com Git - pve-kernel-jessie.git/blob - Makefile
create fireware 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=4
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-${KERNEL_VER}
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 sed -e 's/@KERNEL_VER@/${KERNEL_VER}/' <proxmox-ve/postinst >proxmox-ve/data/DEBIAN/postinst
96 chmod 0755 proxmox-ve/data/DEBIAN/postinst
97 echo "git clone git://git.proxmox.com/git/pve-kernel-3.10.0.git\\ngit checkout ${GITVERSION}" > proxmox-ve/data/usr/share/doc/${PVEPKG}/SOURCE
98 install -m 0644 proxmox-ve/copyright proxmox-ve/data/usr/share/doc/${PVEPKG}
99 install -m 0644 proxmox-ve/changelog.Debian proxmox-ve/data/usr/share/doc/${PVEPKG}
100 gzip --best proxmox-ve/data/usr/share/doc/${PVEPKG}/changelog.Debian
101 dpkg-deb --build proxmox-ve/data ${PVE_DEB}
102
103 .PHONY: download
104 download:
105 fixmestophere
106
107 check_gcc:
108 ifeq ($(CC), cc)
109 gcc --version|grep "4\.9" || false
110 else
111 $(CC) --version|grep "4\.9" || false
112 endif
113
114 ${DST_DEB}: data control.in prerm.in postinst.in postrm.in copyright changelog.Debian
115 mkdir -p data/DEBIAN
116 sed -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@KVNAME@/${KVNAME}/' -e 's/@PKGREL@/${PKGREL}/' <control.in >data/DEBIAN/control
117 sed -e 's/@@KVNAME@@/${KVNAME}/g' <prerm.in >data/DEBIAN/prerm
118 chmod 0755 data/DEBIAN/prerm
119 sed -e 's/@@KVNAME@@/${KVNAME}/g' <postinst.in >data/DEBIAN/postinst
120 chmod 0755 data/DEBIAN/postinst
121 sed -e 's/@@KVNAME@@/${KVNAME}/g' <postrm.in >data/DEBIAN/postrm
122 chmod 0755 data/DEBIAN/postrm
123 install -D -m 644 copyright data/usr/share/doc/${PACKAGE}/copyright
124 install -D -m 644 changelog.Debian data/usr/share/doc/${PACKAGE}/changelog.Debian
125 echo "git clone git://git.proxmox.com/git/pve-kernel-3.2.0.git\\ngit checkout ${GITVERSION}" > data/usr/share/doc/${PACKAGE}/SOURCE
126 gzip -f --best data/usr/share/doc/${PACKAGE}/changelog.Debian
127 rm -f data/lib/modules/${KVNAME}/source
128 rm -f data/lib/modules/${KVNAME}/build
129 dpkg-deb --build data ${DST_DEB}
130 lintian ${DST_DEB}
131
132
133 fwlist-${KVNAME}: data
134 ./find-firmware.pl data/lib/modules/${KVNAME} >fwlist.tmp
135 mv fwlist.tmp $@
136
137 # fixme: bnx2.ko cnic.ko bnx2x.ko
138 data: .compile_mark ${SPL_MODULES} ${ZFS_MODULES} ${DRBD_MODULES}
139 rm -rf data tmp; mkdir -p tmp/lib/modules/${KVNAME}
140 mkdir tmp/boot
141 install -m 644 ${KERNEL_SRC}/.config tmp/boot/config-${KVNAME}
142 install -m 644 ${KERNEL_SRC}/System.map tmp/boot/System.map-${KVNAME}
143 install -m 644 ${KERNEL_SRC}/arch/x86_64/boot/bzImage tmp/boot/vmlinuz-${KVNAME}
144 cd ${KERNEL_SRC}; make INSTALL_MOD_PATH=../tmp/ modules_install
145 # install zfs drivers
146 install -d -m 0755 tmp/lib/modules/${KVNAME}/zfs
147 install -m 644 ${SPL_MODULES} ${ZFS_MODULES} tmp/lib/modules/${KVNAME}/zfs
148 # install drbd9
149 install -m 644 ${DRBD_MODULES} tmp/lib/modules/${KVNAME}/kernel/drivers/block/drbd
150 # remove firmware
151 rm -rf tmp/lib/firmware
152 # strip debug info
153 find tmp/lib/modules -name \*.ko -print | while read f ; do strip --strip-debug "$$f"; done
154 # finalize
155 depmod -b tmp/ ${KVNAME}
156 mv tmp data
157
158 PVE_CONFIG_OPTS= \
159 -m CONFIG_CEPH_FS \
160 -m CONFIG_BLK_DEV_NBD \
161 -m CONFIG_BLK_DEV_RBD \
162 -m CONFIG_BCACHE \
163 -m CONFIG_JFS_FS \
164 -m CONFIG_HFS_FS \
165 -m CONFIG_HFSPLUS_FS \
166 -e CONFIG_BRIDGE \
167 -e CONFIG_BRIDGE_NETFILTER \
168 -e CONFIG_BLK_DEV_SD \
169 -e CONFIG_BLK_DEV_SR \
170 -e CONFIG_BLK_DEV_DM \
171 -d CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND \
172 -e CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE \
173 --set-val CONFIG_BLK_DEV_LOOP_MIN_COUNT 255 \
174 -d CONFIG_MODULE_SIG \
175 -d CONFIG_MEMCG_DISABLED \
176 -e CONFIG_MEMCG_SWAP_ENABLED \
177 -e CONFIG_MEMCG_KMEM \
178 -d CONFIG_DEFAULT_CFQ \
179 --set-str CONFIG_DEFAULT_IOSCHED deadline \
180 -d CONFIG_DEFAULT_SECURITY_DAC \
181 -e CONFIG_DEFAULT_SECURITY_APPARMOR \
182 --set-str CONFIG_DEFAULT_SECURITY apparmor
183
184 .compile_mark: ${KERNEL_SRC}/README ${KERNEL_CFG_ORG}
185 cp ${KERNEL_CFG_ORG} ${KERNEL_SRC}/.config
186 cd ${KERNEL_SRC}; ./scripts/config ${PVE_CONFIG_OPTS}
187 cd ${KERNEL_SRC}; make oldconfig
188 cd ${KERNEL_SRC}; make -j 8
189 touch $@
190
191 ${KERNEL_SRC}/README: ${KERNEL_SRC}.org/README
192 rm -rf ${KERNEL_SRC}
193 cp -a ${KERNEL_SRC}.org ${KERNEL_SRC}
194 cd ${KERNEL_SRC}; patch -p1 <../bridge-patch.diff
195 #cd ${KERNEL_SRC}; patch -p1 <../bridge-forward-ipv6-neighbor-solicitation.patch
196 #cd ${KERNEL_SRC}; patch -p1 <../add-empty-ndo_poll_controller-to-veth.patch
197 #cd ${KERNEL_SRC}; patch -p1 <../override_for_missing_acs_capabilities.patch
198 #cd ${KERNEL_SRC}; patch -p1 <../vhost-net-extend-device-allocation-to-vmalloc.patch
199 sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'
200 touch $@
201
202 ${KERNEL_SRC}.org/README ${KERNEL_CFG_ORG}: ${KERNELSRCTAR} ${KERNELDEBTAR}
203 rm -rf ${KERNEL_SRC}.org ${KERNEL_SRC}.tmp orig
204 mkdir ${KERNEL_SRC}.tmp
205 tar xf ${KERNELDEBTAR} -C ${KERNEL_SRC}.tmp
206 cd ${KERNEL_SRC}.tmp; ./debian/rules orig
207 cd ${KERNEL_SRC}.tmp; ./debian/rules setup
208 cp ${KERNEL_SRC}.tmp/debian/build/build_amd64_none_amd64/.config ${KERNEL_CFG_ORG}
209 rm -rf orig
210 rm -rf ${KERNEL_SRC}.tmp/debian
211 mv ${KERNEL_SRC}.tmp ${KERNEL_SRC}.org
212 touch $@
213
214 ${SPL_MODULES}: .compile_mark ${SPLSRC}
215 rm -rf ${SPLDIR}
216 tar xf ${SPLSRC}
217 cd ${SPLDIR}; ./autogen.sh
218 cd ${SPLDIR}; ./configure --with-config=kernel --with-linux=${TOP}/${KERNEL_SRC} --with-linux-obj=${TOP}/${KERNEL_SRC}
219 cd ${SPLDIR}; make
220 cp ${SPLDIR}/module/spl/spl.ko spl.ko
221 cp ${SPLDIR}/module/splat/splat.ko splat.ko
222
223 ${ZFS_MODULES}: .compile_mark ${ZFSSRC}
224 rm -rf ${ZFSDIR}
225 tar xf ${ZFSSRC}
226 cd ${ZFSDIR}; ./autogen.sh
227 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}
228 cd ${ZFSDIR}; make
229 cp ${ZFSDIR}/module/zfs/zfs.ko zfs.ko
230 cp ${ZFSDIR}/module/avl/zavl.ko zavl.ko
231 cp ${ZFSDIR}/module/nvpair/znvpair.ko znvpair.ko
232 cp ${ZFSDIR}/module/unicode/zunicode.ko zunicode.ko
233 cp ${ZFSDIR}/module/zcommon/zcommon.ko zcommon.ko
234 cp ${ZFSDIR}/module/zpios/zpios.ko zpios.ko
235
236 .PHONY: update-drbd
237 update-drbd:
238 rm -rf ${DRBDDIR} ${DRBDSRC} drbd-9.0
239 git clone --recursive git://git.drbd.org/drbd-9.0
240 cd drbd-9.0; make tarball
241 mv drbd-9.0/${DRBDSRC} ${DRBDSRC}
242
243 .PHONY: drbd
244 drbd ${DRBD_MODULES}: .compile_mark ${DRBDSRC}
245 rm -rf ${DRBDDIR}
246 tar xzf ${DRBDSRC}
247 mkdir -p /lib/modules/${KVNAME}
248 ln -sf ${TOP}/${KERNEL_SRC} /lib/modules/${KVNAME}/build
249 cd ${DRBDDIR}; make KVER=${KVNAME}
250 mv ${DRBDDIR}/drbd/drbd.ko drbd.ko
251 mv ${DRBDDIR}/drbd/drbd_transport_tcp.ko drbd_transport_tcp.ko
252
253 #iscsi_trgt.ko: .compile_mark ${ISCSITARGETSRC}
254 # rm -rf ${ISCSITARGETDIR}
255 # tar xf ${ISCSITARGETSRC}
256 # cd ${ISCSITARGETDIR}; make KSRC=${TOP}/${KERNEL_SRC}
257 # cp ${ISCSITARGETDIR}/kernel/iscsi_trgt.ko iscsi_trgt.ko
258
259 headers_tmp := $(CURDIR)/tmp-headers
260 headers_dir := $(headers_tmp)/usr/src/linux-headers-${KVNAME}
261
262 ${HDR_DEB} hdr: .compile_mark headers-control.in headers-postinst.in
263 rm -rf $(headers_tmp)
264 install -d $(headers_tmp)/DEBIAN $(headers_dir)/include/
265 sed -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@KVNAME@/${KVNAME}/' -e 's/@PKGREL@/${PKGREL}/' <headers-control.in >$(headers_tmp)/DEBIAN/control
266 sed -e 's/@@KVNAME@@/${KVNAME}/g' <headers-postinst.in >$(headers_tmp)/DEBIAN/postinst
267 chmod 0755 $(headers_tmp)/DEBIAN/postinst
268 install -D -m 644 copyright $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/copyright
269 install -D -m 644 changelog.Debian $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/changelog.Debian
270 echo "git clone git://git.proxmox.com/git/pve-kernel-3.10.0.git\\ngit checkout ${GITVERSION}" > $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/SOURCE
271 gzip -f --best $(headers_tmp)/usr/share/doc/${HDRPACKAGE}/changelog.Debian
272 install -m 0644 ${KERNEL_SRC}/.config $(headers_dir)
273 install -m 0644 ${KERNEL_SRC}/Module.symvers $(headers_dir)
274 cd ${KERNEL_SRC}; find . -path './debian/*' -prune -o -path './include/*' -prune -o -path './Documentation' -prune \
275 -o -path './scripts' -prune -o -type f \
276 \( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
277 -name '*.sh' -o -name '*.pl' \) \
278 -print | cpio -pd --preserve-modification-time $(headers_dir)
279 cd ${KERNEL_SRC}; cp -a include scripts $(headers_dir)
280 cd ${KERNEL_SRC}; (find arch/x86 -name include -type d -print | \
281 xargs -n1 -i: find : -type f) | \
282 cpio -pd --preserve-modification-time $(headers_dir)
283 dpkg-deb --build $(headers_tmp) ${HDR_DEB}
284 #lintian ${HDR_DEB}
285
286 dvb-firmware.git/README:
287 git clone https://github.com/OpenELEC/dvb-firmware.git dvb-firmware.git
288
289 linux-firmware.git/WHENCE:
290 git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git linux-firmware.git
291
292 ${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}
293 rm -rf fwdata
294 mkdir -p fwdata/lib/firmware
295 ./assemble-firmware.pl fwlist-${KVNAME} fwdata/lib/firmware
296 # include any files from older/newer kernels here
297 ./assemble-firmware.pl fwlist-2.6.18-2-pve fwdata/lib/firmware
298 ./assemble-firmware.pl fwlist-2.6.24-12-pve fwdata/lib/firmware
299 ./assemble-firmware.pl fwlist-2.6.32-3-pve fwdata/lib/firmware
300 ./assemble-firmware.pl fwlist-2.6.32-4-pve fwdata/lib/firmware
301 ./assemble-firmware.pl fwlist-2.6.32-6-pve fwdata/lib/firmware
302 ./assemble-firmware.pl fwlist-2.6.32-13-pve fwdata/lib/firmware
303 ./assemble-firmware.pl fwlist-2.6.32-14-pve fwdata/lib/firmware
304 ./assemble-firmware.pl fwlist-2.6.32-20-pve fwdata/lib/firmware
305 ./assemble-firmware.pl fwlist-2.6.32-21-pve fwdata/lib/firmware
306 ./assemble-firmware.pl fwlist-3.10.0-3-pve fwdata/lib/firmware
307 ./assemble-firmware.pl fwlist-3.10.0-7-pve fwdata/lib/firmware
308 ./assemble-firmware.pl fwlist-3.10.0-8-pve fwdata/lib/firmware
309 install -d fwdata/usr/share/doc/pve-firmware
310 cp linux-firmware.git/WHENCE fwdata/usr/share/doc/pve-firmware/README
311 install -d fwdata/usr/share/doc/pve-firmware/licenses
312 cp linux-firmware.git/LICEN[CS]E* fwdata/usr/share/doc/pve-firmware/licenses
313 install -D -m 0644 changelog.firmware fwdata/usr/share/doc/pve-firmware/changelog.Debian
314 gzip -9 fwdata/usr/share/doc/pve-firmware/changelog.Debian
315 echo "git clone git://git.proxmox.com/git/pve-kernel-2.6.32.git\\ngit checkout ${GITVERSION}" >fwdata/usr/share/doc/pve-firmware/SOURCE
316 install -d fwdata/DEBIAN
317 sed -e 's/@VERSION@/${FW_VER}-${FW_REL}/' <control.firmware >fwdata/DEBIAN/control
318 dpkg-deb --build fwdata ${FW_DEB}
319
320 .PHONY: upload
321 upload: ${DST_DEB} ${HDR_DEB} ${FW_DEB} ${PVE_DEB}
322 umount /pve/${RELEASE}; mount /pve/${RELEASE} -o rw
323 mkdir -p /pve/${RELEASE}/extra
324 mkdir -p /pve/${RELEASE}/install
325 rm -rf /pve/${RELEASE}/extra/${PACKAGE}_*.deb
326 rm -rf /pve/${RELEASE}/extra/${HDRPACKAGE}_*.deb
327 rm -rf /pve/${RELEASE}/extra/${PVEPKG}_*.deb
328 rm -rf /pve/${RELEASE}/extra/pve-firmware*.deb
329 rm -rf /pve/${RELEASE}/extra/Packages*
330 cp ${DST_DEB} ${FW_DEB} ${HDR_DEB} ${PVE_DEB} /pve/${RELEASE}/extra
331 cd /pve/${RELEASE}/extra; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
332 umount /pve/${RELEASE}; mount /pve/${RELEASE} -o ro
333
334 .PHONY: distclean
335 distclean: clean
336 rm -rf linux-firmware.git dvb-firmware.git ${KERNEL_SRC}.org
337
338 .PHONY: clean
339 clean:
340 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
341
342
343
344
345