* [PATCH v3 1/7] Copy efi-plus-pcbios script from OE
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
@ 2022-03-22 16:45 ` Felix Moessbauer
2022-03-22 16:45 ` [PATCH v3 2/7] Add ISAR version of biosplusefi WIC plugin Felix Moessbauer
` (7 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Felix Moessbauer @ 2022-03-22 16:45 UTC (permalink / raw)
To: isar-users
Cc: amikan, henning.schild, jan.kiszka, adriaan.schmidt, 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] 13+ messages in thread
* [PATCH v3 2/7] Add ISAR version of biosplusefi WIC plugin
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
2022-03-22 16:45 ` [PATCH v3 1/7] Copy efi-plus-pcbios script from OE Felix Moessbauer
@ 2022-03-22 16:45 ` Felix Moessbauer
2022-03-28 8:51 ` Henning Schild
2022-03-22 16:45 ` [PATCH v3 3/7] wic: make import isarpluginbase work when plugins use each other Felix Moessbauer
` (6 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Felix Moessbauer @ 2022-03-22 16:45 UTC (permalink / raw)
To: isar-users
Cc: amikan, henning.schild, jan.kiszka, adriaan.schmidt, 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>
---
.../lib/wic/plugins/source/bootimg-biosplusefi-isar.py | 8 ++++----
1 file changed, 4 insertions(+), 4 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..fb6b7fcc 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
@@ -75,10 +75,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 +106,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] 13+ messages in thread
* Re: [PATCH v3 2/7] Add ISAR version of biosplusefi WIC plugin
2022-03-22 16:45 ` [PATCH v3 2/7] Add ISAR version of biosplusefi WIC plugin Felix Moessbauer
@ 2022-03-28 8:51 ` Henning Schild
2022-03-28 9:11 ` Moessbauer, Felix
0 siblings, 1 reply; 13+ messages in thread
From: Henning Schild @ 2022-03-28 8:51 UTC (permalink / raw)
To: Felix Moessbauer; +Cc: isar-users, amikan, jan.kiszka, adriaan.schmidt
Am Tue, 22 Mar 2022 17:45:20 +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>
> ---
> .../lib/wic/plugins/source/bootimg-biosplusefi-isar.py | 8
> ++++---- 1 file changed, 4 insertions(+), 4 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..fb6b7fcc 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py @@
> -75,10 +75,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 +106,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()
Mhh, for some reason we did rename the class in that fork but not in
the EFI one.
Maybe something to get sorted out in this series, or later. Not sure
which option would be best ... i guess the consistent rename would be
the conservative option, meaning the EFI class would have to go
-class BootimgEFIPlugin(SourcePlugin)
+class BootimgEFIIsarPlugin(SourcePlugin)
Henning
> # Import bootimg-efi (class name "BootimgEFIPlugin")
> modulePath =
> os.path.join(os.path.dirname(os.path.realpath(__file__)),
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v3 2/7] Add ISAR version of biosplusefi WIC plugin
2022-03-28 8:51 ` Henning Schild
@ 2022-03-28 9:11 ` Moessbauer, Felix
2022-03-28 9:20 ` Henning Schild
0 siblings, 1 reply; 13+ messages in thread
From: Moessbauer, Felix @ 2022-03-28 9:11 UTC (permalink / raw)
To: Schild, Henning; +Cc: isar-users, amikan, jan.kiszka, Schmidt, Adriaan
> > a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py +++
> > b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py @@
> > -75,10 +75,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 +106,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()
>
> Mhh, for some reason we did rename the class in that fork but not in the EFI
> one.
That is indeed not consistent. However, I don't know about the side effects when renaming this.
Looks like the class name is not part of our API as the WIC script just takes the name of the python file (e.g. --source bootimg-efi-isar).
By that, a rename should be safe.
>
> Maybe something to get sorted out in this series, or later. Not sure which option
> would be best ... i guess the consistent rename would be the conservative
> option, meaning the EFI class would have to go
I vote for not refactoring this as part of the series.
It is technically unrelated (we just call the existing plugins) and just delays the integration.
Felix
>
> -class BootimgEFIPlugin(SourcePlugin)
> +class BootimgEFIIsarPlugin(SourcePlugin)
>
> Henning
>
> > # Import bootimg-efi (class name "BootimgEFIPlugin")
> > modulePath =
> > os.path.join(os.path.dirname(os.path.realpath(__file__)),
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 2/7] Add ISAR version of biosplusefi WIC plugin
2022-03-28 9:11 ` Moessbauer, Felix
@ 2022-03-28 9:20 ` Henning Schild
0 siblings, 0 replies; 13+ messages in thread
From: Henning Schild @ 2022-03-28 9:20 UTC (permalink / raw)
To: Moessbauer, Felix (T CED SES-DE)
Cc: isar-users, amikan, Kiszka, Jan (T CED), Schmidt, Adriaan (T CED SES-DE)
Am Mon, 28 Mar 2022 11:11:40 +0200
schrieb "Moessbauer, Felix (T CED SES-DE)"
<felix.moessbauer@siemens.com>:
> > > a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
> > > +++
> > > b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py
> > > @@ -75,10 +75,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 +106,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()
> >
> > Mhh, for some reason we did rename the class in that fork but not
> > in the EFI one.
>
> That is indeed not consistent. However, I don't know about the side
> effects when renaming this. Looks like the class name is not part of
> our API as the WIC script just takes the name of the python file
> (e.g. --source bootimg-efi-isar). By that, a rename should be safe.
>
> >
> > Maybe something to get sorted out in this series, or later. Not
> > sure which option would be best ... i guess the consistent rename
> > would be the conservative option, meaning the EFI class would have
> > to go
>
> I vote for not refactoring this as part of the series.
> It is technically unrelated (we just call the existing plugins) and
> just delays the integration.
Good. We should keep that in mind, and i agree that we should not slow
down any more.
Henning
> Felix
>
> >
> > -class BootimgEFIPlugin(SourcePlugin)
> > +class BootimgEFIIsarPlugin(SourcePlugin)
> >
> > Henning
> >
> > > # Import bootimg-efi (class name "BootimgEFIPlugin")
> > > modulePath =
> > > os.path.join(os.path.dirname(os.path.realpath(__file__)),
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 3/7] wic: make import isarpluginbase work when plugins use each other
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
2022-03-22 16:45 ` [PATCH v3 1/7] Copy efi-plus-pcbios script from OE Felix Moessbauer
2022-03-22 16:45 ` [PATCH v3 2/7] Add ISAR version of biosplusefi WIC plugin Felix Moessbauer
@ 2022-03-22 16:45 ` Felix Moessbauer
2022-03-22 16:45 ` [PATCH v3 4/7] test: add target for efi-plus-pcbios image type Felix Moessbauer
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Felix Moessbauer @ 2022-03-22 16:45 UTC (permalink / raw)
To: isar-users
Cc: amikan, henning.schild, jan.kiszka, adriaan.schmidt, Felix Moessbauer
From: Henning Schild <henning.schild@siemens.com>
The biosplusefi plugin calls other plugins, which in our case use
isarpluginbase and fiddle with their library paths to do so.
Make sure that path modification also works when the plugins are
called by another plugin.
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] 13+ messages in thread
* [PATCH v3 4/7] test: add target for efi-plus-pcbios image type
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
` (2 preceding siblings ...)
2022-03-22 16:45 ` [PATCH v3 3/7] wic: make import isarpluginbase work when plugins use each other Felix Moessbauer
@ 2022-03-22 16:45 ` Felix Moessbauer
2022-03-22 16:45 ` [PATCH v3 5/7] add support for current debian distros in start_vm.py Felix Moessbauer
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Felix Moessbauer @ 2022-03-22 16:45 UTC (permalink / raw)
To: isar-users
Cc: amikan, henning.schild, jan.kiszka, adriaan.schmidt, 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..03928915
--- /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 --ptable gpt --timeout 3 --append "rootwait console=ttyS0,115200 console=tty0"
--
2.30.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 5/7] add support for current debian distros in start_vm.py
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
` (3 preceding siblings ...)
2022-03-22 16:45 ` [PATCH v3 4/7] test: add target for efi-plus-pcbios image type Felix Moessbauer
@ 2022-03-22 16:45 ` Felix Moessbauer
2022-03-22 16:45 ` [PATCH v3 6/7] Add pcbios option to start_vm Felix Moessbauer
` (3 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Felix Moessbauer @ 2022-03-22 16:45 UTC (permalink / raw)
To: isar-users
Cc: amikan, henning.schild, jan.kiszka, adriaan.schmidt, Felix Moessbauer
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
testsuite/start_vm.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuite/start_vm.py b/testsuite/start_vm.py
index 4f5b2ec4..8fd3e16c 100755
--- a/testsuite/start_vm.py
+++ b/testsuite/start_vm.py
@@ -91,7 +91,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-a', '--arch', choices=['arm', 'arm64', 'amd64', 'i386', 'mipsel'], help='set isar machine architecture.', default='arm')
parser.add_argument('-b', '--build', help='set path to build directory.', default=os.getcwd())
- parser.add_argument('-d', '--distro', choices=['jessie', 'stretch'], help='set isar Debian distribution.', default='stretch')
+ parser.add_argument('-d', '--distro', choices=['jessie', 'stretch', 'buster', 'bullseye', 'bookworm'], help='set isar Debian distribution.', default='stretch')
parser.add_argument('-o', '--out', help='Route QEMU console output to specified file.')
parser.add_argument('-p', '--pid', help='Store QEMU pid to specified file.')
args = parser.parse_args()
--
2.30.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 6/7] Add pcbios option to start_vm
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
` (4 preceding siblings ...)
2022-03-22 16:45 ` [PATCH v3 5/7] add support for current debian distros in start_vm.py Felix Moessbauer
@ 2022-03-22 16:45 ` Felix Moessbauer
2022-03-22 16:45 ` [PATCH v3 7/7] run vm_boot_test against EFI and PC BIOS Felix Moessbauer
` (2 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Felix Moessbauer @ 2022-03-22 16:45 UTC (permalink / raw)
To: isar-users
Cc: amikan, henning.schild, jan.kiszka, adriaan.schmidt, Felix Moessbauer
This patch adds the --pcbios option to the start_vm script to
enforce that any -bios QEMU options are removed.
By that, QEMU is forced to use a pc bios (like seabios).
This helps to test combined efi + pcbios disks as these can be
bootet with both efi and pc bios.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
testsuite/start_vm.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/testsuite/start_vm.py b/testsuite/start_vm.py
index 8fd3e16c..708520f7 100755
--- a/testsuite/start_vm.py
+++ b/testsuite/start_vm.py
@@ -21,7 +21,7 @@ def get_bitbake_var(output, var):
ret = line.split('"')[1]
return ret
-def format_qemu_cmdline(arch, build, distro, out, pid):
+def format_qemu_cmdline(arch, build, distro, out, pid, enforce_pcbios=False):
bb_output = get_bitbake_env(arch, distro).decode()
rootfs_image = ''
@@ -66,6 +66,9 @@ def format_qemu_cmdline(arch, build, distro, out, pid):
extra_args.extend(['-pidfile', pid])
qemu_disk_args = qemu_disk_args.replace('##ROOTFS_IMAGE##', deploy_dir_image + '/' + rootfs_image).split()
+ if enforce_pcbios and '-bios' in qemu_disk_args:
+ bios_idx = qemu_disk_args.index('-bios')
+ del qemu_disk_args[bios_idx : bios_idx+2]
cmd = ['qemu-system-' + qemu_arch, '-m', '1024M']
@@ -80,8 +83,8 @@ def format_qemu_cmdline(arch, build, distro, out, pid):
return cmd
-def start_qemu(arch, build, distro, out, pid):
- cmdline = format_qemu_cmdline(arch, build, distro, out, pid)
+def start_qemu(arch, build, distro, out, pid, enforce_pcbios):
+ cmdline = format_qemu_cmdline(arch, build, distro, out, pid, enforce_pcbios)
cmdline.insert(1, '-nographic')
print(cmdline)
@@ -94,6 +97,7 @@ if __name__ == "__main__":
parser.add_argument('-d', '--distro', choices=['jessie', 'stretch', 'buster', 'bullseye', 'bookworm'], help='set isar Debian distribution.', default='stretch')
parser.add_argument('-o', '--out', help='Route QEMU console output to specified file.')
parser.add_argument('-p', '--pid', help='Store QEMU pid to specified file.')
+ parser.add_argument('--pcbios', action="store_true", help='remove any bios options to enforce use of pc bios')
args = parser.parse_args()
- start_qemu(args.arch, args.build, args.distro, args.out, args.pid)
+ start_qemu(args.arch, args.build, args.distro, args.out, args.pid, args.pcbios)
--
2.30.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 7/7] run vm_boot_test against EFI and PC BIOS
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
` (5 preceding siblings ...)
2022-03-22 16:45 ` [PATCH v3 6/7] Add pcbios option to start_vm Felix Moessbauer
@ 2022-03-22 16:45 ` Felix Moessbauer
2022-04-12 12:56 ` [PATCH v3 0/7] Add support for dual bios + efi disk generation Moessbauer, Felix
2022-04-13 8:34 ` Anton Mikanovich
8 siblings, 0 replies; 13+ messages in thread
From: Felix Moessbauer @ 2022-03-22 16:45 UTC (permalink / raw)
To: isar-users
Cc: amikan, henning.schild, jan.kiszka, adriaan.schmidt, Felix Moessbauer
This patch adds a test that boots the combined efi + pcbios
image with pc bios.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
testsuite/cibuilder.py | 4 ++--
testsuite/citest.py | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 069a1d93..71e0c1c2 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -189,7 +189,7 @@ class CIBuilder(Test):
return env['LAYERDIR_' + layer].strip('"')
- def vm_start(self, arch='amd64', distro='buster'):
+ def vm_start(self, arch='amd64', distro='buster', enforce_pcbios=False):
time_to_wait = self.params.get('time_to_wait', default=60)
self.log.info('===================================================')
@@ -213,7 +213,7 @@ class CIBuilder(Test):
os.symlink(os.path.basename(output_file), latest_link)
cmdline = start_vm.format_qemu_cmdline(arch, self.build_dir, distro,
- output_file, None)
+ output_file, None, enforce_pcbios)
cmdline.insert(1, '-nographic')
self.log.info('QEMU boot line: ' + str(cmdline))
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 1138eb2b..ace1c039 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -304,7 +304,10 @@ class VmBootTestFull(CIBaseTest):
def test_amd64_buster(self):
self.init()
+ # test efi boot
self.vm_start('amd64','buster')
+ # test pcbios boot
+ self.vm_start('amd64', 'buster', True)
def test_amd64_focal(self):
self.init()
--
2.30.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v3 0/7] Add support for dual bios + efi disk generation
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
` (6 preceding siblings ...)
2022-03-22 16:45 ` [PATCH v3 7/7] run vm_boot_test against EFI and PC BIOS Felix Moessbauer
@ 2022-04-12 12:56 ` Moessbauer, Felix
2022-04-13 8:34 ` Anton Mikanovich
8 siblings, 0 replies; 13+ messages in thread
From: Moessbauer, Felix @ 2022-04-12 12:56 UTC (permalink / raw)
To: isar-users; +Cc: amikan, Schild, Henning, jan.kiszka, Schmidt, Adriaan
Hi,
Are there any updates on this series?
We run it internally for a couple of weeks without any issues.
When can we expect this to be integrated?
In case there are still open points, I'm happy to assist.
Best regards,
Felix
> -----Original Message-----
> From: Moessbauer, Felix (T CED SES-DE) <felix.moessbauer@siemens.com>
> Sent: Tuesday, March 22, 2022 5:45 PM
> To: isar-users@googlegroups.com
> Cc: amikan@ilbers.de; Schild, Henning (T CED SES-DE)
> <henning.schild@siemens.com>; Kiszka, Jan (T CED) <jan.kiszka@siemens.com>;
> Schmidt, Adriaan (T CED SES-DE) <adriaan.schmidt@siemens.com>;
> Moessbauer, Felix (T CED SES-DE) <felix.moessbauer@siemens.com>
> Subject: [PATCH v3 0/7] Add support for dual bios + efi disk generation
>
> 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.
>
> Changes since v2:
> - rebased onto "Unify build and run test cases" series
> - added missing patch "Copy efi-plus-pcbios script from OE"
>
> Changes since v1:
> - minimize changes to bootimg-biosplusefi-isar.py
> - replace erronous commit message of hennings commit
> - rework efi-plus-pcbios WKS file to not include any bios-only options
> - update start_vm script to support modern debian distros
> - test boot of both efi and bios of efi + bios test target
>
> Felix Moessbauer (6):
> Copy efi-plus-pcbios script from OE
> Add ISAR version of biosplusefi WIC plugin
> test: add target for efi-plus-pcbios image type
> add support for current debian distros in start_vm.py
> Add pcbios option to start_vm
> run vm_boot_test against EFI and PC BIOS
>
> Henning Schild (1):
> wic: make import isarpluginbase work when plugins use each other
>
> .../conf/multiconfig/qemuamd64-buster.conf | 2 +
> .../lib/wic/canned-wks/efi-plus-pcbios.wks | 6 +
> .../source/bootimg-biosplusefi-isar.py | 213 ++++++++++++++++++
> .../wic/plugins/source/bootimg-efi-isar.py | 6 +-
> .../wic/plugins/source/bootimg-pcbios-isar.py | 6 +-
> testsuite/cibuilder.py | 4 +-
> testsuite/citest.py | 3 +
> testsuite/start_vm.py | 14 +-
> 8 files changed, 243 insertions(+), 11 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] 13+ messages in thread
* Re: [PATCH v3 0/7] Add support for dual bios + efi disk generation
2022-03-22 16:45 [PATCH v3 0/7] Add support for dual bios + efi disk generation Felix Moessbauer
` (7 preceding siblings ...)
2022-04-12 12:56 ` [PATCH v3 0/7] Add support for dual bios + efi disk generation Moessbauer, Felix
@ 2022-04-13 8:34 ` Anton Mikanovich
8 siblings, 0 replies; 13+ messages in thread
From: Anton Mikanovich @ 2022-04-13 8:34 UTC (permalink / raw)
To: Felix Moessbauer, isar-users; +Cc: henning.schild, jan.kiszka, adriaan.schmidt
22.03.2022 19:45, Felix Moessbauer wrote:
> 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.
>
> Changes since v2:
> - rebased onto "Unify build and run test cases" series
> - added missing patch "Copy efi-plus-pcbios script from OE"
>
> Changes since v1:
> - minimize changes to bootimg-biosplusefi-isar.py
> - replace erronous commit message of hennings commit
> - rework efi-plus-pcbios WKS file to not include any bios-only options
> - update start_vm script to support modern debian distros
> - test boot of both efi and bios of efi + bios test target
>
> Felix Moessbauer (6):
> Copy efi-plus-pcbios script from OE
> Add ISAR version of biosplusefi WIC plugin
> test: add target for efi-plus-pcbios image type
> add support for current debian distros in start_vm.py
> Add pcbios option to start_vm
> run vm_boot_test against EFI and PC BIOS
>
> Henning Schild (1):
> wic: make import isarpluginbase work when plugins use each other
>
> .../conf/multiconfig/qemuamd64-buster.conf | 2 +
> .../lib/wic/canned-wks/efi-plus-pcbios.wks | 6 +
> .../source/bootimg-biosplusefi-isar.py | 213 ++++++++++++++++++
> .../wic/plugins/source/bootimg-efi-isar.py | 6 +-
> .../wic/plugins/source/bootimg-pcbios-isar.py | 6 +-
> testsuite/cibuilder.py | 4 +-
> testsuite/citest.py | 3 +
> testsuite/start_vm.py | 14 +-
> 8 files changed, 243 insertions(+), 11 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
Applied to next, thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread