-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy path50-zipl
executable file
·70 lines (60 loc) · 1.96 KB
/
50-zipl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 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