public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 0/4] Add support for dual bios + efi disk generation
@ 2022-03-04 15:25 Felix Moessbauer
  2022-03-04 15:25 ` [PATCH 1/4] Copy efi-plus-pcbios script from OE Felix Moessbauer
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Felix Moessbauer @ 2022-03-04 15:25 UTC (permalink / raw)
  To: isar-users; +Cc: henning.schild, adriaan.schmidt, jan.kiszka, Felix Moessbauer

This patch ports the bios + efi disk support from OE to ISAR.
By that, the generated disk can be booted both with EFI as well
as with PCBIOS.

Please note, that patches 2 and 3 do not work independently,
but are split for easier refactoring of the isarpluginsbase class.

Best regards,
Felix

Felix Moessbauer (3):
  Copy efi-plus-pcbios script from OE
  Add ISAR version of biosplusefi WIC plugin
  test: add target for efi-plus-pcbios image type

Henning Schild (1):
  wic: biosplusefi: make sure sub-plugins can import isarpluginbase

 .../conf/multiconfig/qemuamd64-buster.conf    |   2 +
 .../lib/wic/canned-wks/efi-plus-pcbios.wks    |   6 +
 .../source/bootimg-biosplusefi-isar.py        | 205 ++++++++++++++++++
 .../wic/plugins/source/bootimg-efi-isar.py    |   6 +-
 .../wic/plugins/source/bootimg-pcbios-isar.py |   6 +-
 5 files changed, 221 insertions(+), 4 deletions(-)
 create mode 100644 meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
 create mode 100644 meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py

-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] Copy efi-plus-pcbios script from OE
  2022-03-04 15:25 [PATCH 0/4] Add support for dual bios + efi disk generation Felix Moessbauer
@ 2022-03-04 15:25 ` Felix Moessbauer
  2022-03-04 15:25 ` [PATCH 2/4] Add ISAR version of biosplusefi WIC plugin Felix Moessbauer
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Felix Moessbauer @ 2022-03-04 15:25 UTC (permalink / raw)
  To: isar-users; +Cc: henning.schild, adriaan.schmidt, jan.kiszka, Felix Moessbauer

This adds a baseline for further modification to the efi-plus-pcbios
WIC script. It helps to keep track of the ISAR related changes.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 .../source/bootimg-biosplusefi-isar.py        | 213 ++++++++++++++++++
 1 file changed, 213 insertions(+)
 create mode 100644 meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
new file mode 100644
index 00000000..5bd73906
--- /dev/null
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
@@ -0,0 +1,213 @@
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# DESCRIPTION
+# This implements the 'bootimg-biosplusefi' source plugin class for 'wic'
+#
+# AUTHORS
+# William Bourque <wbourque [at) gmail.com>
+
+import types
+
+from wic.pluginbase import SourcePlugin
+from importlib.machinery import SourceFileLoader
+
+class BootimgBiosPlusEFIPlugin(SourcePlugin):
+    """
+    Create MBR + EFI boot partition
+
+    This plugin creates a boot partition that contains both
+    legacy BIOS and EFI content. It will be able to boot from both.
+    This is useful when managing PC fleet with some older machines
+    without EFI support.
+
+    Note it is possible to create an image that can boot from both
+    legacy BIOS and EFI by defining two partitions : one with arg
+    --source bootimg-efi  and another one with --source bootimg-pcbios.
+    However, this method has the obvious downside that it requires TWO
+    partitions to be created on the storage device.
+    Both partitions will also be marked as "bootable" which does not work on
+    most BIOS, has BIOS often uses the "bootable" flag to determine
+    what to boot. If you have such a BIOS, you need to manually remove the
+    "bootable" flag from the EFI partition for the drive to be bootable.
+    Having two partitions also seems to confuse wic : the content of
+    the first partition will be duplicated into the second, even though it
+    will not be used at all.
+
+    Also, unlike "isoimage-isohybrid" that also does BIOS and EFI, this plugin
+    allows you to have more than only a single rootfs partitions and does
+    not turn the rootfs into an initramfs RAM image.
+
+    This plugin is made to put everything into a single /boot partition so it
+    does not have the limitations listed above.
+
+    The plugin is made so it does tries not to reimplement what's already
+    been done in other plugins; as such it imports "bootimg-pcbios"
+    and "bootimg-efi".
+    Plugin "bootimg-pcbios" is used to generate legacy BIOS boot.
+    Plugin "bootimg-efi" is used to generate the UEFI boot. Note that it
+    requires a --sourceparams argument to know which loader to use; refer
+    to "bootimg-efi" code/documentation for the list of loader.
+
+    Imports are handled with "SourceFileLoader" from importlib as it is
+    otherwise very difficult to import module that has hyphen "-" in their
+    filename.
+    The SourcePlugin() methods used in the plugins (do_install_disk,
+    do_configure_partition, do_prepare_partition) are then called on both,
+    beginning by "bootimg-efi".
+
+    Plugin options, such as "--sourceparams" can still be passed to a
+    plugin, as long they does not cause issue in the other plugin.
+
+    Example wic configuration:
+    part /boot --source bootimg-biosplusefi --sourceparams="loader=grub-efi"\\
+               --ondisk sda --label os_boot --active --align 1024 --use-uuid
+    """
+
+    name = 'bootimg-biosplusefi'
+
+    __PCBIOS_MODULE_NAME = "bootimg-pcbios"
+    __EFI_MODULE_NAME = "bootimg-efi"
+
+    __imgEFIObj = None
+    __imgBiosObj = None
+
+    @classmethod
+    def __init__(cls):
+        """
+        Constructor (init)
+        """
+
+        # XXX
+        # For some reasons, __init__ constructor is never called.
+        # Something to do with how pluginbase works?
+        cls.__instanciateSubClasses()
+
+    @classmethod
+    def __instanciateSubClasses(cls):
+        """
+
+        """
+
+        # Import bootimg-pcbios (class name "BootimgPcbiosPlugin")
+        modulePath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+                                  cls.__PCBIOS_MODULE_NAME + ".py")
+        loader = SourceFileLoader(cls.__PCBIOS_MODULE_NAME, modulePath)
+        mod = types.ModuleType(loader.name)
+        loader.exec_module(mod)
+        cls.__imgBiosObj = mod.BootimgPcbiosPlugin()
+
+        # Import bootimg-efi (class name "BootimgEFIPlugin")
+        modulePath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+                                  cls.__EFI_MODULE_NAME + ".py")
+        loader = SourceFileLoader(cls.__EFI_MODULE_NAME, modulePath)
+        mod = types.ModuleType(loader.name)
+        loader.exec_module(mod)
+        cls.__imgEFIObj = mod.BootimgEFIPlugin()
+
+    @classmethod
+    def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
+                        bootimg_dir, kernel_dir, native_sysroot):
+        """
+        Called after all partitions have been prepared and assembled into a
+        disk image.
+        """
+
+        if ( (not cls.__imgEFIObj) or (not cls.__imgBiosObj) ):
+            cls.__instanciateSubClasses()
+
+        cls.__imgEFIObj.do_install_disk(
+            disk,
+            disk_name,
+            creator,
+            workdir,
+            oe_builddir,
+            bootimg_dir,
+            kernel_dir,
+            native_sysroot)
+
+        cls.__imgBiosObj.do_install_disk(
+            disk,
+            disk_name,
+            creator,
+            workdir,
+            oe_builddir,
+            bootimg_dir,
+            kernel_dir,
+            native_sysroot)
+
+    @classmethod
+    def do_configure_partition(cls, part, source_params, creator, cr_workdir,
+                               oe_builddir, bootimg_dir, kernel_dir,
+                               native_sysroot):
+        """
+        Called before do_prepare_partition()
+        """
+
+        if ( (not cls.__imgEFIObj) or (not cls.__imgBiosObj) ):
+            cls.__instanciateSubClasses()
+
+        cls.__imgEFIObj.do_configure_partition(
+            part,
+            source_params,
+            creator,
+            cr_workdir,
+            oe_builddir,
+            bootimg_dir,
+            kernel_dir,
+            native_sysroot)
+
+        cls.__imgBiosObj.do_configure_partition(
+            part,
+            source_params,
+            creator,
+            cr_workdir,
+            oe_builddir,
+            bootimg_dir,
+            kernel_dir,
+            native_sysroot)
+
+    @classmethod
+    def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
+                             oe_builddir, bootimg_dir, kernel_dir,
+                             rootfs_dir, native_sysroot):
+        """
+        Called to do the actual content population for a partition i.e. it
+        'prepares' the partition to be incorporated into the image.
+        """
+
+        if ( (not cls.__imgEFIObj) or (not cls.__imgBiosObj) ):
+            cls.__instanciateSubClasses()
+
+        cls.__imgEFIObj.do_prepare_partition(
+            part,
+            source_params,
+            creator,
+            cr_workdir,
+            oe_builddir,
+            bootimg_dir,
+            kernel_dir,
+            rootfs_dir,
+            native_sysroot)
+
+        cls.__imgBiosObj.do_prepare_partition(
+            part,
+            source_params,
+            creator,
+            cr_workdir,
+            oe_builddir,
+            bootimg_dir,
+            kernel_dir,
+            rootfs_dir,
+            native_sysroot)
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/4] Add ISAR version of biosplusefi WIC plugin
  2022-03-04 15:25 [PATCH 0/4] Add support for dual bios + efi disk generation Felix Moessbauer
  2022-03-04 15:25 ` [PATCH 1/4] Copy efi-plus-pcbios script from OE Felix Moessbauer
@ 2022-03-04 15:25 ` Felix Moessbauer
  2022-03-04 16:33   ` Henning Schild
  2022-03-04 15:25 ` [PATCH 3/4] wic: biosplusefi: make sure sub-plugins can import isarpluginbase Felix Moessbauer
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Felix Moessbauer @ 2022-03-04 15:25 UTC (permalink / raw)
  To: isar-users; +Cc: henning.schild, adriaan.schmidt, jan.kiszka, Felix Moessbauer

This patch adds support to create a disk image that works with both
EFI and legacy bios. The biosplusefi-isar is based on the original
biosplusefi WIC plugin that internally calls the bootimg-pcbios and
bootimg-efi. By that, code duplication can be avoided.

The generated image can be booted with EFI or legacy pcbios.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 .../source/bootimg-biosplusefi-isar.py        | 24 +++++++------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
index 5bd73906..6bb15cd9 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
@@ -1,22 +1,14 @@
 #
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# Imported from openembedded-core
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # DESCRIPTION
-# This implements the 'bootimg-biosplusefi' source plugin class for 'wic'
+# This implements the 'bootimg-biosplusefi-isar' source plugin class for 'wic'
 #
 # AUTHORS
 # William Bourque <wbourque [at) gmail.com>
+# Felix Moessbauer <felix.moessbauer (at] siemens.com>
 
 import types
 
@@ -75,10 +67,10 @@ class BootimgBiosPlusEFIPlugin(SourcePlugin):
                --ondisk sda --label os_boot --active --align 1024 --use-uuid
     """
 
-    name = 'bootimg-biosplusefi'
+    name = 'bootimg-biosplusefi-isar'
 
-    __PCBIOS_MODULE_NAME = "bootimg-pcbios"
-    __EFI_MODULE_NAME = "bootimg-efi"
+    __PCBIOS_MODULE_NAME = "bootimg-pcbios-isar"
+    __EFI_MODULE_NAME = "bootimg-efi-isar"
 
     __imgEFIObj = None
     __imgBiosObj = None
@@ -106,7 +98,7 @@ class BootimgBiosPlusEFIPlugin(SourcePlugin):
         loader = SourceFileLoader(cls.__PCBIOS_MODULE_NAME, modulePath)
         mod = types.ModuleType(loader.name)
         loader.exec_module(mod)
-        cls.__imgBiosObj = mod.BootimgPcbiosPlugin()
+        cls.__imgBiosObj = mod.BootimgPcbiosIsarPlugin()
 
         # Import bootimg-efi (class name "BootimgEFIPlugin")
         modulePath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/4] wic: biosplusefi: make sure sub-plugins can import isarpluginbase
  2022-03-04 15:25 [PATCH 0/4] Add support for dual bios + efi disk generation Felix Moessbauer
  2022-03-04 15:25 ` [PATCH 1/4] Copy efi-plus-pcbios script from OE Felix Moessbauer
  2022-03-04 15:25 ` [PATCH 2/4] Add ISAR version of biosplusefi WIC plugin Felix Moessbauer
@ 2022-03-04 15:25 ` Felix Moessbauer
  2022-03-04 16:34   ` Henning Schild
  2022-03-04 15:25 ` [PATCH 4/4] test: add target for efi-plus-pcbios image type Felix Moessbauer
  2022-03-04 21:26 ` [PATCH 0/4] Add support for dual bios + efi disk generation Henning Schild
  4 siblings, 1 reply; 10+ messages in thread
From: Felix Moessbauer @ 2022-03-04 15:25 UTC (permalink / raw)
  To: isar-users; +Cc: henning.schild, adriaan.schmidt, jan.kiszka, Felix Moessbauer

From: Henning Schild <henning.schild@siemens.com>

The plugin calls other plugins, which in our case use isarpluginbase.
Make sure that will be in the path so that it can be imported.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Acked-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py    | 6 ++++--
 meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index d9712548..5ba0777a 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -23,8 +23,10 @@ from wic.pluginbase import SourcePlugin
 from wic.misc import (exec_cmd, exec_native_cmd,
                       get_bitbake_var, BOOTDD_EXTRA_SPACE)
 
-import sys
-sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.."
+# allow plugins to import from isarpluginbase
+if '__file__' in globals():
+    import sys
+    sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
 from isarpluginbase import (isar_get_filenames, isar_populate_boot_cmd)
 
 logger = logging.getLogger('wic')
diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
index f493890f..9136d4f2 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
@@ -20,8 +20,10 @@ from wic.pluginbase import SourcePlugin
 from wic.misc import (exec_cmd, exec_native_cmd,
                       get_bitbake_var, BOOTDD_EXTRA_SPACE)
 
-import sys
-sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.."
+# allow plugins to import from isarpluginbase
+if '__file__' in globals():
+    import sys
+    sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
 from isarpluginbase import (isar_get_filenames, isar_populate_boot_cmd)
 
 logger = logging.getLogger('wic')
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/4] test: add target for efi-plus-pcbios image type
  2022-03-04 15:25 [PATCH 0/4] Add support for dual bios + efi disk generation Felix Moessbauer
                   ` (2 preceding siblings ...)
  2022-03-04 15:25 ` [PATCH 3/4] wic: biosplusefi: make sure sub-plugins can import isarpluginbase Felix Moessbauer
@ 2022-03-04 15:25 ` Felix Moessbauer
  2022-03-04 16:41   ` Henning Schild
  2022-03-04 21:26 ` [PATCH 0/4] Add support for dual bios + efi disk generation Henning Schild
  4 siblings, 1 reply; 10+ messages in thread
