* Re: [PATCH] wic: isoimage-isohybrid: add grubefi configfile support
2016-04-20 9:17 [PATCH] wic: isoimage-isohybrid: add grubefi configfile support Ioan-Adrian Ratiu
@ 2016-04-20 8:16 ` Ed Bartosh
0 siblings, 0 replies; 6+ messages in thread
From: Ed Bartosh @ 2016-04-20 8:16 UTC (permalink / raw)
To: Ioan-Adrian Ratiu; +Cc: openembedded-core
Hi Ioan-Adrian,
Thank you for the patch! My comment is below.
Please, make sure your change doesn't break wic tests.
On Wed, Apr 20, 2016 at 12:17:32PM +0300, Ioan-Adrian Ratiu wrote:
> The latest wic kickstart refactoring introduced a bootloader option
> "--configfile" which lets wks' specify a custom grub.cfg for use
> while booting. This is very useful for creating stuff like boot menus.
>
> This change lets isoimage-isohybrid use --configfile; if this option is
> not specified in a wks, it generates a default cfg as before.
>
> Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
> ---
> .../lib/wic/plugins/source/isoimage-isohybrid.py | 59 ++++++++++++++--------
> 1 file changed, 37 insertions(+), 22 deletions(-)
>
> diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> index bc99283..37d2fc2 100644
> --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> @@ -27,6 +27,7 @@ import glob
>
> from wic import msger
> from wic.pluginbase import SourcePlugin
> +from wic.utils.misc import get_custom_config
> from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
>
> class IsoImagePlugin(SourcePlugin):
> @@ -94,33 +95,47 @@ class IsoImagePlugin(SourcePlugin):
> """
> Create loader-specific (grub-efi) config
> """
> - splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
> - if os.path.exists(splash):
> - splashline = "menu background splash.jpg"
> - else:
> - splashline = ""
> + configfile = creator.ks.bootloader.configfile
> + custom_cfg = None
> + if configfile:
> + custom_cfg = get_custom_config(configfile)
> + if custom_cfg:
> + # Use a custom configuration for grub
> + grubefi_conf = custom_cfg
> + msger.debug("Using custom configuration file "
> + "%s for grub.cfg" % configfile)
> + else:
> + msger.error("configfile is specified but failed to "
> + "get it from %s." % configfile)
>
> - bootloader = creator.ks.bootloader
> + if not custom_cfg:
Looks like you don't need custom_cfg variable here. This code can be put
into 'else' scope of 'if configfile' statement.
> + splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
> + if os.path.exists(splash):
> + splashline = "menu background splash.jpg"
> + else:
> + splashline = ""
>
> - grubefi_conf = ""
> - grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
> - grubefi_conf += "--parity=no --stop=1\n"
> - grubefi_conf += "default=boot\n"
> - grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
> - grubefi_conf += "\n"
> - grubefi_conf += "search --set=root --label %s " % part.label
> - grubefi_conf += "\n"
> - grubefi_conf += "menuentry 'boot'{\n"
> + bootloader = creator.ks.bootloader
>
> - kernel = "/bzImage"
> + grubefi_conf = ""
> + grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
> + grubefi_conf += "--parity=no --stop=1\n"
> + grubefi_conf += "default=boot\n"
> + grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
> + grubefi_conf += "\n"
> + grubefi_conf += "search --set=root --label %s " % part.label
> + grubefi_conf += "\n"
> + grubefi_conf += "menuentry 'boot'{\n"
>
> - grubefi_conf += "linux %s rootwait %s\n" \
> - % (kernel, bootloader.append)
> - grubefi_conf += "initrd /initrd \n"
> - grubefi_conf += "}\n"
> + kernel = "/bzImage"
>
> - if splashline:
> - grubefi_conf += "%s\n" % splashline
> + grubefi_conf += "linux %s rootwait %s\n" \
> + % (kernel, bootloader.append)
> + grubefi_conf += "initrd /initrd \n"
> + grubefi_conf += "}\n"
> +
> + if splashline:
> + grubefi_conf += "%s\n" % splashline
>
> msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \
> % cr_workdir)
--
Regards,
Ed
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] wic: isoimage-isohybrid: add grubefi configfile support
@ 2016-04-20 9:17 Ioan-Adrian Ratiu
2016-04-20 8:16 ` Ed Bartosh
0 siblings, 1 reply; 6+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-04-20 9:17 UTC (permalink / raw)
To: openembedded-core
The latest wic kickstart refactoring introduced a bootloader option
"--configfile" which lets wks' specify a custom grub.cfg for use
while booting. This is very useful for creating stuff like boot menus.
This change lets isoimage-isohybrid use --configfile; if this option is
not specified in a wks, it generates a default cfg as before.
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
---
.../lib/wic/plugins/source/isoimage-isohybrid.py | 59 ++++++++++++++--------
1 file changed, 37 insertions(+), 22 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index bc99283..37d2fc2 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -27,6 +27,7 @@ import glob
from wic import msger
from wic.pluginbase import SourcePlugin
+from wic.utils.misc import get_custom_config
from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
class IsoImagePlugin(SourcePlugin):
@@ -94,33 +95,47 @@ class IsoImagePlugin(SourcePlugin):
"""
Create loader-specific (grub-efi) config
"""
- splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
- if os.path.exists(splash):
- splashline = "menu background splash.jpg"
- else:
- splashline = ""
+ configfile = creator.ks.bootloader.configfile
+ custom_cfg = None
+ if configfile:
+ custom_cfg = get_custom_config(configfile)
+ if custom_cfg:
+ # Use a custom configuration for grub
+ grubefi_conf = custom_cfg
+ msger.debug("Using custom configuration file "
+ "%s for grub.cfg" % configfile)
+ else:
+ msger.error("configfile is specified but failed to "
+ "get it from %s." % configfile)
- bootloader = creator.ks.bootloader
+ if not custom_cfg:
+ splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
+ if os.path.exists(splash):
+ splashline = "menu background splash.jpg"
+ else:
+ splashline = ""
- grubefi_conf = ""
- grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
- grubefi_conf += "--parity=no --stop=1\n"
- grubefi_conf += "default=boot\n"
- grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
- grubefi_conf += "\n"
- grubefi_conf += "search --set=root --label %s " % part.label
- grubefi_conf += "\n"
- grubefi_conf += "menuentry 'boot'{\n"
+ bootloader = creator.ks.bootloader
- kernel = "/bzImage"
+ grubefi_conf = ""
+ grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
+ grubefi_conf += "--parity=no --stop=1\n"
+ grubefi_conf += "default=boot\n"
+ grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
+ grubefi_conf += "\n"
+ grubefi_conf += "search --set=root --label %s " % part.label
+ grubefi_conf += "\n"
+ grubefi_conf += "menuentry 'boot'{\n"
- grubefi_conf += "linux %s rootwait %s\n" \
- % (kernel, bootloader.append)
- grubefi_conf += "initrd /initrd \n"
- grubefi_conf += "}\n"
+ kernel = "/bzImage"
- if splashline:
- grubefi_conf += "%s\n" % splashline
+ grubefi_conf += "linux %s rootwait %s\n" \
+ % (kernel, bootloader.append)
+ grubefi_conf += "initrd /initrd \n"
+ grubefi_conf += "}\n"
+
+ if splashline:
+ grubefi_conf += "%s\n" % splashline
msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \
% cr_workdir)
--
2.8.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] wic: isoimage-isohybrid: add grubefi configfile support
2016-04-21 7:03 ` Ed Bartosh
@ 2016-04-21 9:42 ` Ioan-Adrian Ratiu
0 siblings, 0 replies; 6+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-04-21 9:42 UTC (permalink / raw)
To: Ed Bartosh; +Cc: openembedded-core
On Thu, 21 Apr 2016 10:03:31 +0300
Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
> On Wed, Apr 20, 2016 at 06:08:38PM +0300, Ioan-Adrian Ratiu wrote:
> > I forgot to mention this is v2... sorry.
> >
> > On Wed, 20 Apr 2016 18:06:15 +0300
> > Ioan-Adrian Ratiu <adrian.ratiu@ni.com> wrote:
> >
> > > The latest wic kickstart refactoring introduced a bootloader option
> > > "--configfile" which lets wks' specify a custom grub.cfg for use
> > > while booting. This is very useful for creating stuff like boot menus.
> > >
> > > This change lets isoimage-isohybrid use --configfile; if this option is
> > > not specified in a wks, it generates a default cfg as before.
> > >
> > > Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
> > > ---
> > > .../lib/wic/plugins/source/isoimage-isohybrid.py | 53 +++++++++++++---------
> > > 1 file changed, 32 insertions(+), 21 deletions(-)
> > >
> > > diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> > > index bc99283..8440581 100644
> > > --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> > > +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> > > @@ -27,6 +27,7 @@ import glob
> > >
> > > from wic import msger
> > > from wic.pluginbase import SourcePlugin
> > > +from wic.utils.misc import get_custom_config
> > > from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
> > >
> > > class IsoImagePlugin(SourcePlugin):
> > > @@ -94,33 +95,43 @@ class IsoImagePlugin(SourcePlugin):
> > > """
> > > Create loader-specific (grub-efi) config
> > > """
> > > - splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
> > > - if os.path.exists(splash):
> > > - splashline = "menu background splash.jpg"
> > > + configfile = creator.ks.bootloader.configfile
> > > + if configfile:
> > > + grubefi_conf = get_custom_config(configfile)
> > > + if grubefi_conf:
> > > + msger.debug("Using custom configuration file "
> > > + "%s for grub.cfg" % configfile)
> > > + else:
> > > + msger.error("configfile is specified but failed to "
> > > + "get it from %s." % configfile)
> > > else:
> > > - splashline = ""
> > > + splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
> I know, it's not your code, but it looks like the result path(splash
> variable) will not include workdir. Look:
>
> In [2]: os.path.join('/path/to/workdir', '/EFI/boot/splash.jpg')
> Out[2]: '/EFI/boot/splash.jpg'
>
> In [3]: os.path.join('/path/to/workdir/', '/EFI/boot/splash.jpg')
> Out[3]: '/EFI/boot/splash.jpg'
>
> It works this way:
> In [4]: os.path.join('/path/to/workdir/', 'EFI/boot/splash.jpg')
> Out[4]: '/path/to/workdir/EFI/boot/splash.jpg'
>
Thanks for spotting this. I'll send another patch to fix it.
Ioan
> > > + if os.path.exists(splash):
> > > + splashline = "menu background splash.jpg"
> > > + else:
> > > + splashline = ""
> > >
> > > - bootloader = creator.ks.bootloader
> > > + bootloader = creator.ks.bootloader
> > >
> > > - grubefi_conf = ""
> > > - grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
> > > - grubefi_conf += "--parity=no --stop=1\n"
> > > - grubefi_conf += "default=boot\n"
> > > - grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
> > > - grubefi_conf += "\n"
> > > - grubefi_conf += "search --set=root --label %s " % part.label
> > > - grubefi_conf += "\n"
> > > - grubefi_conf += "menuentry 'boot'{\n"
> > > + grubefi_conf = ""
> > > + grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
> > > + grubefi_conf += "--parity=no --stop=1\n"
> > > + grubefi_conf += "default=boot\n"
> > > + grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
> > > + grubefi_conf += "\n"
> > > + grubefi_conf += "search --set=root --label %s " % part.label
> > > + grubefi_conf += "\n"
> > > + grubefi_conf += "menuentry 'boot'{\n"
> > >
> > > - kernel = "/bzImage"
> > > + kernel = "/bzImage"
> > >
> > > - grubefi_conf += "linux %s rootwait %s\n" \
> > > - % (kernel, bootloader.append)
> > > - grubefi_conf += "initrd /initrd \n"
> > > - grubefi_conf += "}\n"
> > > + grubefi_conf += "linux %s rootwait %s\n" \
> > > + % (kernel, bootloader.append)
> > > + grubefi_conf += "initrd /initrd \n"
> > > + grubefi_conf += "}\n"
> > >
> > > - if splashline:
> > > - grubefi_conf += "%s\n" % splashline
> > > + if splashline:
> > > + grubefi_conf += "%s\n" % splashline
> > >
> > > msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \
> > > % cr_workdir)
> >
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wic: isoimage-isohybrid: add grubefi configfile support
2016-04-20 15:08 ` Ioan-Adrian Ratiu
@ 2016-04-21 7:03 ` Ed Bartosh
2016-04-21 9:42 ` Ioan-Adrian Ratiu
0 siblings, 1 reply; 6+ messages in thread
From: Ed Bartosh @ 2016-04-21 7:03 UTC (permalink / raw)
To: Ioan-Adrian Ratiu; +Cc: openembedded-core
On Wed, Apr 20, 2016 at 06:08:38PM +0300, Ioan-Adrian Ratiu wrote:
> I forgot to mention this is v2... sorry.
>
> On Wed, 20 Apr 2016 18:06:15 +0300
> Ioan-Adrian Ratiu <adrian.ratiu@ni.com> wrote:
>
> > The latest wic kickstart refactoring introduced a bootloader option
> > "--configfile" which lets wks' specify a custom grub.cfg for use
> > while booting. This is very useful for creating stuff like boot menus.
> >
> > This change lets isoimage-isohybrid use --configfile; if this option is
> > not specified in a wks, it generates a default cfg as before.
> >
> > Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
> > ---
> > .../lib/wic/plugins/source/isoimage-isohybrid.py | 53 +++++++++++++---------
> > 1 file changed, 32 insertions(+), 21 deletions(-)
> >
> > diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> > index bc99283..8440581 100644
> > --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> > +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> > @@ -27,6 +27,7 @@ import glob
> >
> > from wic import msger
> > from wic.pluginbase import SourcePlugin
> > +from wic.utils.misc import get_custom_config
> > from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
> >
> > class IsoImagePlugin(SourcePlugin):
> > @@ -94,33 +95,43 @@ class IsoImagePlugin(SourcePlugin):
> > """
> > Create loader-specific (grub-efi) config
> > """
> > - splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
> > - if os.path.exists(splash):
> > - splashline = "menu background splash.jpg"
> > + configfile = creator.ks.bootloader.configfile
> > + if configfile:
> > + grubefi_conf = get_custom_config(configfile)
> > + if grubefi_conf:
> > + msger.debug("Using custom configuration file "
> > + "%s for grub.cfg" % configfile)
> > + else:
> > + msger.error("configfile is specified but failed to "
> > + "get it from %s." % configfile)
> > else:
> > - splashline = ""
> > + splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
I know, it's not your code, but it looks like the result path(splash
variable) will not include workdir. Look:
In [2]: os.path.join('/path/to/workdir', '/EFI/boot/splash.jpg')
Out[2]: '/EFI/boot/splash.jpg'
In [3]: os.path.join('/path/to/workdir/', '/EFI/boot/splash.jpg')
Out[3]: '/EFI/boot/splash.jpg'
It works this way:
In [4]: os.path.join('/path/to/workdir/', 'EFI/boot/splash.jpg')
Out[4]: '/path/to/workdir/EFI/boot/splash.jpg'
> > + if os.path.exists(splash):
> > + splashline = "menu background splash.jpg"
> > + else:
> > + splashline = ""
> >
> > - bootloader = creator.ks.bootloader
> > + bootloader = creator.ks.bootloader
> >
> > - grubefi_conf = ""
> > - grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
> > - grubefi_conf += "--parity=no --stop=1\n"
> > - grubefi_conf += "default=boot\n"
> > - grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
> > - grubefi_conf += "\n"
> > - grubefi_conf += "search --set=root --label %s " % part.label
> > - grubefi_conf += "\n"
> > - grubefi_conf += "menuentry 'boot'{\n"
> > + grubefi_conf = ""
> > + grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
> > + grubefi_conf += "--parity=no --stop=1\n"
> > + grubefi_conf += "default=boot\n"
> > + grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
> > + grubefi_conf += "\n"
> > + grubefi_conf += "search --set=root --label %s " % part.label
> > + grubefi_conf += "\n"
> > + grubefi_conf += "menuentry 'boot'{\n"
> >
> > - kernel = "/bzImage"
> > + kernel = "/bzImage"
> >
> > - grubefi_conf += "linux %s rootwait %s\n" \
> > - % (kernel, bootloader.append)
> > - grubefi_conf += "initrd /initrd \n"
> > - grubefi_conf += "}\n"
> > + grubefi_conf += "linux %s rootwait %s\n" \
> > + % (kernel, bootloader.append)
> > + grubefi_conf += "initrd /initrd \n"
> > + grubefi_conf += "}\n"
> >
> > - if splashline:
> > - grubefi_conf += "%s\n" % splashline
> > + if splashline:
> > + grubefi_conf += "%s\n" % splashline
> >
> > msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \
> > % cr_workdir)
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
--
--
Regards,
Ed
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wic: isoimage-isohybrid: add grubefi configfile support
2016-04-20 15:06 Ioan-Adrian Ratiu
@ 2016-04-20 15:08 ` Ioan-Adrian Ratiu
2016-04-21 7:03 ` Ed Bartosh
0 siblings, 1 reply; 6+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-04-20 15:08 UTC (permalink / raw)
To: openembedded-core
I forgot to mention this is v2... sorry.
On Wed, 20 Apr 2016 18:06:15 +0300
Ioan-Adrian Ratiu <adrian.ratiu@ni.com> wrote:
> The latest wic kickstart refactoring introduced a bootloader option
> "--configfile" which lets wks' specify a custom grub.cfg for use
> while booting. This is very useful for creating stuff like boot menus.
>
> This change lets isoimage-isohybrid use --configfile; if this option is
> not specified in a wks, it generates a default cfg as before.
>
> Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
> ---
> .../lib/wic/plugins/source/isoimage-isohybrid.py | 53 +++++++++++++---------
> 1 file changed, 32 insertions(+), 21 deletions(-)
>
> diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> index bc99283..8440581 100644
> --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> @@ -27,6 +27,7 @@ import glob
>
> from wic import msger
> from wic.pluginbase import SourcePlugin
> +from wic.utils.misc import get_custom_config
> from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
>
> class IsoImagePlugin(SourcePlugin):
> @@ -94,33 +95,43 @@ class IsoImagePlugin(SourcePlugin):
> """
> Create loader-specific (grub-efi) config
> """
> - splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
> - if os.path.exists(splash):
> - splashline = "menu background splash.jpg"
> + configfile = creator.ks.bootloader.configfile
> + if configfile:
> + grubefi_conf = get_custom_config(configfile)
> + if grubefi_conf:
> + msger.debug("Using custom configuration file "
> + "%s for grub.cfg" % configfile)
> + else:
> + msger.error("configfile is specified but failed to "
> + "get it from %s." % configfile)
> else:
> - splashline = ""
> + splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
> + if os.path.exists(splash):
> + splashline = "menu background splash.jpg"
> + else:
> + splashline = ""
>
> - bootloader = creator.ks.bootloader
> + bootloader = creator.ks.bootloader
>
> - grubefi_conf = ""
> - grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
> - grubefi_conf += "--parity=no --stop=1\n"
> - grubefi_conf += "default=boot\n"
> - grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
> - grubefi_conf += "\n"
> - grubefi_conf += "search --set=root --label %s " % part.label
> - grubefi_conf += "\n"
> - grubefi_conf += "menuentry 'boot'{\n"
> + grubefi_conf = ""
> + grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
> + grubefi_conf += "--parity=no --stop=1\n"
> + grubefi_conf += "default=boot\n"
> + grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
> + grubefi_conf += "\n"
> + grubefi_conf += "search --set=root --label %s " % part.label
> + grubefi_conf += "\n"
> + grubefi_conf += "menuentry 'boot'{\n"
>
> - kernel = "/bzImage"
> + kernel = "/bzImage"
>
> - grubefi_conf += "linux %s rootwait %s\n" \
> - % (kernel, bootloader.append)
> - grubefi_conf += "initrd /initrd \n"
> - grubefi_conf += "}\n"
> + grubefi_conf += "linux %s rootwait %s\n" \
> + % (kernel, bootloader.append)
> + grubefi_conf += "initrd /initrd \n"
> + grubefi_conf += "}\n"
>
> - if splashline:
> - grubefi_conf += "%s\n" % splashline
> + if splashline:
> + grubefi_conf += "%s\n" % splashline
>
> msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \
> % cr_workdir)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] wic: isoimage-isohybrid: add grubefi configfile support
@ 2016-04-20 15:06 Ioan-Adrian Ratiu
2016-04-20 15:08 ` Ioan-Adrian Ratiu
0 siblings, 1 reply; 6+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-04-20 15:06 UTC (permalink / raw)
To: openembedded-core
The latest wic kickstart refactoring introduced a bootloader option
"--configfile" which lets wks' specify a custom grub.cfg for use
while booting. This is very useful for creating stuff like boot menus.
This change lets isoimage-isohybrid use --configfile; if this option is
not specified in a wks, it generates a default cfg as before.
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
---
.../lib/wic/plugins/source/isoimage-isohybrid.py | 53 +++++++++++++---------
1 file changed, 32 insertions(+), 21 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index bc99283..8440581 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -27,6 +27,7 @@ import glob
from wic import msger
from wic.pluginbase import SourcePlugin
+from wic.utils.misc import get_custom_config
from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
class IsoImagePlugin(SourcePlugin):
@@ -94,33 +95,43 @@ class IsoImagePlugin(SourcePlugin):
"""
Create loader-specific (grub-efi) config
"""
- splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
- if os.path.exists(splash):
- splashline = "menu background splash.jpg"
+ configfile = creator.ks.bootloader.configfile
+ if configfile:
+ grubefi_conf = get_custom_config(configfile)
+ if grubefi_conf:
+ msger.debug("Using custom configuration file "
+ "%s for grub.cfg" % configfile)
+ else:
+ msger.error("configfile is specified but failed to "
+ "get it from %s." % configfile)
else:
- splashline = ""
+ splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
+ if os.path.exists(splash):
+ splashline = "menu background splash.jpg"
+ else:
+ splashline = ""
- bootloader = creator.ks.bootloader
+ bootloader = creator.ks.bootloader
- grubefi_conf = ""
- grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
- grubefi_conf += "--parity=no --stop=1\n"
- grubefi_conf += "default=boot\n"
- grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
- grubefi_conf += "\n"
- grubefi_conf += "search --set=root --label %s " % part.label
- grubefi_conf += "\n"
- grubefi_conf += "menuentry 'boot'{\n"
+ grubefi_conf = ""
+ grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
+ grubefi_conf += "--parity=no --stop=1\n"
+ grubefi_conf += "default=boot\n"
+ grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
+ grubefi_conf += "\n"
+ grubefi_conf += "search --set=root --label %s " % part.label
+ grubefi_conf += "\n"
+ grubefi_conf += "menuentry 'boot'{\n"
- kernel = "/bzImage"
+ kernel = "/bzImage"
- grubefi_conf += "linux %s rootwait %s\n" \
- % (kernel, bootloader.append)
- grubefi_conf += "initrd /initrd \n"
- grubefi_conf += "}\n"
+ grubefi_conf += "linux %s rootwait %s\n" \
+ % (kernel, bootloader.append)
+ grubefi_conf += "initrd /initrd \n"
+ grubefi_conf += "}\n"
- if splashline:
- grubefi_conf += "%s\n" % splashline
+ if splashline:
+ grubefi_conf += "%s\n" % splashline
msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \
% cr_workdir)
--
2.8.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-21 9:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-20 9:17 [PATCH] wic: isoimage-isohybrid: add grubefi configfile support Ioan-Adrian Ratiu
2016-04-20 8:16 ` Ed Bartosh
2016-04-20 15:06 Ioan-Adrian Ratiu
2016-04-20 15:08 ` Ioan-Adrian Ratiu
2016-04-21 7:03 ` Ed Bartosh
2016-04-21 9:42 ` Ioan-Adrian Ratiu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.