diff mbox series

[v2] wic: bootimg-pcbios.py: optionally pass 'initrd' from .wks(.in) via sourceparams

Message ID 20241206164822.18330-1-Robert.Berger@ReliableEmbeddedSystems.com
State New
Headers show
Series [v2] wic: bootimg-pcbios.py: optionally pass 'initrd' from .wks(.in) via sourceparams | expand

Commit Message

Robert Berger Dec. 6, 2024, 4:48 p.m. UTC
optionally allow to pass 'initrd' from .wks(.in) via sourceparams

Signed-off-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
---
 .../lib/wic/plugins/source/bootimg-pcbios.py  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Mathieu Dubois-Briand Dec. 9, 2024, 7:05 a.m. UTC | #1
On Fri Dec 6, 2024 at 5:48 PM CET, Robert Berger via lists.openembedded.org wrote:
> optionally allow to pass 'initrd' from .wks(.in) via sourceparams
>
> Signed-off-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> ---

Hi,

I believe this patch is the source of the following error on the
autobuilder:

  File "/srv/pokybuild/yocto-worker/wic/build/scripts/lib/wic/plugins/source/bootimg-pcbios.py", line 177, in do_prepare_partition
    initrd_dir_and_file = os.path.join(deploy_dir_image, initrd)
  File "<frozen posixpath>", line 89, in join
  File "<frozen genericpath>", line 188, in _check_arg_types
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

https://valkyrie.yoctoproject.org/#/builders/15/builds/580/steps/12/logs/stdio

Can you have a look at this issue, please ?
Robert Berger Dec. 9, 2024, 12:11 p.m. UTC | #2
Hi,

On 12/9/24 08:05, Mathieu Dubois-Briand wrote:
> On Fri Dec 6, 2024 at 5:48 PM CET, Robert Berger via lists.openembedded.org wrote:
>> optionally allow to pass 'initrd' from .wks(.in) via sourceparams
>>
>> Signed-off-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
>> ---
> 
> Hi,
> 
> I believe this patch is the source of the following error on the
> autobuilder:
> 
>    File "/srv/pokybuild/yocto-worker/wic/build/scripts/lib/wic/plugins/source/bootimg-pcbios.py", line 177, in do_prepare_partition
>      initrd_dir_and_file = os.path.join(deploy_dir_image, initrd)
>    File "<frozen posixpath>", line 89, in join
>    File "<frozen genericpath>", line 188, in _check_arg_types
> TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

Hmm yes this looks suspicious.

> 
> https://valkyrie.yoctoproject.org/#/builders/15/builds/580/steps/12/logs/stdio
> 
> Can you have a look at this issue, please ?
> 
> 

Can you tell me what you tried to build to get this error?

I guess the problem is, that it's not quite that "optional" as it should 
be so when you don't pass the initrd you get the error.

Regards

Robert
Alexander Kanavin Dec. 9, 2024, 12:15 p.m. UTC | #3
On Mon, 9 Dec 2024 at 13:11, Robert Berger via lists.openembedded.org
<oecore.mailinglist=gmail.com@lists.openembedded.org> wrote:
> Can you tell me what you tried to build to get this error?

This requires a bit of specialist knowledge: you need to look at the
top of the page that the build was using 'wic' configuration, and that
configuration can be found here:
https://git.yoctoproject.org/yocto-autobuilder-helper/tree/config.json#n1056

Alex
Robert Berger Dec. 9, 2024, 2:29 p.m. UTC | #4
Hi,


On 12/9/24 08:05, Mathieu Dubois-Briand wrote:
> On Fri Dec 6, 2024 at 5:48 PM CET, Robert Berger via lists.openembedded.org wrote:
>> optionally allow to pass 'initrd' from .wks(.in) via sourceparams
>>
>> Signed-off-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
>> ---
> 
> Hi,
> 
> I believe this patch is the source of the following error on the
> autobuilder:
> 
>    File "/srv/pokybuild/yocto-worker/wic/build/scripts/lib/wic/plugins/source/bootimg-pcbios.py", line 177, in do_prepare_partition
>      initrd_dir_and_file = os.path.join(deploy_dir_image, initrd)
>    File "<frozen posixpath>", line 89, in join
>    File "<frozen genericpath>", line 188, in _check_arg_types
> TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
> 
> https://valkyrie.yoctoproject.org/#/builders/15/builds/580/steps/12/logs/stdio
> 
> Can you have a look at this issue, please ?
> 
> 

Please drop that patch for now - it will take me some time to find my 
example which uses it ;)

Regards,

Robert
diff mbox series

Patch

diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index a207a83530..c31851b56a 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -169,6 +169,25 @@  class BootimgPcbiosPlugin(SourcePlugin):
         for install_cmd in cmds:
             exec_cmd(install_cmd)
 
+        # this is hardcoded to where the cpio.gz is deployed to
+        deploy_dir_image = get_bitbake_var("DEPLOY_DIR_IMAGE")
+        # this can be passed from the .wks.in file via sourceparams
+        initrd = source_params.get('initrd')
+        # for convenience added together
+        initrd_dir_and_file = os.path.join(deploy_dir_image, initrd)
+
+        # in case we have a separate cpio.gz let's copy it to
+        # the boot partition
+        if os.path.isfile(initrd_dir_and_file):
+            logger.debug("Found %s", initrd_dir_and_file)
+        else:
+            logger.debug("Did not find %s", initrd_dir_and_file)
+
+        new_cmd = ("install -m 444 %s %s" %
+                  (initrd_dir_and_file, hdddir))
+
+        exec_cmd(new_cmd)
+
         du_cmd = "du -bks %s" % hdddir
         out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])