summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-12-01 02:35:58 +0000
committerGerrit Code Review <review@openstack.org>2017-12-01 02:35:58 +0000
commit7beb27ca30fd165db60c294f6640f1f68c5ecb09 (patch)
treeb4fc2ef63d041fb281729cad7f68c550ca9f92a1
parent6ab9655ca341953ac85c045c9c8ec2d4c4b771db (diff)
parent271dc36f33e1a2e8774167cd592639fbf98597c0 (diff)
Merge "Add zipl element as s390x architecture bootloader"
-rw-r--r--diskimage_builder/elements/zipl/README.rst18
-rw-r--r--diskimage_builder/elements/zipl/element-deps1
-rw-r--r--diskimage_builder/elements/zipl/element-provides1
-rw-r--r--diskimage_builder/elements/zipl/environment.d/10-zipl-default-cmdline1
-rwxr-xr-xdiskimage_builder/elements/zipl/finalise.d/50-zipl70
-rw-r--r--diskimage_builder/elements/zipl/package-installs.yaml4
-rwxr-xr-xdiskimage_builder/elements/zipl/pre-install.d/kernel_config32
-rw-r--r--doc/source/user_guide/building_an_image.rst8
8 files changed, 135 insertions, 0 deletions
diff --git a/diskimage_builder/elements/zipl/README.rst b/diskimage_builder/elements/zipl/README.rst
new file mode 100644
index 0000000..46c99f5
--- /dev/null
+++ b/diskimage_builder/elements/zipl/README.rst
@@ -0,0 +1,18 @@
1==========
2zipl
3==========
4
5Zipl is the bootloader for s390x.
6
7This element installs zipl on the base device holding the /boot directory on the system.
8It's mandatory for building s390x images. It replaces the `bootloader` element
9(which would install grub2 by default).
10
11This element has been tested with `ubuntu` and `ubuntu-minimal` distro.
12
13Arguments
14=========
15
16* ``DIB_ZIPL_DEFAULT_CMDLINE`` sets the CMDLINE parameters that
17 are appended to the zipl.conf parameter configuration. It defaults to
18 '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 0000000..7076aba
--- /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 0000000..5496017
--- /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 0000000..ea1c152
--- /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 0000000..4f9499e
--- /dev/null
+++ b/diskimage_builder/elements/zipl/finalise.d/50-zipl
@@ -0,0 +1,70 @@
1#!/bin/bash
2# Copyright (c) 2017 IBM Corp.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14#
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18# Configure zipl.
19
20if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
21 set -x
22fi
23set -eu
24set -o pipefail
25
26# get the device containing the /boot directory
27base_device=`df /boot --output=source | grep "/dev/*"`
28
29cat > /lib/s390-tools/zipl_helper.loop <<EOF
30#!/bin/bash
31# This helper file is only required during image build if DIB is
32# called without any partitioning configured (e.g. without the "vm"
33# element). In that case the file system is put on a plain loop
34# device.
35#
36# It's not required if
37# * zipl is executed in in a running VM.
38# * DIB is configured to create partitions (e.g. with the "vm"
39# element).
40#
41# In both cases the disks block layout can be determined by
42# the operating system shipped zipl_helper.device-mapper file.
43
44echo "targetbase=${base_device}"
45echo "targettype=scsi"
46# DIB only supports 512 Byte disk sectors and blocks (not to confuse
47# with filesystem block size which is 4k by default)
48echo "targetblocksize=512"
49# If no partitions are present, no MBR is present - the file system can start
50# at block 0
51echo "targetoffset=0"
52EOF
53
54chmod +x /lib/s390-tools/zipl_helper.loop
55
56cat > /etc/zipl.conf <<EOF
57# This has been modified by the cloud image build process
58[defaultboot]
59default=ubuntu
60
61[ubuntu]
62target = /boot
63image = /boot/vmlinuz
64ramdisk = /boot/initrd.img
65parameters="root=LABEL=${DIB_ROOT_LABEL} $DIB_ZIPL_DEFAULT_CMDLINE"
66EOF
67
68zipl -V
69
70rm -f /lib/s390-tools/zipl_helper.loop
diff --git a/diskimage_builder/elements/zipl/package-installs.yaml b/diskimage_builder/elements/zipl/package-installs.yaml
new file mode 100644
index 0000000..9a99756
--- /dev/null
+++ b/diskimage_builder/elements/zipl/package-installs.yaml
@@ -0,0 +1,4 @@
1s390-tools:
2 arch: s390x
3dmsetup:
4 arch: s390x
diff --git a/diskimage_builder/elements/zipl/pre-install.d/kernel_config b/diskimage_builder/elements/zipl/pre-install.d/kernel_config
new file mode 100755
index 0000000..e41ce7e
--- /dev/null
+++ b/diskimage_builder/elements/zipl/pre-install.d/kernel_config
@@ -0,0 +1,32 @@
1#!/bin/bash
2# Copyright (c) 2017 IBM Corp.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14#
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
19 set -x
20fi
21set -eu
22set -o pipefail
23
24KERNEL_CONF_FILE=/etc/kernel-img.conf
25
26if [ -e "$KERNEL_CONF_FILE" ]; then
27 # Remove the line if already set
28 sed -i "/^link_in_boot.*/d" "$KERNEL_CONF_FILE"
29fi
30
31# Set the kernel config option
32echo "link_in_boot = yes" >>"$KERNEL_CONF_FILE"
diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst
index 7be6499..aaf6341 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
668architecture, and ``ppc64le`` refers to a ``.rpm`` based distribution. 668architecture, and ``ppc64le`` refers to a ``.rpm`` based distribution.
669Regardless of the distribution the kernel architecture is always 669Regardless of the distribution the kernel architecture is always
670``ppc64le``. 670``ppc64le``.
671
672Notes about s390x (z Systems) Architecture
673++++++++++++++++++++++++++++++++++++++++++
674
675Images for s390x can only be build on s390x hosts. Trying to build
676it with the architecture override on other architecture will
677cause the build to fail.
678