Hi,
i copied/modified isoimage-isohybrid-isar.py from isoimage-isohybrid.py and used it to create a Debian Live ISO Image.
Patches:

diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py
index afc9ea0f..9ac9e4ee 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 #
 # DESCRIPTION
-# This implements the 'isoimage-isohybrid' source plugin class for 'wic'
+# This implements the 'isoimage-isohybrid-isar' source plugin class for 'wic'
 #
 # AUTHORS
 # Mihaly Varga <mihaly.varga (at] ni.com>
@@ -12,12 +12,19 @@ import logging
 import os
 import re
 import shutil
+import subprocess
 
 from wic import WicError
 from wic.engine import get_custom_config
 from wic.pluginbase import SourcePlugin
 from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var
 
+# 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')
 
 class IsoImagePlugin(SourcePlugin):
@@ -43,7 +50,7 @@ class IsoImagePlugin(SourcePlugin):
     extension added by direct imeger plugin) and a file named IsoImage-cd.iso
     """
 
-    name = 'isoimage-isohybrid'
+    name = 'isoimage-isohybrid-isar'
 
     @classmethod
     def do_configure_syslinux(cls, creator, cr_workdir):
@@ -170,8 +177,8 @@ class IsoImagePlugin(SourcePlugin):
             # Create initrd from rootfs directory
             initrd = "%s/initrd.cpio.gz" % cr_workdir
             initrd_dir = "%s/INITRD" % cr_workdir
-            shutil.copytree("%s" % rootfs_dir, \
-                            "%s" % initrd_dir, symlinks=True)
+            cmd = "rsync -avP --numeric-ids --exclude='/dev' --exclude='/proc' --exclude='/sys' %s %s" % (rootfs_dir, initrd_dir)
+            subprocess.call(cmd.split())
 
             if os.path.isfile("%s/init" % rootfs_dir):
                 shutil.copy2("%s/init" % rootfs_dir, "%s/init" % initrd_dir)
@@ -278,13 +285,13 @@ class IsoImagePlugin(SourcePlugin):
             exec_cmd(cp_cmd)
         else:
             # Prepare initial ramdisk
-            initrd = "%s/initrd" % deploy_dir
+            pkg_suffix = get_bitbake_var('ROOTFS_PACKAGE_SUFFIX')
+            initrd = "%s/%s-initrd.img" % (deploy_dir, pkg_suffix)
             if not os.path.isfile(initrd):
                 initrd = "%s/initrd" % img_iso_dir
-            if not os.path.isfile(initrd):
                 initrd = cls._build_initramfs_path(rootfs_dir, cr_workdir)
 
-        install_cmd = "install -m 0644 %s %s/initrd" % (initrd, isodir)
+        install_cmd = "install -m 0644 %s/%s %s/initrd" % (cr_workdir, initrd, isodir)
         exec_cmd(install_cmd)
 
         # Remove the temporary file created by _build_initramfs_path function
@@ -317,7 +324,7 @@ class IsoImagePlugin(SourcePlugin):
                     raise WicError("Coludn't find target architecture")
 
                 if re.match("x86_64", target_arch):
-                    grub_src_image = "grub-efi-bootx64.efi"
+                    grub_src_image = "grubx64.efi"
                     grub_dest_image = "bootx64.efi"
                 elif re.match('i.86', target_arch):
                     grub_src_image = "grub-efi-bootia32.efi"
@@ -328,7 +335,7 @@ class IsoImagePlugin(SourcePlugin):
 
                 grub_target = os.path.join(target_dir, grub_dest_image)
                 if not os.path.isfile(grub_target):
-                    grub_src = os.path.join(deploy_dir, grub_src_image)
+                    grub_src = os.path.join("/usr/lib/grub/x86_64-efi/monolithic/", grub_src_image)
                     if not os.path.exists(grub_src):
                         raise WicError("Grub loader %s is not found in %s. "
                                        "Please build grub-efi first" % (grub_src_image, deploy_dir))
@@ -392,29 +399,39 @@ class IsoImagePlugin(SourcePlugin):
 
         cls.do_configure_syslinux(creator, cr_workdir)
 
-        install_cmd = "install -m 444 %s/syslinux/ldlinux.sys " % syslinux_dir
-        install_cmd += "%s/isolinux/ldlinux.sys" % isodir
-        exec_cmd(install_cmd)
 
-        install_cmd = "install -m 444 %s/syslinux/isohdpfx.bin " % syslinux_dir
+        install_cmd = "install -m 444 %s/ISOLINUX/isohdpfx.bin " % syslinux_dir
         install_cmd += "%s/isolinux/isohdpfx.bin" % isodir
         exec_cmd(install_cmd)
 
-        install_cmd = "install -m 644 %s/syslinux/isolinux.bin " % syslinux_dir
+        install_cmd = "install -m 644 %s/ISOLINUX/isolinux.bin " % syslinux_dir
         install_cmd += "%s/isolinux/isolinux.bin" % isodir
         exec_cmd(install_cmd)
 
-        install_cmd = "install -m 644 %s/syslinux/ldlinux.c32 " % syslinux_dir
+        install_cmd = "install -m 644 %s/syslinux/modules/bios/ldlinux.c32 " % syslinux_dir
         install_cmd += "%s/isolinux/ldlinux.c32" % isodir
         exec_cmd(install_cmd)
 
+        # copy squashfs
+        pkg_suffix = get_bitbake_var('ROOTFS_PACKAGE_SUFFIX')
+        if not os.path.exists("%s/live" % isodir):
+            mk_cmd = "mkdir %s/live/" % isodir
+            exec_cmd(mk_cmd)
+
+        logger.debug("%s/%s.squashfs", (deploy_dir, pkg_suffix))
+        if  os.path.exists("%s/%s.squashfs" % (deploy_dir, pkg_suffix)):
+            logger.debug("copy squashfs")
+            cp_cmd = "cp %s/%s.squashfs  %s/live/filesystem.squashfs" % (deploy_dir, pkg_suffix, isodir)
+            exec_cmd(cp_cmd)
+
+
         #create ISO image
         iso_img = "%s/tempiso_img.iso" % cr_workdir
         iso_bootimg = "isolinux/isolinux.bin"
         iso_bootcat = "isolinux/boot.cat"
         efi_img = "efi.img"
 
-        mkisofs_cmd = "mkisofs -V %s " % part.label
+        mkisofs_cmd = "xorriso -as mkisofs -V %s " % part.label
         mkisofs_cmd += "-o %s -U " % iso_img
         mkisofs_cmd += "-J -joliet-long -r -iso-level 2 -b %s " % iso_bootimg
         mkisofs_cmd += "-c %s -no-emul-boot -boot-load-size 4 " % iso_bootcat
@@ -444,6 +461,7 @@ class IsoImagePlugin(SourcePlugin):
         """
 
         iso_img = "%s.p1" % disk.path
