From 1b9520e9553d2037ef4f88ab9af496540b07b62b Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Thu, 26 Mar 2015 09:33:54 +0000 Subject: [PATCH] Add grub2 element This patch is adds a new grub2 element that installs the grub2 bootloader on the image so it can work with Ironic's local boot support. This patch also modifies the iso element which was installing same grub2. It removes the grub2 installation from iso element and makes it dependent on grub2 element. Co-Authored-By: Ramakrishnan G Change-Id: I37bcf2c525708d1e2e0f95cf5874a279f76861f7 --- elements/grub2/README.rst | 7 +++++++ elements/grub2/package-installs.yaml | 3 +++ elements/grub2/pkg-map | 20 +++++++++++++++++++ .../grub2/post-install.d/01-delete-grubenv | 13 ++++++++++++ elements/iso/element-deps | 1 + elements/iso/package-installs.yaml | 2 -- elements/iso/pkg-map | 6 ------ 7 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 elements/grub2/README.rst create mode 100644 elements/grub2/package-installs.yaml create mode 100644 elements/grub2/pkg-map create mode 100755 elements/grub2/post-install.d/01-delete-grubenv diff --git a/elements/grub2/README.rst b/elements/grub2/README.rst new file mode 100644 index 00000000..e4d21881 --- /dev/null +++ b/elements/grub2/README.rst @@ -0,0 +1,7 @@ +===== +grub2 +===== +This image installs grub2 bootloader on the image, that's necessary for +the local boot feature in Ironic to work. This is being made a separated +element because usually images have grub2 removed for space reasons and +also because they are going to boot from network (PXE boot). diff --git a/elements/grub2/package-installs.yaml b/elements/grub2/package-installs.yaml new file mode 100644 index 00000000..283e4dc3 --- /dev/null +++ b/elements/grub2/package-installs.yaml @@ -0,0 +1,3 @@ +signed_grub_efi: +signed_shim_efi: +grub_bios: diff --git a/elements/grub2/pkg-map b/elements/grub2/pkg-map new file mode 100644 index 00000000..74a7baad --- /dev/null +++ b/elements/grub2/pkg-map @@ -0,0 +1,20 @@ +{ + "family":{ + "debian":{ + "signed_grub_efi": "grub-efi-amd64-signed", + "signed_shim_efi": "shim-signed", + "grub_bios": "grub-pc-bin" + }, + "redhat":{ + "signed_grub_efi": "efibootmgr grub2-efi-modules grub2-efi", + "signed_shim_efi": "shim", + "grub_bios": "grub2" + } + }, + "default":{ + "signed_grub_efi": "grub-efi-amd64-signed", + "signed_shim_efi": "shim-signed", + "grub_bios": "grub-pc-bin" + } +} + diff --git a/elements/grub2/post-install.d/01-delete-grubenv b/elements/grub2/post-install.d/01-delete-grubenv new file mode 100755 index 00000000..bba04464 --- /dev/null +++ b/elements/grub2/post-install.d/01-delete-grubenv @@ -0,0 +1,13 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi + +set -eu +set -o pipefail + + +# Delete /boot/grub2/grubenv if it exists because +# it will fail while doing grub-install again. +rm -f /boot/grub2/grubenv diff --git a/elements/iso/element-deps b/elements/iso/element-deps index 7076aba9..2f2914e3 100644 --- a/elements/iso/element-deps +++ b/elements/iso/element-deps @@ -1 +1,2 @@ +grub2 package-installs diff --git a/elements/iso/package-installs.yaml b/elements/iso/package-installs.yaml index 782d8df0..c72b1c0b 100644 --- a/elements/iso/package-installs.yaml +++ b/elements/iso/package-installs.yaml @@ -1,3 +1 @@ -signed_grub: -signed_shim: syslinux: diff --git a/elements/iso/pkg-map b/elements/iso/pkg-map index 2fa3799d..b6257ae8 100644 --- a/elements/iso/pkg-map +++ b/elements/iso/pkg-map @@ -1,19 +1,13 @@ { "family":{ "debian":{ - "signed_grub": "grub-efi-amd64-signed", - "signed_shim": "shim-signed", "syslinux": "syslinux" }, "redhat":{ - "signed_grub": "grub2-efi", - "signed_shim": "shim", "syslinux": "" } }, "default":{ - "signed_grub": "grub-efi-amd64-signed", - "signed_shim": "shim-signed", "syslinux": "syslinux" } }