public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH 09/10] wic: bootimg-efi-isar: Make agnostic to partition order
Date: Mon,  5 Nov 2018 07:52:09 +0100	[thread overview]
Message-ID: <d77e674cc88ac411e66444192b9f365a75677596.1541400730.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1541400730.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1541400730.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

Replace the hard-coded assumptions about the partition order by the
exact partition number as wic has calculated it for us.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta-isar/scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta-isar/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta-isar/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index 38f6fc0..44ce399 100644
--- a/meta-isar/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta-isar/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -44,7 +44,7 @@ class BootimgEFIPlugin(SourcePlugin):
     name = 'bootimg-efi-isar'
 
     @classmethod
-    def do_configure_grubefi(cls, creator, cr_workdir):
+    def do_configure_grubefi(cls, creator, cr_workdir, bootpart):
         """
         Create loader-specific (grub-efi) config
         """
@@ -69,7 +69,9 @@ class BootimgEFIPlugin(SourcePlugin):
             grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n"
             grubefi_conf += "default=boot\n"
             grubefi_conf += "timeout=%s\n" % bootloader.timeout
-            grubefi_conf += "set root='hd0,gpt2'\n"
+            for part in creator.parts:
+                if part.mountpoint == "/":
+                    grubefi_conf += "set root='hd0,gpt%d'\n" % part.realnum
             grubefi_conf += "menuentry 'boot'{\n"
 
             kernel = "/vmlinuz"
@@ -90,7 +92,7 @@ class BootimgEFIPlugin(SourcePlugin):
         cfg.close()
 
         cfg = open("%s/hdd/boot/EFI/BOOT/grub-mkimage.cfg" % cr_workdir, "w")
-        mkimage_conf = "set root='hd0,gpt1'\n"
+        mkimage_conf = "set root='hd0,gpt%d'\n" % bootpart.realnum
         mkimage_conf += "set prefix=($root)/EFI/BOOT\n"
         cfg.write(mkimage_conf)
         cfg.close()
@@ -178,7 +180,7 @@ class BootimgEFIPlugin(SourcePlugin):
 
         try:
             if source_params['loader'] == 'grub-efi':
-                cls.do_configure_grubefi(creator, cr_workdir)
+                cls.do_configure_grubefi(creator, cr_workdir, part)
             elif source_params['loader'] == 'systemd-boot':
                 cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params)
             else:
-- 
2.16.4


  parent reply	other threads:[~2018-11-05  6:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05  6:52 [PATCH 00/10] HiKey and DE0 Nano SoC boards, further improvements and cleanups Jan Kiszka
2018-11-05  6:52 ` [PATCH 01/10] meta: builchroot: Preserve environment when calling dpkg-buildpackage Jan Kiszka
2018-11-05  9:41   ` Henning Schild
2018-11-05  9:46     ` Jan Kiszka
2018-11-05 10:05   ` Henning Schild
2018-11-05 10:16     ` [PATCH v2 " Jan Kiszka
2018-11-05 14:15     ` [PATCH " Baurzhan Ismagulov
2018-11-05 14:25       ` Jan Kiszka
2018-11-05 15:36       ` Henning Schild
2018-11-06 10:53         ` Baurzhan Ismagulov
2018-11-05  6:52 ` [PATCH 02/10] meta-isar: Remove remaining wheezy traces Jan Kiszka
2018-11-09 14:22   ` Baurzhan Ismagulov
2018-11-05  6:52 ` [PATCH 03/10] meta-isar: linux: Update mainline recipe to 4.19 Jan Kiszka
2018-11-05  6:52 ` [PATCH 04/10] meta-isar: example-module: Only disable cross-compilation for Debian kernels Jan Kiszka
2018-11-05  6:52 ` [PATCH 05/10] meta-isar: Add Terasic DE0-Nano-SoC as demonstration board Jan Kiszka
2018-11-05  6:52 ` [PATCH 06/10] meta-isar: Add LeMaker HiKey board Jan Kiszka
2018-11-05  6:52 ` [PATCH 07/10] meta: linux-module: Fix arm64 cross-build Jan Kiszka
2018-11-05  6:52 ` [PATCH 08/10] wic: bootimg-efi-isar: Avoid append "None" to kernel command line Jan Kiszka
2018-11-05  6:52 ` Jan Kiszka [this message]
2018-11-05  6:52 ` [PATCH 10/10] image: Add install_image_deps to cache_base_repo dependencies Jan Kiszka
2018-11-06  9:59 ` [PATCH 00/10] HiKey and DE0 Nano SoC boards, further improvements and cleanups Maxim Yu. Osipov
2018-11-06 10:49   ` Baurzhan Ismagulov
2018-11-06 10:51     ` Jan Kiszka
2018-11-07 13:11 ` Maxim Yu. Osipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d77e674cc88ac411e66444192b9f365a75677596.1541400730.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox