Skip to contentSkip to conversation

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

PATCH In review Robert Berger 3 participants 5 messages Dec 6, 2024 – Dec 9, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wic: bootimg-pcbios.py: optionally pass 'initrd' from .wks(.in) via sourceparams

optionally allow to pass 'initrd' from .wks(.in) via sourceparams

---
 .../lib/wic/plugins/source/bootimg-pcbios.py  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
scripts/lib/wic/plugins/source/bootimg-pcbios.py +19 -0
index a207a83530..c31851b56a 100644
@@ -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])
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Robert Berger via lists.openembedded.org

optionally allow to pass 'initrd' from .wks(.in) via sourceparams

---

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 ?

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

Hi,

Quoted 8 lines · Mathieu Dubois-Briand
Quoted 4 lines · Robert Berger via lists.openembedded.org

optionally allow to pass 'initrd' from .wks(.in) via sourceparams

---

Hi,

Quoted 8 lines

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.

Quoted 6 lines

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

Signature · 11 lines
Robert Berger
Embedded Software Evangelist

Reliable Embedded Systems
Consulting Training Engineering
URL: https://www.reliableembeddedsystems.com

Schedule a web meeting:
https://calendly.com/reliableembeddedsystems/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
#4 lore raw
In reply to Mathieu Dubois-Briand

Hi,

Quoted 17 lines · Mathieu Dubois-Briand
Quoted 4 lines · Robert Berger via lists.openembedded.org

optionally allow to pass 'initrd' from .wks(.in) via sourceparams

---

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'

Quoted 5 lines

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

Signature · 11 lines
Robert Berger
Embedded Software Evangelist

Reliable Embedded Systems
Consulting Training Engineering
URL: https://www.reliableembeddedsystems.com

Schedule a web meeting:
https://calendly.com/reliableembeddedsystems/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--