All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: Tom Rini <trini@konsulko.com>
Cc: Christopher Larson <chris_larson@mentor.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] wic: Generate startup.nsh for EFI cases if none found
Date: Thu, 28 Sep 2017 18:47:07 +0300	[thread overview]
Message-ID: <20170928154707.362zfbhccbydkdox@linux.intel.com> (raw)
In-Reply-To: <1505923407-31734-1-git-send-email-trini@konsulko.com>

On Wed, Sep 20, 2017 at 12:03:27PM -0400, Tom Rini wrote:
> In the case of non-wic images there is logic today to generate a
> startup.nsh file that will be executed by EFI to run the loader that the
> image contains.  In the WIC case is currently depends on that file being
> generated elsewhere and placed in DEPLOY_DIR_IMAGE and only used if
> present there.

What's wrong with this approach?

I'd be happy to make wic to do only partitioning and assembling the
image and avoiding to modify image content as much as possible.
That would make wic design much more clear and let us to remove
a lot of duplication between wic and meta/classes code.

Regarding boot partition content, I think preparing it from bootfs
directory the same way as it's done for root partition is the way to go.
You can find more details about it here:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=10073

>  This extends the logic we have today in wic to save the
> name of the loader that's being placed and if no startup.nsh is provided
> already generate the default kind that grub-efi/systemd-boot.bbclass
> generate.
> 
> Cc: Ed Bartosh <ed.bartosh@linux.intel.com>
> Cc: Christopher Larson <chris_larson@mentor.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  scripts/lib/wic/plugins/source/bootimg-efi.py | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
> index 4c4f36a32f56..f4643fc233b2 100644
> --- a/scripts/lib/wic/plugins/source/bootimg-efi.py
> +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
> @@ -204,13 +204,15 @@ class BootimgEFIPlugin(SourcePlugin):
>                  shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
>                                  "%s/grub.cfg" % cr_workdir)
>                  for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]:
> -                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:])
> +                    loader = mod[9:]
> +                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, loader)
>                      exec_cmd(cp_cmd, True)
>                  shutil.move("%s/grub.cfg" % cr_workdir,
>                              "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir)
>              elif source_params['loader'] == 'systemd-boot':
>                  for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]:
> -                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:])
> +                    loader = mod[8:]
> +                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, loader)
>                      exec_cmd(cp_cmd, True)
>              else:
>                  raise WicError("unrecognized bootimg-efi loader: %s" %
> @@ -222,6 +224,10 @@ class BootimgEFIPlugin(SourcePlugin):
>          if os.path.exists(startup):
>              cp_cmd = "cp %s %s/" % (startup, hdddir)
>              exec_cmd(cp_cmd, True)
> +        else:
> +            cfg = open("%s/startup.nsh" % hdddir, "w")
> +            cfg.write("fs0:EFI\\BOOT\\%s\n" % loader)
> +            cfg.close()
>  
>          du_cmd = "du -bks %s" % hdddir
>          out = exec_cmd(du_cmd)
> -- 
> 1.9.1
> 

-- 
--
Regards,
Ed


  reply	other threads:[~2017-09-28 15:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 16:03 [PATCH] wic: Generate startup.nsh for EFI cases if none found Tom Rini
2017-09-28 15:47 ` Ed Bartosh [this message]
2017-09-28 17:44   ` Tom Rini
2017-09-28 17:46     ` Otavio Salvador
2017-09-28 17:49       ` Tom Rini
2017-09-28 17:57         ` Otavio Salvador
2017-09-28 17:59           ` Tom Rini
2017-09-28 18:01             ` Otavio Salvador
2017-09-28 18:04               ` Tom Rini
2017-09-29 11:27     ` Ed Bartosh
2017-09-29 12:35       ` Tom Rini
2017-09-29 13:44         ` Ed Bartosh
2017-09-29 13:50           ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170928154707.362zfbhccbydkdox@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=chris_larson@mentor.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=trini@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.