+        iso_img2 = "%s" % disk.path
         full_path = creator._full_path(workdir, disk_name, "direct")
         full_path_iso = creator._full_path(workdir, disk_name, "iso")
 
@@ -457,5 +475,6 @@ class IsoImagePlugin(SourcePlugin):
         # direct plugin adds and configures an another MBR.
         logger.debug("Replaceing the image created by direct plugin\n")
         os.remove(disk.path)
+        shutil.copy2(iso_img, iso_img2)
         shutil.copy2(iso_img, full_path_iso)
         shutil.copy2(full_path_iso, full_path)

diff --git a/meta/classes/imagetypes.bbclass b/meta/classes/imagetypes.bbclass
index a3be0a1d..f65c2368 100644
--- a/meta/classes/imagetypes.bbclass
+++ b/meta/classes/imagetypes.bbclass
@@ -3,6 +3,13 @@
 #
 # SPDX-License-Identifier: MIT
 
+#image type: squashfs
+IMAGER_INSTALL:squashfs += "squashfs-tools"
+IMAGE_CMD:squashfs() {
+    ${SUDO_CHROOT} /bin/mksquashfs \
+        '${PP_ROOTFS}' '${IMAGE_FILE_CHROOT}' -noappend
+}
+
 #image type: tar
 IMAGER_INSTALL:tar = "tar"
 TAR_TRANSFORM = "--transform='s|rootfs|.|'"

diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
index 3b697cdd..ff2608c6 100644
--- a/meta/classes/imagetypes_wic.bbclass
+++ b/meta/classes/imagetypes_wic.bbclass
@@ -107,7 +107,7 @@ WICVARS += "\
            ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH"
 
 # Isar specific vars used in our plugins
-WICVARS += "DISTRO DISTRO_ARCH"
+WICVARS += "DISTRO DISTRO_ARCH KERNEL_IMAGETYPE ROOTFS_PACKAGE_SUFFIX"
 
 python do_rootfs_wicenv () {
     wicvars = d.getVar('WICVARS')


Jan Kiszka schrieb am Freitag, 4. Oktober 2024 um 09:59:13 UTC+2:
On 28.09.24 17:31, Herbert Bernecker wrote:
> Hi everyone,
>
> I am trying to create an ISO image with Isar and mkhybridiso.wks.
> However, the build fails due to some missing files (grub, syslinux).
> It seems that the files are missing because the grup_cmd and
> syslinux_cmd are not executed in isoimage-isohybrid.py.
> Is this a configuration Problem?
> How are bootimg-pcbios.py and bootimg-efi-isar.py additionally executed?
>
> Used Isar commit: 8b30a4f86cb3ea3369bff3884141872c3a7d9979

You will have to convert that plugin to isar, see other examples in
meta/scripts/lib/wic/plugins/source/ like bootimg-biosplusefi.py ->
bootimg-biosplusefi-isar.py. Patches welcome.

Jan

--
Siemens AG, Technology
Linux Expert Center

--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/939743ed-7e16-43e9-9869-1e3de655301dn%40googlegroups.com.