diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2016-09-05 12:37:46 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-09-05 12:37:46 +0000 |
commit | 1da9fde0e50f7c99b180cae979f04e4332cef998 (patch) | |
tree | 0c60d6939db32ff1dab981cf67911497ffe71428 /patches/opnfv-fuel | |
parent | 0ce564a34593b5c6ca80727c7fd32d6f62ad040e (diff) | |
parent | dff8f1a78db4a04dd30c2e0ac03a36cb0b198aa7 (diff) |
Merge "EFI: Move patches to Fuel@OPNFV, upstream prep"
Diffstat (limited to 'patches/opnfv-fuel')
-rw-r--r-- | patches/opnfv-fuel/0051-EFI-Add-basic-support-for-U-EFI.patch | 198 |
1 files changed, 198 insertions, 0 deletions
diff --git a/patches/opnfv-fuel/0051-EFI-Add-basic-support-for-U-EFI.patch b/patches/opnfv-fuel/0051-EFI-Add-basic-support-for-U-EFI.patch new file mode 100644 index 00000000..d45d4f29 --- /dev/null +++ b/patches/opnfv-fuel/0051-EFI-Add-basic-support-for-U-EFI.patch @@ -0,0 +1,198 @@ +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +Date: Sun, 28 Aug 2016 00:28:53 +0200 +Subject: [PATCH] EFI: Add basic support for (U)EFI + +This change introduces basic EFI support in <fuel-astute> and +<fuel-agent>, by patching them at build time with: +- ESP partition flag; +- VFAT filesytem on ESP; +- clearing "ubuntu" boot entry created by Trusty's grub-install; + +This change DOES NOT provide an x86 (U)EFI netloader for integration +with cobbler. + +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +--- + .../0010-EFI-Erase-boot-entry-on-EFI-systems.patch | 43 ++++++++++++++ + .../0010-EFI-Add-esp-partition-flag.patch | 48 ++++++++++++++++ + .../0020-EFI-Add-fs-for-efi-partition.patch | 66 ++++++++++++++++++++++ + 3 files changed, 157 insertions(+) + create mode 100644 build/patch-repos/build/repos/astute/0010-EFI-Erase-boot-entry-on-EFI-systems.patch + create mode 100644 build/patch-repos/build/repos/fuel-agent/0010-EFI-Add-esp-partition-flag.patch + create mode 100644 build/patch-repos/build/repos/fuel-agent/0020-EFI-Add-fs-for-efi-partition.patch + +diff --git a/build/patch-repos/build/repos/astute/0010-EFI-Erase-boot-entry-on-EFI-systems.patch b/build/patch-repos/build/repos/astute/0010-EFI-Erase-boot-entry-on-EFI-systems.patch +new file mode 100644 +index 0000000..fa925b0 +--- /dev/null ++++ b/build/patch-repos/build/repos/astute/0010-EFI-Erase-boot-entry-on-EFI-systems.patch +@@ -0,0 +1,43 @@ ++From: Alexandru Avadanii <Alexandru.Avadanii@enea.com> ++Date: Mon, 18 Jul 2016 16:02:20 +0200 ++Subject: [PATCH] EFI: Erase boot entry on EFI systems. ++ ++On EFI-enabled systemd, grub-install from grub-efi-* package ++installs a boot entry named "ubuntu". ++ ++Since this boot entry is saved in board flash memory, erasing ++the MBR bootloader code and/or partition signature will not ++clear the ubuntu boot entry, leaving it pointing to a loader ++on the ESP (EFI System Partition) that will try to load the ++kernel/initrd from an erased partition. ++ ++In Fuel 8.0, the whole disk was erased, so the ubuntu EFI boot ++entry was skipped due to missing ESP, while for Fuel 9.0 and ++above we have to explicitly remove it to keep the system in a ++sane state. ++ ++Note: efibootmgr is installed automatically on EFI systems ++as a dependency of grub-efi-*. ++ ++Closes: ARMBAND-47 ++ ++Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> ++--- ++ mcagents/erase_node.rb | 4 ++++ ++ 1 file changed, 4 insertions(+) ++ ++diff --git a/mcagents/erase_node.rb b/mcagents/erase_node.rb ++index 3eb98e8..3bac36f 100644 ++--- a/mcagents/erase_node.rb +++++ b/mcagents/erase_node.rb ++@@ -112,6 +112,10 @@ module MCollective ++ File.open('/proc/sys/kernel/panic','w') {|file| file.write("10\n")} ++ ++ begin +++ # clear out EFI boot entry on EFI-enabled systems +++ system("(which efibootmgr > /dev/null 2>&1 && efibootmgr | "\ +++ "grep -oP '(?<=Boot)[0-9]+(?=.*ubuntu)' | "\ +++ "xargs -I{} efibootmgr --delete-bootnum --bootnum {}) || true") ++ get_devices(type='all').each do |dev| ++ debug_msg("erasing bootstrap code area in MBR of #{dev[:name]}") ++ # clear out the boot code in MBR +diff --git a/build/patch-repos/build/repos/fuel-agent/0010-EFI-Add-esp-partition-flag.patch b/build/patch-repos/build/repos/fuel-agent/0010-EFI-Add-esp-partition-flag.patch +new file mode 100644 +index 0000000..ac94a4f +--- /dev/null ++++ b/build/patch-repos/build/repos/fuel-agent/0010-EFI-Add-esp-partition-flag.patch +@@ -0,0 +1,48 @@ ++From: Alexandru Avadanii <Alexandru.Avadanii@enea.com> ++Date: Tue, 8 Mar 2016 16:29:39 +0100 ++Subject: [PATCH] EFI: Add <esp> partition flag. ++ ++Parted flag <esp> (see [1]) will mark EFI system partition, allowing us ++to properly format and mount it during do_partitioning deployment phase. ++ ++[1] https://www.gnu.org/software/parted/manual/html_node/set.html ++--- ++ fuel_agent/drivers/nailgun.py | 2 +- ++ fuel_agent/utils/partition.py | 4 ++-- ++ 2 files changed, 3 insertions(+), 3 deletions(-) ++ ++diff --git a/fuel_agent/drivers/nailgun.py b/fuel_agent/drivers/nailgun.py ++index c2fef69..0ae81f9 100644 ++--- a/fuel_agent/drivers/nailgun.py +++++ b/fuel_agent/drivers/nailgun.py ++@@ -324,7 +324,7 @@ class Nailgun(BaseDataDriver): ++ # uefi partition (for future use) ++ LOG.debug('Adding UEFI partition on disk %s: size=200' % ++ disk['name']) ++- parted.add_partition(size=200) +++ parted.add_partition(size=200, flags=['esp']) ++ ++ LOG.debug('Looping over all volumes on disk %s' % disk['name']) ++ for volume in disk['volumes']: ++diff --git a/fuel_agent/utils/partition.py b/fuel_agent/utils/partition.py ++index acdd0b3..86349d2 100644 ++--- a/fuel_agent/utils/partition.py +++++ b/fuel_agent/utils/partition.py ++@@ -93,7 +93,7 @@ def set_partition_flag(dev, num, flag, state='on'): ++ :param dev: A device file, e.g. /dev/sda. ++ :param num: Partition number ++ :param flag: Flag name. Must be one of 'bios_grub', 'legacy_boot', ++- 'boot', 'raid', 'lvm' +++ 'boot', 'raid', 'lvm', 'esp' ++ :param state: Desiable flag state. 'on' or 'off'. Default is 'on'. ++ ++ :returns: None ++@@ -103,7 +103,7 @@ def set_partition_flag(dev, num, flag, state='on'): ++ # parted supports more flags but we are interested in ++ # setting only this subset of them. ++ # not all of these flags are compatible with one another. ++- if flag not in ('bios_grub', 'legacy_boot', 'boot', 'raid', 'lvm'): +++ if flag not in ('bios_grub', 'legacy_boot', 'boot', 'raid', 'lvm', 'esp'): ++ raise errors.WrongPartitionSchemeError( ++ 'Unsupported partition flag: %s' % flag) ++ if state not in ('on', 'off'): +diff --git a/build/patch-repos/build/repos/fuel-agent/0020-EFI-Add-fs-for-efi-partition.patch b/build/patch-repos/build/repos/fuel-agent/0020-EFI-Add-fs-for-efi-partition.patch +new file mode 100644 +index 0000000..a3767a1 +--- /dev/null ++++ b/build/patch-repos/build/repos/fuel-agent/0020-EFI-Add-fs-for-efi-partition.patch +@@ -0,0 +1,66 @@ ++From: Stanislaw Kardach <stanislaw.kardach@cavium.com> ++Date: Tue, 8 Mar 2016 21:08:55 +0100 ++Subject: [PATCH] EFI: Add fs for efi partition ++ ++--- ++ debian/control | 1 + ++ fuel_agent/drivers/nailgun.py | 13 ++++++++++--- ++ specs/fuel-agent.spec | 1 + ++ 3 files changed, 12 insertions(+), 3 deletions(-) ++ ++diff --git a/debian/control b/debian/control ++index 189dc00..acfda35 100644 ++--- a/debian/control +++++ b/debian/control ++@@ -39,6 +39,7 @@ Depends: bzip2, ++ qemu-user-static, ++ binfmt-support, ++ dmidecode, +++ dosfstools, ++ ethtool, ++ gdisk, ++ genisoimage, ++diff --git a/fuel_agent/drivers/nailgun.py b/fuel_agent/drivers/nailgun.py ++index bc532b4..f092865 100644 ++--- a/fuel_agent/drivers/nailgun.py +++++ b/fuel_agent/drivers/nailgun.py ++@@ -81,6 +81,9 @@ class Nailgun(BaseDataDriver): ++ # was already allocated on first matching volume ++ # or not ++ self._boot_partition_done = False +++ # this var states whether ESP partition was already +++ # allocated on the first matching volume or not +++ self._esp_partition_done = False ++ # this var is used as a flag that /boot fs ++ # has already been added. we need this to ++ # get rid of md over all disks for /boot partition. ++@@ -321,10 +324,14 @@ class Nailgun(BaseDataDriver): ++ LOG.debug('Adding bios_grub partition on disk %s: size=24' % ++ disk['name']) ++ parted.add_partition(size=24, flags=['bios_grub']) ++- # uefi partition (for future use) ++- LOG.debug('Adding UEFI partition on disk %s: size=200' % +++ # uefi partition - added only once. +++ if self._is_boot_disk(disk) and not self._esp_partition_done: +++ LOG.debug('Adding UEFI partition on disk %s: size=200' % ++ disk['name']) ++- parted.add_partition(size=200, flags=['esp']) +++ prt = parted.add_partition(size=200, flags=['esp']) +++ partition_scheme.add_fs(device=prt.name, mount='/boot/efi', +++ fs_type='vfat') +++ self._esp_partition_done = True ++ ++ LOG.debug('Looping over all volumes on disk %s' % disk['name']) ++ for volume in disk['volumes']: ++diff --git a/specs/fuel-agent.spec b/specs/fuel-agent.spec ++index a43f693..c2b9b51 100644 ++--- a/specs/fuel-agent.spec +++++ b/specs/fuel-agent.spec ++@@ -50,6 +50,7 @@ Requires: xfsprogs ++ Requires: pciutils ++ Requires: ethtool ++ Requires: debootstrap +++Requires: dosfstools ++ Requires: dpkg ++ Requires: qemu-user-static ++ Requires: xz |