* wic plugins, any documentation?
@ 2025-01-07 15:57 Ulrich Teichert
2025-01-07 17:03 ` 'Jan Kiszka' via isar-users
0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Teichert @ 2025-01-07 15:57 UTC (permalink / raw)
To: isar-users
Hi,
I'm trying to write a wic plugin to generate a bootable partition for a Xilinix zynqmp
board. I've managed building the necessary infrastructure (bootgen) and have the
contents available for the python script. As far as I can tell all gets assembled correctly,
but it doesn't show up in the FAT partition (mounted as /boot on the target).
Is there a documentation available for wic plugins which I've missed? If not, would it
be a mistake for my plugin to derive from the RootfsPlugin? In which way the plugin
controls where the content ends up in the target partition?
TIA,
Uli
Schöne Grüße / Kind regards
Dipl.-Inform. Ulrich Teichert
Senior Software Developer
Phone +49 431 375938-0
_____________________________________
e.bs kumkeo GmbH
Heidenkampsweg 82a
20097 Hamburg, Deutschland
www.kumkeo.de
Geschäftsführer Michael Leitner, Günter Hagspiel
Registergericht Amtsgericht Hamburg
Registernummer HRB 187712
USt-Idnr. DE449906070
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/1167664383e9461a817771e1cdcd48e4%40kumkeo.de.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: wic plugins, any documentation?
2025-01-07 15:57 wic plugins, any documentation? Ulrich Teichert
@ 2025-01-07 17:03 ` 'Jan Kiszka' via isar-users
2025-01-08 7:46 ` AW: " Ulrich Teichert
0 siblings, 1 reply; 3+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-01-07 17:03 UTC (permalink / raw)
To: Ulrich Teichert, isar-users
On 07.01.25 16:57, Ulrich Teichert wrote:
> Hi,
>
> I'm trying to write a wic plugin to generate a bootable partition for a Xilinix zynqmp
> board. I've managed building the necessary infrastructure (bootgen) and have the
> contents available for the python script. As far as I can tell all gets assembled correctly,
> but it doesn't show up in the FAT partition (mounted as /boot on the target).
>
Hmm, I created images for zynqmp before but didn't need that back then:
https://github.com/siemens/jailhouse-images/blob/master/wic/ultra96.wks
What does your plugin have to do differently?
> Is there a documentation available for wic plugins which I've missed? If not, would it
> be a mistake for my plugin to derive from the RootfsPlugin? In which way the plugin
> controls where the content ends up in the target partition?
We are taking wic from upstream OE, and I'm not aware of any generated
doc from what wic has inline. But you could browse it, e.g. here:
https://github.com/ilbers/isar/blob/master/scripts/lib/wic/pluginbase.py
Jan
--
Siemens AG, Foundational Technologies
Linux Expert Center
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/601d6d45-c47f-47e3-acad-28547eb7413e%40siemens.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
* AW: Re: wic plugins, any documentation?
2025-01-07 17:03 ` 'Jan Kiszka' via isar-users
@ 2025-01-08 7:46 ` Ulrich Teichert
0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Teichert @ 2025-01-08 7:46 UTC (permalink / raw)
To: Jan Kiszka, isar-users
Hi Jan,
>> I'm trying to write a wic plugin to generate a bootable partition for a Xilinix zynqmp
>> board. I've managed building the necessary infrastructure (bootgen) and have the
>> contents available for the python script. As far as I can tell all gets assembled correctly,
>> but it doesn't show up in the FAT partition (mounted as /boot on the target).
>Hmm, I created images for zynqmp before but didn't need that back then:
>
>https://github.com/siemens/jailhouse-images/blob/master/wic/ultra96.wks
>
>What does your plugin have to do differently?
Perhaps it got too complicated - it's my first dip into wic:
part /boot --source bootgen-partition --sourceparams "fsbl=/usr/lib/boot-firmware/fsbl_a53.elf,pmu=/usr/lib/boot-firmware/pmufw.elf,armtfw=/usr/lib/arm-trusted-firmware/zynqmp/bl31.elf,uboot_dir=/usr/lib/boot-firmware/u-boot" --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 100M
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --mkfs-extraopts "-T default" --label root --align 4096 --exclude-path=boot --size 1G
bootloader
In the python script the extra source params are used to generate a BOOT.bin:
import logging
import os
import types
from importlib.machinery import SourceFileLoader
from wic import WicError
from wic.plugins.source.rootfs import RootfsPlugin
from wic.misc import get_bitbake_var, exec_cmd
logger = logging.getLogger('wic')
class BootgenPlugin(RootfsPlugin):
"""
Create a boot.bin with bootgen, contents are at least the FSBL,
the PMU and an U-BOOT FIT image on a FAT partition.
"""
name = 'bootgen-partition'
@classmethod
def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir, rootfs_dir,
native_sysroot):
"""
Called to do the actual content population for a partition i.e. it
'prepares' the partition to be incorporated into the image.
"""
logger.debug("bootgen-partition: do_prepare_partition: part: %s", part)
# check for options which have to be set
if source_params.get('fsbl', None) is None:
raise WicError("bootgen-partition: fsbl source_param must be set.")
if source_params.get('pmu', None) is None:
raise WicError("bootgen-partition: pmu source_param must be set.")
if source_params.get('armtfw', None) is None:
raise WicError("bootgen-partition: armtfw source_param must be set.")
if source_params.get('uboot_dir', None) is None:
raise WicError("bootgen-partition: uboot_dir source_param must be set.")
# Prologue from RootfsPlugin.do_prepare_partition, retrieves the
# rootfs directory
if part.rootfs_dir is None:
if not 'ROOTFS_DIR' in rootfs_dir:
raise WicError("Couldn't find --rootfs-dir, exiting")
rootfs_dir = rootfs_dir['ROOTFS_DIR']
else:
if part.rootfs_dir in rootfs_dir:
rootfs_dir = rootfs_dir[part.rootfs_dir]
elif part.rootfs_dir:
rootfs_dir = part.rootfs_dir
else:
raise WicError("Couldn't find --rootfs-dir=%s connection or "
"it is not a valid path, exiting" % part.rootfs_dir)
if os.path.isdir(rootfs_dir):
real_rootfs_dir = rootfs_dir
else:
image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir)
if not os.path.isdir(image_rootfs_dir):
raise WicError("No valid artifact IMAGE_ROOTFS from image "
"named %s has been found at %s, exiting." %
(rootfs_dir, image_rootfs_dir))
real_rootfs_dir = image_rootfs_dir
root_dev = creator.rootdev
if not root_dev:
root_dev = source_params.get("root", None)
if not root_dev:
raise WicError("root not defined, exiting.")
root_dev = root_dev.replace(":", "=")
logger.warn("bootgen: root dev: %s, root fs: %s, build in %s, bootimg_dir: %s", root_dev, real_rootfs_dir, cr_workdir, bootimg_dir)
# copy all parts
cp_cmd = "cp -a %s%s %s" % (real_rootfs_dir, source_params.get('fsbl'), cr_workdir)
exec_cmd(cp_cmd)
cp_cmd = "cp -a %s%s %s" % (real_rootfs_dir, source_params.get('pmu'), cr_workdir)
exec_cmd(cp_cmd)
cp_cmd = "cp -a %s%s %s" % (real_rootfs_dir, source_params.get('armtfw'), cr_workdir)
exec_cmd(cp_cmd)
cp_cmd = "cp -a %s%s/u-boot.elf %s" % (real_rootfs_dir, source_params.get('uboot_dir'), cr_workdir)
exec_cmd(cp_cmd)
cp_cmd = "cp -a %s%s/uboot-env.txt %s" % (real_rootfs_dir, source_params.get('uboot_dir'), cr_workdir)
exec_cmd(cp_cmd)
cp_cmd = "cp -a %s%s/boot.bif %s" % (real_rootfs_dir, source_params.get('uboot_dir'), cr_workdir)
exec_cmd(cp_cmd)
bootgen_cmd = "cd %s && bootgen -arch zynqmp -image boot.bif -o BOOT.bin" % (cr_workdir)
exec_cmd(bootgen_cmd, True)
# we need to create the VFAT image
bootimg = "%s/boot.img" % cr_workdir
label = part.label if part.label else "boot"
dosfs_cmd = "mkfs.fat -n %s -i %s -C %s %d" % \
(label, part.fsuuid, bootimg, part.size)
exec_cmd(dosfs_cmd)
du_cmd = "du -Lbks %s" % bootimg
out = exec_cmd(du_cmd)
bootimg_size = out.split()[0]
part.size = int(bootimg_size)
part.source_file = bootimg
>> Is there a documentation available for wic plugins which I've missed? If not, would it
>> be a mistake for my plugin to derive from the RootfsPlugin? In which way the plugin
>> controls where the content ends up in the target partition?
>We are taking wic from upstream OE, and I'm not aware of any generated
>doc from what wic has inline. But you could browse it, e.g. here:
>
>https://github.com/ilbers/isar/blob/master/scripts/lib/wic/pluginbase.py
Yes, I have seen that, but this only talks about the plugin entry points which are called
but not about where the output of the plugin is expected. Perhaps I am missing
something essential here....
TIA,
Uli
Schöne Grüße / Kind regards
Dipl.-Inform. Ulrich Teichert
Senior Software Developer
Phone +49 431 375938-0
_____________________________________
e.bs kumkeo GmbH
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/fbec2c09dd134f8484820974e4de2db9%40kumkeo.de.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-08 7:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-07 15:57 wic plugins, any documentation? Ulrich Teichert
2025-01-07 17:03 ` 'Jan Kiszka' via isar-users
2025-01-08 7:46 ` AW: " Ulrich Teichert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox