[yocto] Per image customizations

Paul Eggleton paul.eggleton at linux.intel.com
Tue May 31 16:57:34 PDT 2016


Hi Diego,

On Tue, 31 May 2016 18:05:19 Diego wrote:
> I've asked this question on IRC, but haven't received complete enough
> replies, so posting here.
> 
> I have my own layer with my recipes and customizations. In my layer I have
> two images, one which is the "regular OS" that runs the product
> application, and one which is the "flash OS", a minimal ramdisk OS that
> flashes the disks. I want the two images to have different fstab and
> inittab files: what is the correct way to do that? I know how to handle
> machine / arch specific differences, but I don't think there's a way to
> "dress a package depending on the image it gets included in", right?
> 
> Should I create my own IMAGE_FEATURE and hack my fstab and inittab when
> rootfs is created, sort of how the "read-only-rootfs" feature was done?
> http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/core-image.
> bbclass?h=fido#n77

You can do that, yes. The only other possibility is outright replacing the 
package providing the file (since you are free to specify whatever packages 
you want in the image, though you may have to break up packagegroup-core-boot 
to do it). This only works of course if either there are no dependencies on 
the package or you can satisfy any dependencies that might exist. It could be 
that for your "flash OS" image there aren't any, but it depends what it has in 
it.

It may be simpler just to hack it after the fact though. Note that you don't 
have to add an IMAGE_FEATURES item to do that - you could simply create a 
shell/python function and add a call to it in ROOTFS_POSTPROCESS_COMMAND. If 
the changes to the files are substantial you could even supply the alternative 
files in a separate package and then move them over the top of the original 
ones in the postprocessing function to save jumping through hoops adding files 
to the image recipe.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the yocto mailing list