Futher bootloader cleanups

GRUB_OPTS has never been documented as externally available, and is
not used.  Assume it's value to simplify the code.

Move the grub version check separately, as we only support grub2

Remove references to buliding i386 images.  I don't image it works in
any way.

Remove ci.md, which is no longer relevant.

Refactor the test for "building BIOS image on EFI system" consiberably
after these changes.

Change-Id: Ia99687815667c3cf5e82cf21d841d3b1008b8fa9
This commit is contained in:
Ian Wienand 2021-05-12 11:31:29 +10:00
parent b43c5967e8
commit 79ea63f525
8 changed files with 32 additions and 91 deletions

View File

@ -52,20 +52,26 @@ else
GRUB_MKCONFIG="grub-mkconfig" GRUB_MKCONFIG="grub-mkconfig"
fi fi
echo "Installing GRUB2..." if [[ ! $($GRUBNAME --version) =~ ' 2.' ]]; then
echo "Failure: not grub2"
exit 1
fi
# This might be better factored out into a per-distro 'install-bootblock' # Some distros keep things in /boot/grub2, others in /boot/grub
# helper.
if [ -d /boot/grub2 ]; then if [ -d /boot/grub2 ]; then
GRUB_CFG=/boot/grub2/grub.cfg GRUB_CFG=/boot/grub2/grub.cfg
GRUBENV=/boot/grub2/grubenv GRUBENV=/boot/grub2/grubenv
else else
# TODO(frickler): /boot/grub doesn't seem to exist for gentoo either # NOTE(ianw) This used to be behind a "-d /boot/grub" but this
# at this point, let's hope it gets created later # directory doesn't seem to exist for gentoo at this point;
# something creates it later. So we just fallback to this
# unconditionally.
GRUB_CFG=/boot/grub/grub.cfg GRUB_CFG=/boot/grub/grub.cfg
GRUBENV=/boot/grub/grubenv GRUBENV=/boot/grub/grubenv
fi fi
echo "Installing GRUB2..."
# When using EFI image-based builds, particularly rhel element # When using EFI image-based builds, particularly rhel element
# based on RHEL>=8.2 .qcow2, we might have /boot/grub2/grubenv # based on RHEL>=8.2 .qcow2, we might have /boot/grub2/grubenv
# as a dangling symlink to /boot/efi because we have extracted # as a dangling symlink to /boot/efi because we have extracted
@ -79,41 +85,19 @@ fi
# We need --force so grub does not fail due to being installed on the # We need --force so grub does not fail due to being installed on the
# root partition of a block device. # root partition of a block device.
GRUB_OPTS=${GRUB_OPTS:-"--force"} GRUB_OPTS="--force "
# XXX: This is buggy:
# - --target=i386-pc is invalid for non-i386/amd64 architectures # /sys/ comes from the host machine. If the host machine is using EFI
# - and for UEFI too. # but the image being built doesn't have EFI boot-images installed we
# GRUB_OPTS="$GRUB_OPTS --target=i386-pc" # should set the --target to use a BIOS-based boot-image.
if [[ ! $GRUB_OPTS == *--target* ]] && [[ $($GRUBNAME --version) =~ ' 2.' ]]; then #
# /sys/ comes from the host machine. If the host machine is using EFI # * --target tells grub what's the target platform
# but the image being built doesn't have EFI boot-images installed we # * the boot images are placed in /usr/lib/grub/<cpu>-<platform>
# should set the --target to use a BIOS-based boot-image. # * i386-pc is used for BIOS-based machines
# # http://www.gnu.org/software/grub/manual/grub.html#Installation
# * --target tells grub what's the target platform #
# * the boot images are placed in /usr/lib/grub/<cpu>-<platform> if [[ -d /sys/firmware/efi && ! -d /usr/lib/grub/*-efi ]]; then
# * i386-pc is used for BIOS-based machines
# http://www.gnu.org/software/grub/manual/grub.html#Installation
#
if [ -d /sys/firmware/efi ]; then
if [[ ${DIB_BLOCK_DEVICE} == "mbr" || ${DIB_BLOCK_DEVICE} == "gpt" ]]; then
case $ARCH in
"x86_64"|"amd64")
GRUB_OPTS="$GRUB_OPTS --target=i386-pc" GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
;;
"i386")
target=i386-pc
if [ -e /proc/device-tree ]; then
for x in /proc/device-tree/*; do
if [ -e "$x" ]; then
target="i386-ieee1275"
fi
done
fi
GRUB_OPTS="$GRUB_OPTS --target=$target"
;;
esac
fi
fi
fi fi
if [[ "$ARCH" =~ "ppc" ]] ; then if [[ "$ARCH" =~ "ppc" ]] ; then

View File

@ -1,7 +1,5 @@
linux-image-amd64: linux-image-amd64:
arch: amd64 arch: amd64
linux-image-686:
arch: i386
linux-image-arm64: linux-image-arm64:
arch: arm64 arch: arm64
netbase: netbase:

View File

@ -6,10 +6,7 @@ fi
set -eu set -eu
set -o pipefail set -o pipefail
if [ "i386" = "$ARCH" ]; then if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
basearch=i386
arch=i686
elif [[ "amd64 x86_64" =~ "$ARCH" ]]; then
basearch=x86_64 basearch=x86_64
arch=x86_64 arch=x86_64
elif [[ "$ARCH" = "ppc64" ]]; then elif [[ "$ARCH" = "ppc64" ]]; then

View File

@ -52,7 +52,7 @@ function show_options () {
echo "Usage: ${SCRIPTNAME} [OPTION]... [ELEMENT]..." echo "Usage: ${SCRIPTNAME} [OPTION]... [ELEMENT]..."
echo echo
echo "Options:" echo "Options:"
echo " -a i386|amd64|armhf|arm64 -- set the architecture of the image(default amd64)" echo " -a amd64|armhf|arm64 -- set the architecture of the image(default amd64)"
echo " -o imagename -- set the imagename of the output image file(default image)" echo " -o imagename -- set the imagename of the output image file(default image)"
echo " -t qcow2,tar,tgz,squashfs,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)" echo " -t qcow2,tar,tgz,squashfs,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)"
echo " File types should be comma separated. VHD outputting requires the vhd-util" echo " File types should be comma separated. VHD outputting requires the vhd-util"

View File

@ -1,41 +0,0 @@
CI needs for image building
===========================
Eventually, if/when TripleO becomes an official OpenStack project, all CI for
it should be on OpenStack systems. Until then we still need CI.
Jenkins
-------
* Jenkins from jenkins apt repo.
* IRC notification service, notify-only on #triple on OFTC, port 7000 ssl.
* Github OAuth plugin, permit all from tripleo organisation, and organisation
members as service admins.
* Grant jenkins builders sudo [may want lxc containers or cloud instances for
security isolation]
* Jobs to build:
* base ubuntu VM.
disk-image-create vm base -o base -a i386
* ramdisk deploy image build
ramdisk-image-create deploy
Copyright
=========
Copyright 2012, 2013 Hewlett-Packard Development Company, L.P.
Copyright (c) 2012 NTT DOCOMO, INC.
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.

View File

@ -1,7 +1,7 @@
Components Components
========== ==========
`disk-image-create [-a i386|amd64|armhf|arm64] -o filename {element} [{element} ...]` `disk-image-create [-a amd64|armhf|arm64] -o filename {element} [{element} ...]`
Create an image of element {element}, optionally mixing in other elements. Create an image of element {element}, optionally mixing in other elements.
Element dependencies are automatically included. Support for other Element dependencies are automatically included. Support for other

View File

@ -87,7 +87,7 @@ The phases are:
* runs: **outside chroot** * runs: **outside chroot**
* inputs: * inputs:
* ``$ARCH=i386|amd64|armhf|arm64`` * ``$ARCH=amd64|armhf|arm64``
* ``$TARGET_ROOT=/path/to/target/workarea`` * ``$TARGET_ROOT=/path/to/target/workarea``
``extra-data.d`` ``extra-data.d``
@ -176,7 +176,7 @@ The phases are:
* runs: **outside chroot** * runs: **outside chroot**
* inputs: * inputs:
* ``$ARCH=i386|amd64|armhf|arm64`` * ``$ARCH=amd64|armhf|arm64``
* ``$TARGET_ROOT=/path/to/target/workarea`` * ``$TARGET_ROOT=/path/to/target/workarea``

View File

@ -0,0 +1,3 @@
---
deprecations:
- References to building ``i386`` images have been removed.