From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) by mail.openembedded.org (Postfix) with ESMTP id 7BE6771BFC for ; Wed, 5 Sep 2018 02:34:33 +0000 (UTC) Received: from ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id w852YXOi021469 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 4 Sep 2018 19:34:33 -0700 (PDT) Received: from [128.224.162.214] (128.224.162.214) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server id 14.3.408.0; Tue, 4 Sep 2018 19:34:31 -0700 Reply-To: To: Tom Rini References: <1535681710-29461-1-git-send-email-lu.jiang@windriver.com> <1535681710-29461-7-git-send-email-lu.jiang@windriver.com> <20180831135228.GN26633@bill-the-cat> <3b8b5b68-5cdc-eddf-59c4-4ff70d00c551@windriver.com> <20180904022609.GL26633@bill-the-cat> <20180905003319.GZ26633@bill-the-cat> From: "Lu.Jiang" Message-ID: Date: Wed, 5 Sep 2018 10:32:32 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180905003319.GZ26633@bill-the-cat> X-Originating-IP: [128.224.162.214] Cc: openembedded-core@lists.openembedded.org Subject: Re: [PATCH 6/7] wic:bootimg-efi:try other place for efi X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 02:34:33 -0000 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US 在 2018年09月05日 08:33, Tom Rini 写道: > On Tue, Sep 04, 2018 at 10:33:43AM +0800, Lu.Jiang wrote: >> 在 2018年09月04日 10:26, Tom Rini 写道: >>> On Tue, Sep 04, 2018 at 10:15:44AM +0800, Lu.Jiang wrote: >>>> 在 2018年09月03日 10:01, Lu.Jiang 写道: >>>>> 在 2018年08月31日 21:52, Tom Rini 写道: >>>>>> On Fri, Aug 31, 2018 at 10:15:09AM +0800, Jiang Lu wrote: >>>>>> >>>>>>> When there is no useful efi in $kerneldir, try copy >>>>>>> all efi from EFI/BOOT into boot image. >>>>>>> >>>>>>> Signed-off-by: Jiang Lu >>>>>>> --- >>>>>>>   .../wic/files/wic/plugins/source/bootimg-efi.py | 12 ++++++++++++ >>>>>>>   1 file changed, 12 insertions(+) >>>>>>> >>>>>>> diff --git >>>>>>> a/meta/recipes-support/wic/files/wic/plugins/source/bootimg-efi.py >>>>>>> b/meta/recipes-support/wic/files/wic/plugins/source/bootimg-efi.py >>>>>>> index 0eb86a0..d435268 100644 >>>>>>> --- a/meta/recipes-support/wic/files/wic/plugins/source/bootimg-efi.py >>>>>>> +++ b/meta/recipes-support/wic/files/wic/plugins/source/bootimg-efi.py >>>>>>> @@ -231,6 +231,18 @@ class BootimgEFIPlugin(SourcePlugin): >>>>>>>               else: >>>>>>>                   raise WicError("unrecognized bootimg-efi loader: %s" >>>>>>> % >>>>>>>                                  source_params['loader']) >>>>>>> +            os.listdir("%s/EFI/BOOT/" % hdddir) >>>>>>> +            found_efi = False >>>>>>> +            for x in os.listdir("%s/EFI/BOOT/" % hdddir) : >>>>>>> +                if x.endswith(".efi"): >>>>>>> +                    found_efi = True >>>>>>> +                    break; >>>>>>> +            if not found_efi: >>>>>>> +                cp_cmd = "cp %s/EFI/BOOT/*.efi %s/EFI/BOOT/" % >>>>>>> (kernel_dir, hdddir) >>>>>>> +                try: >>>>>>> +                    exec_cmd(cp_cmd, True) >>>>>>> +                except: >>>>>>> +                    pass >>>>>>>           except KeyError: >>>>>>>               raise WicError("bootimg-efi requires a loader, none >>>>>>> specified") >>>>>> I'm not sure this is the right approach.  If you don't have things set >>>>>> up for automagic finding you should use bootimg-partition and >>>>>> IMAGE_BOOT_FILES.  I'm doing this right now for some EFI projects >>>>>> because it's also bad form to dump everything into EFI/BOOT and some >>>>>> things should end up in EFI/vendorname or similar. >>>>>> >>>> Hi Tom, >>>> >>>> By indicating IMAGE_BOOT_FILES for bootimg-partition, can perform copy file >>>> work. While we still need the code in bootimg-efi to re-generate grub.cfg. >>>> >>>> I prefer use bootimg-efi for this case, but we can add a new parameter to >>>> distinguish kernel dir & bootloader dir(for efi files) >>> I'm still not seeing why we need this, sorry. >>> >>> If we need files in the ESP in EFI/BOOT/ then in our root filesystem >>> they're already in as /boot/efi/EFI/BOOT and we say that we populate >>> things from /boot/efi and this also gets us things like >>> /boot/efi/EFI/vendor and so forth populated and matches other Linux >>> distributions. >>> >>> If we need something more complex, we have IMAGE_BOOT_FILES available >>> and can and should be populating the deploy directory like other >>> architectures and loaders do. >>> >> bootimg-efi performed following for grub boot partition: >> >> 1.copy grub-efi-* from $KERNEL_DIR into $/boot/EFI/BOOT/ >> >> 2.copy bzImage from $KERNEL_DIR into $/boot/ >> >> 3.generate grub.cfg based select booting device. >> >> On target system, if we select booting device from running system as source >> for booting-efi will meet issue. Because the *.efi & bzImage is not in the >> same directory. >> >> As you suggested, we may invoke booting-partition by feeding >> $IMAGE_BOOT_FILES to indicating file need copy, this could done work 1 & 2. >> While we still need generated grub.cfg. > One of the great strengths of wic is that it can cover a lot of > different fairly complex use cases automatically, and still provide an > expert "out" for when you're doing something fairly different but still > want to leverage wic. While I don't understand the use case of turning > a live system into a wic image, it sounds like what you're looking for > is the case of "and we provide our own loader config file". You should > be including grub.cfg into the IMAGE_BOOT_FILES list and generate this > however you need it. Since you've already booted you should already > have a correct EFI/ directory to look at (we ought to stop having > top-level bzImage, that's not right, but that's orthogonal to this > thread). The grub.cfg is generated in bootimg-efi.py. At least, it need include the new generated uuid info for rootfs partition. So we still need a piece of code from bootimg-efi.py to generate grub.cfg at runtime. The issue this patch try to fix is bootimg-efi assume bzImage & grub-*.efi located at top level of $KERNEL_DIR. This is true for bitbake's deploy dir. However, it didn't apply to target. We need provide a way for adding search path for *.efi. I believe wic is a powerful tool not only working under oe environment, it can be a simply implement tool on target. So try to add  a few patch to make it working on target. Thanks Jiang Lu > > All that said, I'm also not sure why, roughly, this doesn't work for the > use case: > IMAGE_BOOT_FILE = "\ > /boot/efi/EFI/BOOT/bootx64.efi;EFI/BOOT/bootx64.efi \ > ... > /boot/bzImage;EFI/yocto/bzImage \ > " > > And you may want to address that we don't package our default grub > binary, or have the script that's running wic make your grub.efi binary. > I kind of lean towards the former being something we should be doing and > aren't. There's I think a lot of stuff that could be made more > consistent with other architectures and loaders but isn't currently. > That too is somewhat orthogonal to this series I'll admit. >