aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-installer/anaconda/files/0052-invoke-grub-install-to-generate-efi-filesystem.patch
blob: e17e18255a80f277317912d0eeb697a15cc6f79e (plain)
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
From 0cc17f41dc2950dedf3c37b72c94c61a278ae5ca Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Sat, 29 Jun 2019 16:42:50 +0800
Subject: [PATCH] invoke grub-install to generate efi filesystem

Previously, the efi filesystem was from package grub-efi
which generated at build time.

Add a wraper to generate efi filesystem with fs_uuid located.

Upstream-Status: Inappropriate [oe specific]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 pyanaconda/bootloader/efi.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/pyanaconda/bootloader/efi.py b/pyanaconda/bootloader/efi.py
index 73d348b..6199b51 100644
--- a/pyanaconda/bootloader/efi.py
+++ b/pyanaconda/bootloader/efi.py
@@ -129,6 +129,22 @@ class EFIBase(object):
             self.remove_efi_boot_target()
         self.add_efi_boot_target()
 
+        with open(util.getSysroot() + "/tmp/grub-mkimage-wrapper.sh", "w") as f:
+            f.write('#!/bin/sh\n')
+            f.write('uuid=`grub-probe  --target=fs_uuid  /boot/efi/`\n')
+            f.write('echo "search.fs_uuid ${uuid} root" > /tmp/load.cfg\n')
+            f.write('echo "grub-mkimage -c /tmp/load.cfg $@ search_fs_uuid"\n')
+            f.write('grub-mkimage -c /tmp/load.cfg $@ search_fs_uuid\n')
+        os.chmod(util.getSysroot() + "/tmp/grub-mkimage-wrapper.sh", 0o755)
+
+        rc = util.execInSysroot("grub-install", ["--removable",
+                                                  "--efi-directory=/boot/efi/",
+                                                  "--boot-directory=%s" % self.config_dir,
+                                                  "--grub-mkimage=/tmp/grub-mkimage-wrapper.sh",
+                                                  "/boot/efi/"
+                                                 ])
+        if rc:
+            raise BootLoaderError("boot loader install failed")
 
 class EFIGRUB(EFIBase, GRUB2):
     """EFI GRUBv2"""
-- 
2.7.4