From: Felix Moessbauer @ 2022-03-04 15:25 UTC (permalink / raw)
  To: isar-users; +Cc: henning.schild, adriaan.schmidt, jan.kiszka, Felix Moessbauer

This patch switches the qemuamd64-buster mc target to generate
a efi-plus-pcbios image.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta-isar/conf/multiconfig/qemuamd64-buster.conf         | 2 ++
 meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks | 6 ++++++
 2 files changed, 8 insertions(+)
 create mode 100644 meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks

diff --git a/meta-isar/conf/multiconfig/qemuamd64-buster.conf b/meta-isar/conf/multiconfig/qemuamd64-buster.conf
index 5615198d..44fe8af9 100644
--- a/meta-isar/conf/multiconfig/qemuamd64-buster.conf
+++ b/meta-isar/conf/multiconfig/qemuamd64-buster.conf
@@ -2,5 +2,7 @@
 
 MACHINE ?= "qemuamd64"
 DISTRO ?= "debian-buster"
+WKS_FILE ?= "efi-plus-pcbios.wks"
+IMAGER_INSTALL += "${SYSLINUX_BOOTLOADER_INSTALL}"
 
 IMAGE_FSTYPES ?= "wic-img ext4-img"
diff --git a/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks b/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
new file mode 100644
index 00000000..7b78104e
--- /dev/null
+++ b/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
@@ -0,0 +1,6 @@
+# Example to show how to create an efi + pcbios image
+# Note, that the loader argument is mandatory. But systemd-boot also works.
+part /boot --source bootimg-biosplusefi-isar --sourceparams="loader=grub-efi" --label boot --active --align 1024
+part / --source rootfs --ondisk sda --fstype=ext4 --mkfs-extraopts "-T default" --label platform --align 1024 --exclude-path=boot
+
+bootloader  --timeout=0  --append "rootwait rootfstype=ext4 video=vesafb vga=0x318 console=tty0 console=ttyS0,115200n8"
-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] Add ISAR version of biosplusefi WIC plugin
  2022-03-04 15:25 ` [PATCH 2/4] Add ISAR version of biosplusefi WIC plugin Felix Moessbauer
@ 2022-03-04 16:33   ` Henning Schild
  0 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2022-03-04 16:33 UTC (permalink / raw)
  To: Felix Moessbauer; +Cc: isar-users, adriaan.schmidt, jan.kiszka

