I have a device Toradex Linux OS image built with Yocto. It is a version 5 image based on dunfell. I need to adjust the partition layout of the image.
I understand how to modify the image.json manually to add additional partitions and mount them on boot.
I have scoured the boards, but I cannot find any information on how to generate the image.json file with the extra partition as part of the image bitbake build. From what I can tell, the file is generated in image_type_tezi.bbclass (the
rootfs_tezi_emmc function), and it doesn’t look like the process is easily modified.
Have I missed something? Adding additional partitions to a TEZI image seems to be a request that comes up periodically over several years, so I am assuming this is a task that can be handled as part of the build.
I had a similar challenge on a project in the past. I solved it by taking the original image_type_tezi.bbclass and renamed it to image_type_custom.bbclass and customizing the functions which creates rootfs accordingly.
You must add this new custom image type to the IMAGE_CLASSES and IMAGE_FSTYPE variables. I don’t know if this is the right or easiest way to add custom partitions but it works for me.
Thank you for the response. I was trying to avoid duplicating that entire class, which I believe will create upgrade/maintenance problems in the future, but if that’s the only way…
Hi @dougreese indeed modifying bbclass files is not quite as simple as creating a bbappend for a recipe file. In the past I have done as @mlinar recommended and just created a custom bbclass when I needed similar changes. The logic Mender uses is visible here.
Another possibility is to note that the bbclass files are processed in the order they are listed so potentially you could create a custom bbclass like the following:
<appropriate magic here>
and then simply inherit image_type_tezi in your local.conf instead of image_type_tezi. There may be some manipulation of the IMAGE_FSTYPES variable as well.