Merge "Add zipl element as s390x architecture bootloader"

This commit is contained in:
Zuul 2017-12-01 02:35:58 +00:00 committed by Gerrit Code Review
commit 7beb27ca30
8 changed files with 135 additions and 0 deletions

View File

@ -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'

View File

@ -0,0 +1 @@
package-installs

View File

@ -0,0 +1 @@
bootloader

View File

@ -0,0 +1 @@
export DIB_ZIPL_DEFAULT_CMDLINE=${DIB_ZIPL_DEFAULT_CMDLINE:-"LANG=en_US.UTF-8 console=ttyS0 console=ttyS1"}

View File

@ -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 <<EOF
#!/bin/bash
# This helper file is only required during image build if DIB is
# called without any partitioning configured (e.g. without the "vm"
# element). In that case the file system is put on a plain loop
# device.
#
# It's not required if
# * zipl is executed in in a running VM.
# * DIB is configured to create partitions (e.g. with the "vm"
# element).
#
# In both cases the disks block layout can be determined by
# the operating system shipped zipl_helper.device-mapper file.
echo "targetbase=${base_device}"
echo "targettype=scsi"
# DIB only supports 512 Byte disk sectors and blocks (not to confuse
# with filesystem block size which is 4k by default)
echo "targetblocksize=512"
# If no partitions are present, no MBR is present - the file system can start
# at block 0
echo "targetoffset=0"
EOF
chmod +x /lib/s390-tools/zipl_helper.loop
cat > /etc/zipl.conf <<EOF
# This has been modified by the cloud image build process
[defaultboot]
default=ubuntu
[ubuntu]
target = /boot
image = /boot/vmlinuz
ramdisk = /boot/initrd.img
parameters="root=LABEL=${DIB_ROOT_LABEL} $DIB_ZIPL_DEFAULT_CMDLINE"
EOF
zipl -V
rm -f /lib/s390-tools/zipl_helper.loop

View File

@ -0,0 +1,4 @@
s390-tools:
arch: s390x
dmsetup:
arch: s390x

View File

@ -0,0 +1,32 @@
#!/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.
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
KERNEL_CONF_FILE=/etc/kernel-img.conf
if [ -e "$KERNEL_CONF_FILE" ]; then
# Remove the line if already set
sed -i "/^link_in_boot.*/d" "$KERNEL_CONF_FILE"
fi
# Set the kernel config option
echo "link_in_boot = yes" >>"$KERNEL_CONF_FILE"

View File

@ -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.