Create empty partitions in Tezi

I currently use Toradex Easy Installer to install my custom image built using Yocto. I would like to add an empty ext4 partition to my image that will be used by the runtime applications for user data. I understand that Tezi is responsible for creating partitions according to the image.json file in the Tezi image. I have found that the file image_type_tezi.bbclass creates the JSON file but I do not see an easy way to add partitions to the JSON file during the build process. What is the best way to add partitions to the image.json file?

I’m not sure if it is the best way but I use the wrapup script to do this.

Hi @robrien_ftr

I have not personally tried the wrapup script as recommended by @andyha but it may be viable.

As you no doubt discovered it is not possible to override a bbclass the way you can with a bbappend. The way I did this in a previous life was to create a custom image_type_blah_tezi.bbclass that looks an awful lot like the stock image_type_tezi.bbclass with the customizations needed for your custom image type.


Thanks, everybody. I created a solution that works for my needs.

I initially tried to create the partitions using the script packaged in the Tezi image, but ran into a roadblock. I found that the generated image.json file specifies to maximize the size of the root filesystem it creates (variable “want_maximised” is true). This meant I needed to resize this filesystem before I could create more. However, Tezi does not include the means to do this. The utility resize2fs is not packaged with it and the fdisk utility packaged with Tezi is a busybox implementation which does not allow resizing partitions.

My workaround uses a very similar method to the one Drew described. I created a new bbclass called image_type_tezi_custom.bbclass, and updated the IMAGE_CLASS bitbake variable in my machine conf file by replacing “image_type_tezi” with “image_type_tezi_custom”. This makes bitbake use my bbclass for generating a Tezi image.

In my new bbclass, I inherit image_type_tezi to bring in all it’s existing functionality, then created a new Python function which reads in the generated image.json file, performs the desired modifications, and writes it back out. I appended this function to the variable TEZI_IMAGE_TEZIIMG_PREFUNCS which is used to set the variable flag “prefuncs” for the task do_image_teziimg. In image_type_tezi.bbclass, TEZI_IMAGE_TEZIIMG_PREFUNCS contains the name of the function which generates the JSON file. By appending my function after that one, my function modifies the JSON right after it is generated.

This method is not ideal, but it works well and allows me to perform all the filesystem and partition changes in one place.


1 Like

Yes, I already have my own custom bbclass and had forgotten that I set “want_maximised” to false in there for other reasons.
That is why my method of using the wrapup script works.
I used the wrapup script because I need an extended partition and, as far as I know, that isn’t supported in the Tezi configuration file


1 Like