From 271dc36f33e1a2e8774167cd592639fbf98597c0 Mon Sep 17 00:00:00 2001 From: Zhiguo Deng Date: Wed, 10 May 2017 23:09:42 -0400 Subject: [PATCH] Add zipl element as s390x architecture bootloader s390x architecture uses zipl as bootloader. When used in combination with the vm element it replaces the existing bootloader element. It's mandatory for s390x vm images. Use cases --------- * Allow users to create s390x images that run on nova with s390x libvirt/kvm backend * Building nodepool images for s390x third party CI Supported Distros ----------------- The following listing shows all Distros that officially support s390x and how those Distros are supported in DIB with this patch. * SLES - not supported (SLES is not supported in DIB) * RHEL - not suppoprted (RHEL is not supported as KVM guest on s390x, therefore there's no rhel7 qcow image for s390x available like it is for other archictectures) * Ubuntu - supported Ubuntu images can for example be built using the following commands: $ disk-image-create ubuntu-minimal zipl vm $ disk-image-create ubuntu-minimal zipl $ disk-image-create ubuntu zipl vm Testing ------- Cross architecture building of s390x images is not supported so far. The plan is to set up a ThirdParty CI that builds the image for s390x and provides the logs. Co-Authored-By: Andreas Scheuring Co-Authored-By: Holger Smolinsky Co-Authored-By: Zhiguo Deng Co-Authored-By: Arne Recknagel Closes-Bug: #1730641 Change-Id: I576e7edda68da12e97c60af38f457915efe7b934 --- diskimage_builder/elements/zipl/README.rst | 18 +++++ diskimage_builder/elements/zipl/element-deps | 1 + .../elements/zipl/element-provides | 1 + .../environment.d/10-zipl-default-cmdline | 1 + .../elements/zipl/finalise.d/50-zipl | 70 +++++++++++++++++++ .../elements/zipl/package-installs.yaml | 4 ++ .../elements/zipl/pre-install.d/kernel_config | 32 +++++++++ doc/source/user_guide/building_an_image.rst | 8 +++ 8 files changed, 135 insertions(+) create mode 100644 diskimage_builder/elements/zipl/README.rst create mode 100644 diskimage_builder/elements/zipl/element-deps create mode 100644 diskimage_builder/elements/zipl/element-provides create mode 100644 diskimage_builder/elements/zipl/environment.d/10-zipl-default-cmdline create mode 100755 diskimage_builder/elements/zipl/finalise.d/50-zipl create mode 100644 diskimage_builder/elements/zipl/package-installs.yaml create mode 100755 diskimage_builder/elements/zipl/pre-install.d/kernel_config diff --git a/diskimage_builder/elements/zipl/README.rst b/diskimage_builder/elements/zipl/README.rst new file mode 100644 index 00000000..46c99f52 --- /dev/null +++ b/diskimage_builder/elements/zipl/README.rst @@ -0,0 +1,18 @@ +========== +zipl +========== + +Zipl is the bootloader for s390x. + +This element installs zipl on the base device holding the /boot directory on the system. +It's mandatory for building s390x images. It replaces the `bootloader` element +(which would install grub2 by default). + +This element has been tested with `ubuntu` and `ubuntu-minimal` distro. + +Arguments +========= + +* ``DIB_ZIPL_DEFAULT_CMDLINE`` sets the CMDLINE parameters that + are appended to the zipl.conf parameter configuration. It defaults to + 'LANG=en_US.UTF-8 console=ttyS0 console=ttyS1' diff --git a/diskimage_builder/elements/zipl/element-deps b/diskimage_builder/elements/zipl/element-deps new file mode 100644 index 00000000..7076aba9 --- /dev/null +++ b/diskimage_builder/elements/zipl/element-deps @@ -0,0 +1 @@ +package-installs diff --git a/diskimage_builder/elements/zipl/element-provides b/diskimage_builder/elements/zipl/element-provides new file mode 100644 index 00000000..54960172 --- /dev/null +++ b/diskimage_builder/elements/zipl/element-provides @@ -0,0 +1 @@ +bootloader diff --git a/diskimage_builder/elements/zipl/environment.d/10-zipl-default-cmdline b/diskimage_builder/elements/zipl/environment.d/10-zipl-default-cmdline new file mode 100644 index 00000000..ea1c1529 --- /dev/null +++ b/diskimage_builder/elements/zipl/environment.d/10-zipl-default-cmdline @@ -0,0 +1 @@ +export DIB_ZIPL_DEFAULT_CMDLINE=${DIB_ZIPL_DEFAULT_CMDLINE:-"LANG=en_US.UTF-8 console=ttyS0 console=ttyS1"} diff --git a/diskimage_builder/elements/zipl/finalise.d/50-zipl b/diskimage_builder/elements/zipl/finalise.d/50-zipl new file mode 100755 index 00000000..4f9499ed --- /dev/null +++ b/diskimage_builder/elements/zipl/finalise.d/50-zipl @@ -0,0 +1,70 @@ +#!/bin/bash +# Copyright (c) 2017 IBM Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# +# See the License for the specific language governing permissions and +# limitations under the License. + +# Configure zipl. + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +# get the device containing the /boot directory +base_device=`df /boot --output=source | grep "/dev/*"` + +cat > /lib/s390-tools/zipl_helper.loop < /etc/zipl.conf <>"$KERNEL_CONF_FILE" diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst index 7be64996..aaf63416 100644 --- a/doc/source/user_guide/building_an_image.rst +++ b/doc/source/user_guide/building_an_image.rst @@ -668,3 +668,11 @@ Typically ``ppc64el`` refers to a ``.deb`` based distribution architecture, and ``ppc64le`` refers to a ``.rpm`` based distribution. Regardless of the distribution the kernel architecture is always ``ppc64le``. + +Notes about s390x (z Systems) Architecture +++++++++++++++++++++++++++++++++++++++++++ + +Images for s390x can only be build on s390x hosts. Trying to build +it with the architecture override on other architecture will +cause the build to fail. +