From 79ea63f5251f6f9a11d1a26537cd2c76389d2d66 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 12 May 2021 11:31:29 +1000 Subject: [PATCH] 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 --- .../bootloader/finalise.d/50-bootloader | 64 +++++++------------ .../debian-minimal/package-installs.yaml | 2 - .../pre-install.d/01-override-yum-arch | 5 +- diskimage_builder/lib/disk-image-create | 2 +- doc/source/ci.md | 41 ------------ doc/source/developer/components.rst | 2 +- doc/source/developer/developing_elements.rst | 4 +- .../notes/i386-removed-13fc770dc88e81dc.yaml | 3 + 8 files changed, 32 insertions(+), 91 deletions(-) delete mode 100644 doc/source/ci.md create mode 100644 releasenotes/notes/i386-removed-13fc770dc88e81dc.yaml diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 406f9250..630606ce 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -52,20 +52,26 @@ else GRUB_MKCONFIG="grub-mkconfig" 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' -# helper. +# Some distros keep things in /boot/grub2, others in /boot/grub if [ -d /boot/grub2 ]; then GRUB_CFG=/boot/grub2/grub.cfg GRUBENV=/boot/grub2/grubenv else - # TODO(frickler): /boot/grub doesn't seem to exist for gentoo either - # at this point, let's hope it gets created later + # NOTE(ianw) This used to be behind a "-d /boot/grub" but this + # 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 GRUBENV=/boot/grub/grubenv fi +echo "Installing GRUB2..." + # When using EFI image-based builds, particularly rhel element # based on RHEL>=8.2 .qcow2, we might have /boot/grub2/grubenv # 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 # root partition of a block device. -GRUB_OPTS=${GRUB_OPTS:-"--force"} -# XXX: This is buggy: -# - --target=i386-pc is invalid for non-i386/amd64 architectures -# - and for UEFI too. -# GRUB_OPTS="$GRUB_OPTS --target=i386-pc" -if [[ ! $GRUB_OPTS == *--target* ]] && [[ $($GRUBNAME --version) =~ ' 2.' ]]; then - # /sys/ comes from the host machine. If the host machine is using EFI - # but the image being built doesn't have EFI boot-images installed we - # should set the --target to use a BIOS-based boot-image. - # - # * --target tells grub what's the target platform - # * the boot images are placed in /usr/lib/grub/- - # * 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" - ;; - "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 +GRUB_OPTS="--force " + +# /sys/ comes from the host machine. If the host machine is using EFI +# but the image being built doesn't have EFI boot-images installed we +# should set the --target to use a BIOS-based boot-image. +# +# * --target tells grub what's the target platform +# * the boot images are placed in /usr/lib/grub/- +# * i386-pc is used for BIOS-based machines +# http://www.gnu.org/software/grub/manual/grub.html#Installation +# +if [[ -d /sys/firmware/efi && ! -d /usr/lib/grub/*-efi ]]; then + GRUB_OPTS="$GRUB_OPTS --target=i386-pc" fi if [[ "$ARCH" =~ "ppc" ]] ; then diff --git a/diskimage_builder/elements/debian-minimal/package-installs.yaml b/diskimage_builder/elements/debian-minimal/package-installs.yaml index 3586cd86..5a38ce51 100644 --- a/diskimage_builder/elements/debian-minimal/package-installs.yaml +++ b/diskimage_builder/elements/debian-minimal/package-installs.yaml @@ -1,7 +1,5 @@ linux-image-amd64: arch: amd64 -linux-image-686: - arch: i386 linux-image-arm64: arch: arm64 netbase: diff --git a/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch b/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch index 88fa480b..44a99ee2 100755 --- a/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch +++ b/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch @@ -6,10 +6,7 @@ fi set -eu set -o pipefail -if [ "i386" = "$ARCH" ]; then - basearch=i386 - arch=i686 -elif [[ "amd64 x86_64" =~ "$ARCH" ]]; then +if [[ "amd64 x86_64" =~ "$ARCH" ]]; then basearch=x86_64 arch=x86_64 elif [[ "$ARCH" = "ppc64" ]]; then diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index fac8c61c..80fc8fc6 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -52,7 +52,7 @@ function show_options () { echo "Usage: ${SCRIPTNAME} [OPTION]... [ELEMENT]..." echo 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 " -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" diff --git a/doc/source/ci.md b/doc/source/ci.md deleted file mode 100644 index d7f7e587..00000000 --- a/doc/source/ci.md +++ /dev/null @@ -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. diff --git a/doc/source/developer/components.rst b/doc/source/developer/components.rst index eeefb8f2..df9b675d 100644 --- a/doc/source/developer/components.rst +++ b/doc/source/developer/components.rst @@ -1,7 +1,7 @@ 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. Element dependencies are automatically included. Support for other diff --git a/doc/source/developer/developing_elements.rst b/doc/source/developer/developing_elements.rst index 342bbb72..24cb58da 100644 --- a/doc/source/developer/developing_elements.rst +++ b/doc/source/developer/developing_elements.rst @@ -87,7 +87,7 @@ The phases are: * runs: **outside chroot** * inputs: - * ``$ARCH=i386|amd64|armhf|arm64`` + * ``$ARCH=amd64|armhf|arm64`` * ``$TARGET_ROOT=/path/to/target/workarea`` ``extra-data.d`` @@ -176,7 +176,7 @@ The phases are: * runs: **outside chroot** * inputs: - * ``$ARCH=i386|amd64|armhf|arm64`` + * ``$ARCH=amd64|armhf|arm64`` * ``$TARGET_ROOT=/path/to/target/workarea`` diff --git a/releasenotes/notes/i386-removed-13fc770dc88e81dc.yaml b/releasenotes/notes/i386-removed-13fc770dc88e81dc.yaml new file mode 100644 index 00000000..c712a7d9 --- /dev/null +++ b/releasenotes/notes/i386-removed-13fc770dc88e81dc.yaml @@ -0,0 +1,3 @@ +--- +deprecations: + - References to building ``i386`` images have been removed.