aboutsummaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/cross-bootstrap/0004-post-scripts-Enable-systemd-binfmt-for-first-boot.patch
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2016-10-01 13:18:11 +0200
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2016-10-09 16:33:43 +0200
commit42f8585ebb8fffad19a89314659ab9129176c3e9 (patch)
treee2cf6a4797bcbd036e080541cc3925f8b209549b /patches/opnfv-fuel/cross-bootstrap/0004-post-scripts-Enable-systemd-binfmt-for-first-boot.patch
parent6f3a054fc95622f0c002f72c0fac6074bb36c36f (diff)
build: Rework patch mechanism for Fuel submodules
While refactoring the patching mechanism, take care of: - Sync submodule handling with Fuel@OPFNV; - build: Investigate/prepare for moving patches to Fuel@OPNFV; - build: Investigate divergent fuel-mirror; - ISO build: cacheid for Fuel comps should not depend on Armband git commit; CHANGE: Rename/shuffle patches while grouping them in "features", preparing for upstreaming them to Fuel@OPNFV and beyond. CHANGE: Allow linking patches for better representing the dependency between one patch and different features. e.g. 0001-Add-arch-to-nailgun-release-and-target-image.patch: - part of `multiarch-fuel`, because it extends Fuel; - part of `direct-kernel-boot`, as arch is required for that; - part of `cross-bootstrap`, target image is arch-dependent; NOTE: Patch links are not staged to Fuel@OPNFV, they only serve as markers that a specific patch is part of a feature. CHANGE: Kill all Fuel component submodules, now handled in Fuel@OPNFV: - fuel-agent - fuel-astute - fuel-library - fuel-mirror - fuel-nailgun-agent - fuel-web CHANGE: Move armband-fuel-config.mk to armband git root. FIXME: m1.micro-Increase-profile-RAM-size-to-128MB.patch is NOT part of `cross-bootstrap` feature, but patch context says so ... FIXME: 0001-Add-arm64-deb-repositories-setup.patch is broken at `make patches-export` by removing spaces at EOL. v2 -> v3: * Phony patch support (links to show a patch belongs to a feature); * Updated README.md v3 -> v7: * Re-export Fuel submodules & plugins patches (update patch context); * Update Cavium mail addresses (s/caviumnetworks.com/cavium.com/); * Ignore submodule changes; * Add armband git repo info to gitinfo_fuel.txt at build time; Implements: ARMBAND-136 Closes-bug: ARMBAND-95 Closes-bug: ARMBAND-93 Closes-bug: ARMBAND-92 Change-Id: I1a236d9f43b2e6dca22055911f696b43c22b5973 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'patches/opnfv-fuel/cross-bootstrap/0004-post-scripts-Enable-systemd-binfmt-for-first-boot.patch')
-rw-r--r--patches/opnfv-fuel/cross-bootstrap/0004-post-scripts-Enable-systemd-binfmt-for-first-boot.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/patches/opnfv-fuel/cross-bootstrap/0004-post-scripts-Enable-systemd-binfmt-for-first-boot.patch b/patches/opnfv-fuel/cross-bootstrap/0004-post-scripts-Enable-systemd-binfmt-for-first-boot.patch
new file mode 100644
index 00000000..26b898fe
--- /dev/null
+++ b/patches/opnfv-fuel/cross-bootstrap/0004-post-scripts-Enable-systemd-binfmt-for-first-boot.patch
@@ -0,0 +1,94 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Thu, 9 Jun 2016 19:46:56 +0200
+Subject: [PATCH] post-scripts: Enable systemd-binfmt for first boot.
+
+IMPORTANT:
+This commit introduces the following file on Fuel Master,
+containing the list of arch supported for target nodes:
+</etc/fuel_openstack_arch>.
+
+This file is created AFTER pre.d OPNFV scripts are ran, also by
+bootstrap_admin_node.sh, BEFORE the post.d scripts are executed.
+NOTE: Arch format is the same used by dpkg (e.g.: "amd64 arm64")
+
+Based on the number of foreign architectures we should support
+(the list of archs in /etc/fuel_openstack_arch minus native arch),
+we determine whether cross-builds are expected, in which case
+binfmt support should be functional during first Fuel Master boot.
+
+Since systemd-binfmt service has a series of preconditions for
+starting, which are tested early during first boot, some of them
+are NOT YET true (e.g. no binfmt handlers are present before
+qemu-user-static package is installed), so the service is not
+automatically started. Of course, this only affects the first boot.
+
+Finally, this commit adds an OPNFV post-install script in
+/opt/opnfv/bootstrap/post.d, which starts systemd-binfmt service.
+---
+ .../post-scripts/80_prepare_cross_builds.sh | 32 ++++++++++++++++++++++
+ ...PNFV-Additions-to-bootstrap_admin_node.sh.patch | 13 +++++++++
+ 2 files changed, 45 insertions(+)
+ create mode 100755 build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh
+
+diff --git a/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh b/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh
+new file mode 100755
+index 0000000..01eb2e2
+--- /dev/null
++++ b/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh
+@@ -0,0 +1,32 @@
++#/bin/sh
++##############################################################################
++# Copyright (c) 2016 Enea AB and others.
++# Alexandru.Avadanii@enea.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
++##############################################################################
++
++echo "Preparing for cross-building bootstrap/target images"
++
++# Fmt handlers are set up by qemu-user-static (after systemd-binfmt
++# prerequisites are checked during first boot of Fuel Master node).
++
++# Cross-building support provides dpkg, as a fuel-agent dependency
++if which dpkg > /dev/null 2>&1; then
++ # /etc/fuel_openstack_arch is created by bootstrap_admin_node.sh
++ FOREIGN_ARCH_CNT=$(sed -e "s/$(dpkg --print-architecture)//" \
++ /etc/fuel_openstack_arch | wc -w)
++ if [ ${FOREIGN_ARCH_CNT} -gt 0 ]; then
++ # If no fmt handlers are configured, the service is not started,
++ # so request it explicitly (only necessary for the first boot).
++ systemctl start systemd-binfmt
++ if [ $? -ne 0 ]; then
++ echo "Error starting systemd-binfmt!"
++ exit 1
++ fi
++ fi
++fi
++
++echo "Done preparing cross-building"
+diff --git a/build/f_repos/patch/fuel-main/0001-OPNFV-Additions-to-bootstrap_admin_node.sh.patch b/build/f_repos/patch/fuel-main/0001-OPNFV-Additions-to-bootstrap_admin_node.sh.patch
+index 12d0dfb..81d196b 100644
+--- a/build/f_repos/patch/fuel-main/0001-OPNFV-Additions-to-bootstrap_admin_node.sh.patch
++++ b/build/f_repos/patch/fuel-main/0001-OPNFV-Additions-to-bootstrap_admin_node.sh.patch
+@@ -25,6 +25,19 @@ index 3197c91..db3123d 100755
+ bs_done_message="Default bootstrap image building done. Now you can boot new \
+ nodes over PXE, they will be discovered and become available for installing \
+ OpenStack on them"
++@@ -239,6 +239,12 @@
++ # /etc/fuel_openstack_version is provided by 'fuel-openstack-metadata' package
++ OPENSTACK_VERSION=$(cat /etc/fuel_openstack_version)
++
+++# FIXME(armband): This part might be moved to an earlier stage later
+++# /etc/fuel_openstack_arch is constructed based on local mirror metadata
+++grep -oP "^Architectures: \K.*$" \
+++ ${wwwdir}/${OPENSTACK_VERSION}/ubuntu/x86_64/dists/mos${FUEL_RELEASE}/Release > \
+++ /etc/fuel_openstack_arch
+++
++ # We do not ship debian-installer kernel and initrd on ISO.
++ # But we still need to be able to create ubuntu cobbler distro
++ # which requires kernel and initrd to be available. So, we
+ @@ -339,8 +339,22 @@ fuelmenu --save-only --iface=$ADMIN_INTERFACE || fail
+ set +x
+ echo "Done!"