Am Fri, 4 Mar 2022 16:25:51 +0100
schrieb Felix Moessbauer <felix.moessbauer@siemens.com>:

> This patch adds support to create a disk image that works with both
> EFI and legacy bios. The biosplusefi-isar is based on the original
> biosplusefi WIC plugin that internally calls the bootimg-pcbios and
> bootimg-efi. By that, code duplication can be avoided.
> 
> The generated image can be booted with EFI or legacy pcbios.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  .../source/bootimg-biosplusefi-isar.py        | 24
> +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git
> a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
> b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
> index 5bd73906..6bb15cd9 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py @@
> -1,22 +1,14 @@ # -# This program is free software; you can
> redistribute it and/or modify -# it under the terms of the GNU
> General Public License version 2 as -# published by the Free Software
> Foundation. +# Imported from openembedded-core
>  #
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> along -# with this program; if not, write to the Free Software
> Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA. +# SPDX-License-Identifier: GPL-2.0-only
>  #
>  # DESCRIPTION
> -# This implements the 'bootimg-biosplusefi' source plugin class for
> 'wic' +# This implements the 'bootimg-biosplusefi-isar' source plugin
> class for 'wic' #

Please do not touch any of that, you are just asking for merge
conflicts if someone finds a typo or adds words ...

>  # AUTHORS
>  # William Bourque <wbourque [at) gmail.com>
> +# Felix Moessbauer <felix.moessbauer (at] siemens.com>

