1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
13 ############################################################################
14 # BEGIN of variables to customize
17 export UNIT_TEST = FALSE
18 export USE_MASTER = ""
19 export INTERACTIVE = TRUE
20 export CENTDNLD = http://mirrors.cat.pdx.edu/centos/7.1.1503/isos/x86_64/CentOS-7-x86_64-DVD-1503-01.iso
21 export ISOSRC = file:$(shell pwd)/CentOS-7-x86_64-DVD-1503-01.iso
22 export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC))
23 export PRODNO = "OPNFV_BGS"
24 export REVSTATE = "0000"
25 export NEWISO = $(shell pwd)/release/OPNFV-CentOS-7-x86_64-${REVSTATE}.iso
26 export APEXRPM = $(shell pwd)/noarch/opnfv-apex-2.0-$(shell echo ${REVSTATE} | tr -d '_-').noarch.rpm
28 # Note! Invoke with "make REVSTATE=RXXXX all" to make release build!
29 # Invoke with ICOCACHE=/full/path/to/iso if cached ISO is in non-standard location.
32 export BUILD_BASE := $(shell pwd)
33 export CACHE_DIR := $(BUILD_BASE)/cache
34 export VERSION_FILE := $(BUILD_BASE)/.versions
35 export TOPDIR := $(shell pwd)
37 CENTDIR := $(TOPDIR)/centiso
39 # END of variables to customize
40 #############################################################################
42 SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
47 @echo "Versions of cached build results built by" $(shell hostname) "at" $(shell date -u) > $(VERSION_FILE)
48 @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE)
49 @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE)
51 ############################################################################
52 # BEGIN of Include definitions
57 # END Include definitions
58 #############################################################################
61 test -s $(ISOCACHE) || { wget -nv $(CENTDNLD) ; }
63 .PHONY: mount-centiso umount-centiso
64 mount-centiso: $(ISOCACHE)
65 @echo "Mounting CentOS ISO in $(CENTDIR)"
67 @fuseiso $(ISOCACHE) $(CENTDIR)
71 @echo "Unmounting CentOS ISO from $(CENTDIR)"
72 @fusermount -u $(CENTDIR)
76 .PHONY: build-clean $(SUBCLEAN)
77 build-clean: instack-clean $(SUBCLEAN)
83 .PHONY: clean $(SUBCLEAN)
84 clean: clean-cache build-clean $(SUBCLEAN)
89 @rm -f $(BUILD_BASE)/.versions
92 $(MAKE) -C $* -f Makefile clean
96 @rm -f build/opnfv-apex.tar.gz
100 pushd ../ && git archive --format=tar --prefix=opnfv-apex-2.0/ HEAD > build/opnfv-apex.tar
101 tar -u --xform="s:instack.qcow2:opnfv-apex-2.0/build/instack.qcow2:" --file=opnfv-apex.tar instack.qcow2
102 tar -u --xform="s:instack.xml:opnfv-apex-2.0/build/instack.xml:" --file=opnfv-apex.tar instack.xml
103 qemu-img create -f qcow2 baremetalbrbm_0.qcow2 40G
104 tar -u --xform="s:baremetalbrbm_0.qcow2:opnfv-apex-2.0/build/baremetalbrbm_0.qcow2:" --file=opnfv-apex.tar baremetalbrbm_0.qcow2
105 tar -u --xform="s:baremetalbrbm_0.xml:opnfv-apex-2.0/build/baremetalbrbm_0.xml:" --file=opnfv-apex.tar baremetalbrbm_0.xml
106 qemu-img create -f qcow2 baremetalbrbm_1.qcow2 40G
107 tar -u --xform="s:baremetalbrbm_1.qcow2:opnfv-apex-2.0/build/baremetalbrbm_1.qcow2:" --file=opnfv-apex.tar baremetalbrbm_1.qcow2
108 tar -u --xform="s:baremetalbrbm_1.xml:opnfv-apex-2.0/build/baremetalbrbm_1.xml:" --file=opnfv-apex.tar baremetalbrbm_1.xml
109 tar -u --xform="s:brbm.xml:opnfv-apex-2.0/build/brbm.xml:" --file=opnfv-apex.tar brbm.xml
110 tar -u --xform="s:instackenv-virt.json:opnfv-apex-2.0/build/instackenv-virt.json:" --file=opnfv-apex.tar instackenv-virt.json
111 tar -u --xform="s:stack/deploy-ramdisk-ironic.initramfs:opnfv-apex-2.0/build/stack/deploy-ramdisk-ironic.initramfs:" --file=opnfv-apex.tar stack/deploy-ramdisk-ironic.initramfs
112 tar -u --xform="s:stack/deploy-ramdisk-ironic.kernel:opnfv-apex-2.0/build/stack/deploy-ramdisk-ironic.kernel:" --file=opnfv-apex.tar stack/deploy-ramdisk-ironic.kernel
113 tar -u --xform="s:stack/ironic-python-agent.initramfs:opnfv-apex-2.0/build/stack/ironic-python-agent.initramfs:" --file=opnfv-apex.tar stack/ironic-python-agent.initramfs
114 tar -u --xform="s:stack/ironic-python-agent.kernel:opnfv-apex-2.0/build/stack/ironic-python-agent.kernel:" --file=opnfv-apex.tar stack/ironic-python-agent.kernel
115 tar -u --xform="s:stack/ironic-python-agent.vmlinuz:opnfv-apex-2.0/build/stack/ironic-python-agent.vmlinuz:" --file=opnfv-apex.tar stack/ironic-python-agent.vmlinuz
116 tar -u --xform="s:stack/overcloud-full.initrd:opnfv-apex-2.0/build/stack/overcloud-full.initrd:" --file=opnfv-apex.tar stack/overcloud-full.initrd
117 tar -u --xform="s:stack/overcloud-full.qcow2:opnfv-apex-2.0/build/stack/overcloud-full.qcow2:" --file=opnfv-apex.tar stack/overcloud-full.qcow2
118 tar -u --xform="s:stack/overcloud-full.vmlinuz:opnfv-apex-2.0/build/stack/overcloud-full.vmlinuz:" --file=opnfv-apex.tar stack/overcloud-full.vmlinuz
119 gzip -f opnfv-apex.tar
120 rpmbuild -ba opnfv-apex.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(REVSTATE) | tr -d '_-')"
123 instack: instack.qcow2
126 @./instack.sh $(USE_MASTER)
128 .PHONY: instack-clean
130 rm -f instackenv-virt.json
131 rm -f baremetalbrbm_0.xml
132 rm -f baremetalbrbm_1.xml
139 iso: build-clean instack.qcow2 rpm $(ISOCACHE)
140 @mkdir centos release
141 cd centos && bsdtar -xf ../$(shell basename $(ISOSRC))
142 # modify the installer iso's contents
143 @cp -f isolinux.cfg centos/isolinux/isolinux.cfg
144 @cp $(APEXRPM) centos/Packages
145 # regenerate yum repo data
146 @echo "Generating new yum metadata"
147 createrepo --update -g ../c7-opnfv-x86_64-comps.xml centos
149 @echo "Building OPNFV iso"
150 mkisofs -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -V "OPNFV CentOS 7 x86_64" -R -J -v -T -o $(NEWISO) centos
151 @printf "\n\nISO is built at $(NEWISO)\n\n"