From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Nishanth Menon <nm@ti.com>
Subject: [PATCH v2 08/11] wic: Add hybrid-boot bootloader source plugin
Date: Sun, 14 Jan 2024 14:39:31 +0100 [thread overview]
Message-ID: <74c8eb194dee34263799e64e96bcd1dfff45a105.1705239574.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1705239574.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Creates a hybrid partition table of both GPT and DOS, only adding the
first active partition to the DOS table. This addresses use cases where
the (firmware-)bootable partition is not the EFI partition while EFI
should be used later on. The bootimg-biosplusefi does not suite here.
Usage in a wks file:
part /bootable-partition --active ...
part / ...
bootloader --source hybrid-boot ...
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../lib/wic/plugins/source/hybrid-boot.py | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 meta/scripts/lib/wic/plugins/source/hybrid-boot.py
diff --git a/meta/scripts/lib/wic/plugins/source/hybrid-boot.py b/meta/scripts/lib/wic/plugins/source/hybrid-boot.py
new file mode 100644
index 00000000..c73e89e6
--- /dev/null
+++ b/meta/scripts/lib/wic/plugins/source/hybrid-boot.py
@@ -0,0 +1,38 @@
+#
+# Copyright (c) Siemens AG, 2024
+#
+# SPDX-License-Identifier: MIT
+#
+# DESCRIPTION
+# This creates a hybrid DOS partition table for a GPT disk, adding the
+# partition marked as bootable to that table. This is useful if the boot
+# partition is different from the EFI partition so that bootimg-biosplusefi
+# cannot be used. Implemented as bootloader source plugin.
+
+import logging
+
+from wic import WicError
+from wic.pluginbase import SourcePlugin
+from wic.misc import exec_native_cmd
+
+logger = logging.getLogger('wic')
+
+class HybridBoot(SourcePlugin):
+ """
+ Create hybrid partition table with a single bootable partition.
+ """
+
+ name = 'hybrid-boot'
+
+ @classmethod
+ def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
+ bootimg_dir, kernel_dir, native_sysroot):
+ for part in creator.parts:
+ if part.active:
+ break
+ else:
+ raise WicError("No active partition found")
+
+ logger.info("Creating hybrid partition table, using partition %d as bootable DOS partition" % part.realnum)
+ exec_native_cmd("sgdisk %s --hybrid %d:EE" % (disk.path, part.realnum), native_sysroot)
+ exec_native_cmd("sfdisk --label-nested dos -A %s %d" % (disk.path, part.realnum), native_sysroot)
--
2.35.3
next prev parent reply other threads:[~2024-01-14 13:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-14 13:39 [PATCH v2 00/11] Add support for BeaglePlay Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 01/11] meta-isar: linux-mainline: Update to 6.6.11 Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 02/11] optee-os: Switch default binary to tee-raw.bin Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 03/11] u-boot-custom: Allow to set BL31 and TEE from recipes Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 04/11] u-boot-custom: Allow to define different installation binaries Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 05/11] beagleplay: Add TF-A recipe Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 06/11] beagleplay: Add OP-TEE recipe Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 07/11] beagleplay: Add U-Boot recipe Jan Kiszka
2024-01-14 13:39 ` Jan Kiszka [this message]
2024-01-14 13:39 ` [PATCH v2 09/11] expand-on-first-boot: Preserve MBR on expansion of GPT disks Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 10/11] Add support for the BeaglePlay board Jan Kiszka
2024-01-14 13:39 ` [PATCH v2 11/11] ci: Add beagleplay to full CI test Jan Kiszka
2024-03-20 15:17 ` [PATCH v2 00/11] Add support for BeaglePlay Uladzimir Bely
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=74c8eb194dee34263799e64e96bcd1dfff45a105.1705239574.git.jan.kiszka@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=nm@ti.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