summaryrefslogtreecommitdiffstats
path: root/compass/build/Makefile
diff options
context:
space:
mode:
authorchigang <chigang@huawei.com>2015-04-20 23:47:08 -0400
committerchigang <chigang@huawei.com>2015-04-20 23:54:11 -0400
commit80b8e7cfe6768f07c11fcf961f645eda8753bc22 (patch)
treeb9f2682ed7870587b743f53d26cb4e306092350f /compass/build/Makefile
parente1d29739ccbc6efc20f400636a211dae0e75bff4 (diff)
Create Compass build script.
Compass is a open source platform for deploying distributed systems, including OpenStack. It has a plugin structure for hardware discovery, os provisioning and package installation and configuration. As for OPNFV BGS experiment, we want to deploy it in automatic mechanism, so in this script we build the ISO including compass and other packages that could be used in later deployment. JIRA: BGS-40 Change-Id: Ie08ef0911ff0d8f23c2d18d929b34c204f1a7536 Signed-off-by: chigang <chigang@huawei.com>
Diffstat (limited to 'compass/build/Makefile')
-rwxr-xr-xcompass/build/Makefile117
1 files changed, 117 insertions, 0 deletions
diff --git a/compass/build/Makefile b/compass/build/Makefile
new file mode 100755
index 0000000..7448dc4
--- /dev/null
+++ b/compass/build/Makefile
@@ -0,0 +1,117 @@
+##############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# stefan.k.berg@ericsson.com
+# jonas.bjurel@ericsson.com
+# dradez@redhat.com
+# chigang@huawei.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+SHELL = /bin/bash
+############################################################################
+# BEGIN of variables to customize
+#
+#Input args
+export UNIT_TEST = FALSE
+export INTERACTIVE = TRUE
+export ISOSRC = file:$(shell pwd)/ubuntu
+export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC))
+export PRODNO = "OPNFV_BGS"
+export REVSTATE = "P0000"
+export RELEASE_DIR = $(shell pwd)/release
+
+# Note! Invoke with "make REVSTATE=RXXXX all" to make release build!
+# Invoke with ICOCACHE=/full/path/to/iso if cached ISO is in non-standard location.
+
+#Build variables
+export BUILD_BASE := $(shell pwd)
+export CACHE_DIR := $(BUILD_BASE)/cache
+export INSTALL_DIR := $(BUILD_BASE)
+export VERSION_FILE := $(BUILD_BASE)/.versions
+export TOPDIR := $(shell pwd)
+
+export OLDISO_DIR := $(TOPDIR)/oldiso
+export NEWISO_DIR := $(TOPDIR)/newiso
+export NEWIMAGE_DIR := $(TOPDIR)/newiso/image
+export NEWFILESYSTEM := $(TOPDIR)/newiso/filesystem
+export MANIFEST_DIR = $(shell find $(NEWISO_DIR) -name filesystem.manifest)
+export SQUASHFS_DIR = $(shell find $(NEWISO_DIR) -name filesystem.squashfs)
+export FSSIZE_DIR = $(shell find $(NEWISO_DIR) -name filesystem.size)
+
+#
+# END of variables to customize
+#############################################################################
+
+.PHONY: all
+all: iso
+ @echo "Versions of cached build results built by" $(shell hostname) "at" $(shell date -u) > $(VERSION_FILE)
+ @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE)
+ @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE)
+
+############################################################################
+# BEGIN of Include definitions
+#
+include config.mk
+include cache.mk
+#
+# END Include definitions
+#############################################################################
+
+.PHONY: prepare-cache
+prepare-cache:
+ @echo "prepare-cache to be done"
+
+.PHONY: mount-ubuntuiso
+mount-ubuntuiso:
+ @echo "===Mounting ubuntu ISO in $(OLDISO_DIR)"
+ -mkdir -p $(OLDISO_DIR) $(NEWIMAGE_DIR)
+ @fuseiso $(ISOCACHE)/*.iso $(OLDISO_DIR)
+ cp $(OLDISO_DIR)/. $(NEWIMAGE_DIR) -rp
+
+.PHONY: umount-ubuntuiso
+umount-ubuntuiso:
+ @set +e
+ @echo "===Unmounting ubuntu ISO from $(OLDISO_DIR)"
+ @fusermount -u $(OLDISO_DIR)
+ @set -e
+
+.PHONY: install-package
+install-package:
+ @echo "===uncompress file system to add new files"
+ @find $(NEWISO_DIR) -name "filesystem.squashfs" |xargs unsquashfs
+ @mv squashfs-root $(NEWFILESYSTEM)
+ cp -f /etc/resolv.conf $(NEWFILESYSTEM)/run/resolvconf/
+ cp /etc/hosts $(NEWFILESYSTEM)/etc/
+ cp $(INSTALL_DIR)/install.sh $(NEWFILESYSTEM)/
+ @echo "===install package on filesystem for newiso"
+ #@chroot $(NEWFILESYSTEM) sh ./install.sh
+ @chmod +w $(MANIFEST_DIR)
+ @chroot $(NEWFILESYSTEM) dpkg-query -W --showformat='$${Package} $${Version}\n' | tee ${MANIFEST_DIR}
+ @rm $(SQUASHFS_DIR)
+ @mksquashfs $(NEWFILESYSTEM) $(SQUASHFS_DIR)
+ @chmod +w $(FSSIZE_DIR)
+ cd $(NEWISO_DIR); \
+ (du -sx --block-size=1 $(NEWFILESYSTEM) | cut -f1 ) | tee ${FSSIZE_DIR}
+ cd $(NEWIMAGE_DIR); \
+ find . -type f -print0 | xargs -0 md5sum | grep -v "\./md5sum.txt" | tee ./md5sum.txt
+
+.PHONY: make-iso
+make-iso:
+ @echo "===Building OPNFV iso"
+ cd $(NEWIMAGE_DIR); \
+ mkisofs -r -V "OPNFV" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-14.04-amd64-opnfv.iso .
+
+.PHONY: build-clean
+build-clean:
+ -rm -Rf $(OLDISO_DIR)
+ -rm -Rf $(NEWISO_DIR)
+ -rm -Rf $(RELEASE_DIR)
+
+.PHONY: iso
+iso: build-clean mount-ubuntuiso umount-ubuntuiso install-package make-iso
+ -mkdir $(RELEASE_DIR)
+ @mv $(NEWISO_DIR)/*.iso $(RELEASE_DIR)
+ @printf "\n\nISO is built successfully!\n\n"