same here, unless you are super proud to add a few "isar" here and
there, not a noteworthy contrib

Henning

>  import types
>  
> @@ -75,10 +67,10 @@ class BootimgBiosPlusEFIPlugin(SourcePlugin):
>                 --ondisk sda --label os_boot --active --align 1024
> --use-uuid """
>  
> -    name = 'bootimg-biosplusefi'
> +    name = 'bootimg-biosplusefi-isar'
>  
> -    __PCBIOS_MODULE_NAME = "bootimg-pcbios"
> -    __EFI_MODULE_NAME = "bootimg-efi"
> +    __PCBIOS_MODULE_NAME = "bootimg-pcbios-isar"
> +    __EFI_MODULE_NAME = "bootimg-efi-isar"
>  
>      __imgEFIObj = None
>      __imgBiosObj = None
> @@ -106,7 +98,7 @@ class BootimgBiosPlusEFIPlugin(SourcePlugin):
>          loader = SourceFileLoader(cls.__PCBIOS_MODULE_NAME,
> modulePath) mod = types.ModuleType(loader.name)
>          loader.exec_module(mod)
> -        cls.__imgBiosObj = mod.BootimgPcbiosPlugin()
> +        cls.__imgBiosObj = mod.BootimgPcbiosIsarPlugin()
>  
>          # Import bootimg-efi (class name "BootimgEFIPlugin")
>          modulePath =
> os.path.join(os.path.dirname(os.path.realpath(__file__)),


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] wic: biosplusefi: make sure sub-plugins can import isarpluginbase
  2022-03-04 15:25 ` [PATCH 3/4] wic: biosplusefi: make sure sub-plugins can import isarpluginbase Felix Moessbauer
@ 2022-03-04 16:34   ` Henning Schild
  0 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2022-03-04 16:34 UTC (permalink / raw)
  To: Felix Moessbauer; +Cc: isar-users, adriaan.schmidt, jan.kiszka

Am Fri, 4 Mar 2022 16:25:52 +0100
schrieb Felix Moessbauer <felix.moessbauer@siemens.com>:

> From: Henning Schild <henning.schild@siemens.com>
> 
> The plugin calls other plugins, which in our case use isarpluginbase.
> Make sure that will be in the path so that it can be imported.

I gave you a wrong commit message, please update according to what i
gave you off list.

My bad.

Henning

> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> Acked-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py    | 6 ++++--
>  meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py | 6 ++++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index
> d9712548..5ba0777a 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -23,8
> +23,10 @@ from wic.pluginbase import SourcePlugin from wic.misc
> import (exec_cmd, exec_native_cmd, get_bitbake_var,
> BOOTDD_EXTRA_SPACE) 
> -import sys
> -sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.."
> +# allow plugins to import from isarpluginbase
> +if '__file__' in globals():
> +    import sys
> +    sys.path.append(os.path.dirname(os.path.abspath(__file__)) +
> "/..") from isarpluginbase import (isar_get_filenames,
> isar_populate_boot_cmd) 
>  logger = logging.getLogger('wic')
> diff --git
> a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
> b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py index
> f493890f..9136d4f2 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py @@ -20,8
> +20,10 @@ from wic.pluginbase import SourcePlugin from wic.misc
> import (exec_cmd, exec_native_cmd, get_bitbake_var,
> BOOTDD_EXTRA_SPACE) -import sys
> -sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.."
> +# allow plugins to import from isarpluginbase
> +if '__file__' in globals():
> +    import sys
> +    sys.path.append(os.path.dirname(os.path.abspath(__file__)) +
> "/..") from isarpluginbase import (isar_get_filenames,
> isar_populate_boot_cmd) 
>  logger = logging.getLogger('wic')


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] test: add target for efi-plus-pcbios image type
  2022-03-04 15:25 ` [PATCH 4/4] test: add target for efi-plus-pcbios image type Felix Moessbauer
@ 2022-03-04 16:41   ` Henning Schild
  2022-03-04 21:28     ` Henning Schild
  0 siblings, 1 reply; 10+ messages in thread
From: Henning Schild @ 2022-03-04 16:41 UTC (permalink / raw)
  To: Felix Moessbauer; +Cc: isar-users, adriaan.schmidt, jan.kiszka

Am Fri, 4 Mar 2022 16:25:53 +0100
schrieb Felix Moessbauer <felix.moessbauer@siemens.com>:

> This patch switches the qemuamd64-buster mc target to generate
> a efi-plus-pcbios image.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta-isar/conf/multiconfig/qemuamd64-buster.conf         | 2 ++
>  meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks | 6 ++++++
>  2 files changed, 8 insertions(+)
>  create mode 100644
> meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
> 
> diff --git a/meta-isar/conf/multiconfig/qemuamd64-buster.conf
> b/meta-isar/conf/multiconfig/qemuamd64-buster.conf index
> 5615198d..44fe8af9 100644 ---
> a/meta-isar/conf/multiconfig/qemuamd64-buster.conf +++
> b/meta-isar/conf/multiconfig/qemuamd64-buster.conf @@ -2,5 +2,7 @@
>  
>  MACHINE ?= "qemuamd64"
>  DISTRO ?= "debian-buster"
> +WKS_FILE ?= "efi-plus-pcbios.wks"
> +IMAGER_INSTALL += "${SYSLINUX_BOOTLOADER_INSTALL}"
>  
>  IMAGE_FSTYPES ?= "wic-img ext4-img"
> diff --git a/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
> b/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks new file
> mode 100644 index 00000000..7b78104e
> --- /dev/null
> +++ b/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
> @@ -0,0 +1,6 @@
> +# Example to show how to create an efi + pcbios image
> +# Note, that the loader argument is mandatory. But systemd-boot also
> works. +part /boot --source bootimg-biosplusefi-isar
> --sourceparams="loader=grub-efi" --label boot --active --align 1024
> +part / --source rootfs --ondisk sda --fstype=ext4 --mkfs-extraopts
> "-T default" --label platform --align 1024 --exclude-path=boot +
> +bootloader  --timeout=0  --append "rootwait rootfstype=ext4
> video=vesafb vga=0x318 console=tty0 console=ttyS0,115200n8"

i would take more inspiration from the
meta-isar/scripts/lib/wic/canned-wks/sdimage-efi* guys

vga= and video=vesafb are very "bios" centric things, in uefi there is
efifb and no vesa

i guess
bootloader --ptable gpt --timeout 3 --append "rootwait
console=ttyS0,115200 console=tty0"

will work just fine

Henning

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/4] Add support for dual bios + efi disk generation
  2022-03-04 15:25 [PATCH 0/4] Add support for dual bios + efi disk generation Felix Moessbauer
                   ` (3 preceding siblings ...)
  2022-03-04 15:25 ` [PATCH 4/4] test: add target for efi-plus-pcbios image type Felix Moessbauer
@ 2022-03-04 21:26 ` Henning Schild
  4 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2022-03-04 21:26 UTC (permalink / raw)
  To: Felix Moessbauer; +Cc: isar-users, adriaan.schmidt, jan.kiszka

This in fact is a very cool feature with minimal porting effort, the
"fork" from the original from OE is really just naming to call out
sub-plugins for bios and uefi.

What you get are USB sticks that "just work", and VM images that just
work. We have been using that in downstream layer for a long time.

Henning

Am Fri, 4 Mar 2022 16:25:49 +0100
schrieb Felix Moessbauer <felix.moessbauer@siemens.com>:

> This patch ports the bios + efi disk support from OE to ISAR.
> By that, the generated disk can be booted both with EFI as well
> as with PCBIOS.
> 
> Please note, that patches 2 and 3 do not work independently,
> but are split for easier refactoring of the isarpluginsbase class.
> 
> Best regards,
> Felix
> 
> Felix Moessbauer (3):
>   Copy efi-plus-pcbios script from OE
>   Add ISAR version of biosplusefi WIC plugin
>   test: add target for efi-plus-pcbios image type
> 
> Henning Schild (1):
>   wic: biosplusefi: make sure sub-plugins can import isarpluginbase
> 
>  .../conf/multiconfig/qemuamd64-buster.conf    |   2 +
>  .../lib/wic/canned-wks/efi-plus-pcbios.wks    |   6 +
>  .../source/bootimg-biosplusefi-isar.py        | 205
> ++++++++++++++++++ .../wic/plugins/source/bootimg-efi-isar.py    |
> 6 +- .../wic/plugins/source/bootimg-pcbios-isar.py |   6 +-
>  5 files changed, 221 insertions(+), 4 deletions(-)
>  create mode 100644
> meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks create mode
> 100644 meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] test: add target for efi-plus-pcbios image type
  2022-03-04 16:41   ` Henning Schild
@ 2022-03-04 21:28     ` Henning Schild
  0 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2022-03-04 21:28 UTC (permalink / raw)
  To: Felix Moessbauer; +Cc: isar-users, adriaan.schmidt, jan.kiszka

I think the real test would be to also modify the script starting the
VM waiting for the login prompt, it should boot both ways for at least
one image using this wks.

Henning

Am Fri, 4 Mar 2022 17:41:38 +0100
schrieb Henning Schild <henning.schild@siemens.com>:

> Am Fri, 4 Mar 2022 16:25:53 +0100
> schrieb Felix Moessbauer <felix.moessbauer@siemens.com>:
> 
> > This patch switches the qemuamd64-buster mc target to generate
> > a efi-plus-pcbios image.
> > 
> > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > ---
> >  meta-isar/conf/multiconfig/qemuamd64-buster.conf         | 2 ++
> >  meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks | 6 ++++++
> >  2 files changed, 8 insertions(+)
> >  create mode 100644
> > meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
> > 
> > diff --git a/meta-isar/conf/multiconfig/qemuamd64-buster.conf
> > b/meta-isar/conf/multiconfig/qemuamd64-buster.conf index
> > 5615198d..44fe8af9 100644 ---
> > a/meta-isar/conf/multiconfig/qemuamd64-buster.conf +++
> > b/meta-isar/conf/multiconfig/qemuamd64-buster.conf @@ -2,5 +2,7 @@
> >  
> >  MACHINE ?= "qemuamd64"
> >  DISTRO ?= "debian-buster"
> > +WKS_FILE ?= "efi-plus-pcbios.wks"
> > +IMAGER_INSTALL += "${SYSLINUX_BOOTLOADER_INSTALL}"
> >  
> >  IMAGE_FSTYPES ?= "wic-img ext4-img"
> > diff --git
> > a/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
> > b/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks new file
> > mode 100644 index 00000000..7b78104e --- /dev/null
> > +++ b/meta-isar/scripts/lib/wic/canned-wks/efi-plus-pcbios.wks
> > @@ -0,0 +1,6 @@
> > +# Example to show how to create an efi + pcbios image
> > +# Note, that the loader argument is mandatory. But systemd-boot
> > also works. +part /boot --source bootimg-biosplusefi-isar
> > --sourceparams="loader=grub-efi" --label boot --active --align 1024
> > +part / --source rootfs --ondisk sda --fstype=ext4 --mkfs-extraopts
> > "-T default" --label platform --align 1024 --exclude-path=boot +
> > +bootloader  --timeout=0  --append "rootwait rootfstype=ext4
> > video=vesafb vga=0x318 console=tty0 console=ttyS0,115200n8"  
> 
> i would take more inspiration from the
> meta-isar/scripts/lib/wic/canned-wks/sdimage-efi* guys
> 
> vga= and video=vesafb are very "bios" centric things, in uefi there is
> efifb and no vesa
> 
> i guess
> bootloader --ptable gpt --timeout 3 --append "rootwait
> console=ttyS0,115200 console=tty0"
> 
> will work just fine
> 
> Henning
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-03-04 21:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 15:25 [PATCH 0/4] Add support for dual bios + efi disk generation Felix Moessbauer
2022-03-04 15:25 ` [PATCH 1/4] Copy efi-plus-pcbios script from OE Felix Moessbauer
2022-03-04 15:25 ` [PATCH 2/4] Add ISAR version of biosplusefi WIC plugin Felix Moessbauer
2022-03-04 16:33   ` Henning Schild
2022-03-04 15:25 ` [PATCH 3/4] wic: biosplusefi: make sure sub-plugins can import isarpluginbase Felix Moessbauer
2022-03-04 16:34   ` Henning Schild
2022-03-04 15:25 ` [PATCH 4/4] test: add target for efi-plus-pcbios image type Felix Moessbauer
2022-03-04 16:41   ` Henning Schild
2022-03-04 21:28     ` Henning Schild
2022-03-04 21:26 ` [PATCH 0/4] Add support for dual bios + efi disk generation Henning Schild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox