* [PATCH v4] wic/isoimage-isohybrid: remove do_stage_partition()
@ 2017-01-07 18:03 Ioan-Adrian Ratiu
2017-01-09 10:18 ` Ed Bartosh
0 siblings, 1 reply; 2+ messages in thread
From: Ioan-Adrian Ratiu @ 2017-01-07 18:03 UTC (permalink / raw)
To: openembedded-core; +Cc: ken.sharp
The purpouse of this function was to check dependencies for building a
hybrid iso and build them using bitbake if not found. Calling bitbake in
this context means this wic plugin itself cannot be instrumented inside
bitbake recipes which is undesirable, the benefits of this are clear:
there is no need to maintain outside scripts to generate an iso using wic
and the isohybrid building logic can be further abstracted away into an
isohybrid.bbclass in the future which can be easily inherited or something
similar.
So remove the function and add all dependencies to NATIVE_RECIPES so that
wic can print useful errors when they're not built.
To automate building the isohybrid image dependencies, add the following
somewhere in your image build inheritence hierarcy (or maybe create a
bbclass in the future to do these sort of things automatically):
DEPENDS += "syslinux syslinux-native cdrtools-native e2fsprogs-native \
parted-native dosfstools-native mtools-native grub-efi-native"
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
---
.../lib/wic/plugins/source/isoimage-isohybrid.py | 49 ----------------------
scripts/lib/wic/utils/oe/misc.py | 4 ++
2 files changed, 4 insertions(+), 49 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index 3858fd439b..15fd858d22 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -194,55 +194,6 @@ class IsoImagePlugin(SourcePlugin):
return initrd
@classmethod
- def do_stage_partition(cls, part, source_params, creator, cr_workdir,
- oe_builddir, bootimg_dir, kernel_dir,
- native_sysroot):
- """
- Special content staging called before do_prepare_partition().
- It cheks if all necessary tools are available, if not
- tries to instal them.
- """
- # Make sure parted is available in native sysroot
- if not os.path.isfile("%s/usr/sbin/parted" % native_sysroot):
- msger.info("Building parted-native...\n")
- exec_cmd("bitbake parted-native")
-
- # Make sure mkfs.ext2/3/4 is available in native sysroot
- if not os.path.isfile("%s/sbin/mkfs.ext2" % native_sysroot):
- msger.info("Building e2fsprogs-native...\n")
- exec_cmd("bitbake e2fsprogs-native")
-
- # Make sure syslinux is available in sysroot and in native sysroot
- syslinux_dir = get_bitbake_var("STAGING_DATADIR")
- if not syslinux_dir:
- msger.error("Couldn't find STAGING_DATADIR, exiting.\n")
- if not os.path.exists("%s/syslinux" % syslinux_dir):
- msger.info("Building syslinux...\n")
- exec_cmd("bitbake syslinux")
- if not os.path.exists("%s/syslinux" % syslinux_dir):
- msger.error("Please build syslinux first\n")
-
- # Make sure syslinux is available in native sysroot
- if not os.path.exists("%s/usr/bin/syslinux" % native_sysroot):
- msger.info("Building syslinux-native...\n")
- exec_cmd("bitbake syslinux-native")
-
- #Make sure mkisofs is available in native sysroot
- if not os.path.isfile("%s/usr/bin/mkisofs" % native_sysroot):
- msger.info("Building cdrtools-native...\n")
- exec_cmd("bitbake cdrtools-native")
-
- # Make sure mkfs.vfat is available in native sysroot
- if not os.path.isfile("%s/sbin/mkfs.vfat" % native_sysroot):
- msger.info("Building dosfstools-native...\n")
- exec_cmd("bitbake dosfstools-native")
-
- # Make sure mtools is available in native sysroot
- if not os.path.isfile("%s/usr/bin/mcopy" % native_sysroot):
- msger.info("Building mtools-native...\n")
- exec_cmd("bitbake mtools-native")
-
- @classmethod
def do_configure_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index fe188c9d26..489393a24e 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -35,8 +35,11 @@ from wic.utils import runner
# executable -> recipe pairs for exec_native_cmd
NATIVE_RECIPES = {"bmaptool": "bmap-tools",
+ "grub-mkimage": "grub-efi",
+ "isohybrid": "syslinux",
"mcopy": "mtools",
"mkdosfs": "dosfstools",
+ "mkisofs": "cdrtools",
"mkfs.btrfs": "btrfs-tools",
"mkfs.ext2": "e2fsprogs",
"mkfs.ext3": "e2fsprogs",
@@ -44,6 +47,7 @@ NATIVE_RECIPES = {"bmaptool": "bmap-tools",
"mkfs.vfat": "dosfstools",
"mksquashfs": "squashfs-tools",
"mkswap": "util-linux",
+ "mmd": "syslinux",
"parted": "parted",
"sfdisk": "util-linux",
"sgdisk": "gptfdisk",
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v4] wic/isoimage-isohybrid: remove do_stage_partition()
2017-01-07 18:03 [PATCH v4] wic/isoimage-isohybrid: remove do_stage_partition() Ioan-Adrian Ratiu
@ 2017-01-09 10:18 ` Ed Bartosh
0 siblings, 0 replies; 2+ messages in thread
From: Ed Bartosh @ 2017-01-09 10:18 UTC (permalink / raw)
To: Ioan-Adrian Ratiu; +Cc: ken.sharp, openembedded-core
Hi Ioan-Adrian,
Thank you for the patch!
It looks good to me.
+1
On Sat, Jan 07, 2017 at 08:03:01PM +0200, Ioan-Adrian Ratiu wrote:
> The purpouse of this function was to check dependencies for building a
> hybrid iso and build them using bitbake if not found. Calling bitbake in
> this context means this wic plugin itself cannot be instrumented inside
> bitbake recipes which is undesirable, the benefits of this are clear:
> there is no need to maintain outside scripts to generate an iso using wic
> and the isohybrid building logic can be further abstracted away into an
> isohybrid.bbclass in the future which can be easily inherited or something
> similar.
>
> So remove the function and add all dependencies to NATIVE_RECIPES so that
> wic can print useful errors when they're not built.
>
> To automate building the isohybrid image dependencies, add the following
> somewhere in your image build inheritence hierarcy (or maybe create a
> bbclass in the future to do these sort of things automatically):
>
> DEPENDS += "syslinux syslinux-native cdrtools-native e2fsprogs-native \
> parted-native dosfstools-native mtools-native grub-efi-native"
>
> Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
> ---
> .../lib/wic/plugins/source/isoimage-isohybrid.py | 49 ----------------------
> scripts/lib/wic/utils/oe/misc.py | 4 ++
> 2 files changed, 4 insertions(+), 49 deletions(-)
>
> diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> index 3858fd439b..15fd858d22 100644
> --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> @@ -194,55 +194,6 @@ class IsoImagePlugin(SourcePlugin):
> return initrd
>
> @classmethod
> - def do_stage_partition(cls, part, source_params, creator, cr_workdir,
> - oe_builddir, bootimg_dir, kernel_dir,
> - native_sysroot):
> - """
> - Special content staging called before do_prepare_partition().
> - It cheks if all necessary tools are available, if not
> - tries to instal them.
> - """
> - # Make sure parted is available in native sysroot
> - if not os.path.isfile("%s/usr/sbin/parted" % native_sysroot):
> - msger.info("Building parted-native...\n")
> - exec_cmd("bitbake parted-native")
> -
> - # Make sure mkfs.ext2/3/4 is available in native sysroot
> - if not os.path.isfile("%s/sbin/mkfs.ext2" % native_sysroot):
> - msger.info("Building e2fsprogs-native...\n")
> - exec_cmd("bitbake e2fsprogs-native")
> -
> - # Make sure syslinux is available in sysroot and in native sysroot
> - syslinux_dir = get_bitbake_var("STAGING_DATADIR")
> - if not syslinux_dir:
> - msger.error("Couldn't find STAGING_DATADIR, exiting.\n")
> - if not os.path.exists("%s/syslinux" % syslinux_dir):
> - msger.info("Building syslinux...\n")
> - exec_cmd("bitbake syslinux")
> - if not os.path.exists("%s/syslinux" % syslinux_dir):
> - msger.error("Please build syslinux first\n")
> -
> - # Make sure syslinux is available in native sysroot
> - if not os.path.exists("%s/usr/bin/syslinux" % native_sysroot):
> - msger.info("Building syslinux-native...\n")
> - exec_cmd("bitbake syslinux-native")
> -
> - #Make sure mkisofs is available in native sysroot
> - if not os.path.isfile("%s/usr/bin/mkisofs" % native_sysroot):
> - msger.info("Building cdrtools-native...\n")
> - exec_cmd("bitbake cdrtools-native")
> -
> - # Make sure mkfs.vfat is available in native sysroot
> - if not os.path.isfile("%s/sbin/mkfs.vfat" % native_sysroot):
> - msger.info("Building dosfstools-native...\n")
> - exec_cmd("bitbake dosfstools-native")
> -
> - # Make sure mtools is available in native sysroot
> - if not os.path.isfile("%s/usr/bin/mcopy" % native_sysroot):
> - msger.info("Building mtools-native...\n")
> - exec_cmd("bitbake mtools-native")
> -
> - @classmethod
> def do_configure_partition(cls, part, source_params, creator, cr_workdir,
> oe_builddir, bootimg_dir, kernel_dir,
> native_sysroot):
> diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
> index fe188c9d26..489393a24e 100644
> --- a/scripts/lib/wic/utils/oe/misc.py
> +++ b/scripts/lib/wic/utils/oe/misc.py
> @@ -35,8 +35,11 @@ from wic.utils import runner
>
> # executable -> recipe pairs for exec_native_cmd
> NATIVE_RECIPES = {"bmaptool": "bmap-tools",
> + "grub-mkimage": "grub-efi",
> + "isohybrid": "syslinux",
> "mcopy": "mtools",
> "mkdosfs": "dosfstools",
> + "mkisofs": "cdrtools",
> "mkfs.btrfs": "btrfs-tools",
> "mkfs.ext2": "e2fsprogs",
> "mkfs.ext3": "e2fsprogs",
> @@ -44,6 +47,7 @@ NATIVE_RECIPES = {"bmaptool": "bmap-tools",
> "mkfs.vfat": "dosfstools",
> "mksquashfs": "squashfs-tools",
> "mkswap": "util-linux",
> + "mmd": "syslinux",
> "parted": "parted",
> "sfdisk": "util-linux",
> "sgdisk": "gptfdisk",
> --
> 2.11.0
>
--
--
Regards,
Ed
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-09 10:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-07 18:03 [PATCH v4] wic/isoimage-isohybrid: remove do_stage_partition() Ioan-Adrian Ratiu
2017-01-09 10:18 ` Ed Bartosh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox