Did you look at http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-core/images/core-image-minimal-initramfs.bb?  You do want to use the core-image class but some of the variables need to be adjusted to build an initramfs.  OpenBMC does something similar to what you are describing with their obmc-phosphor-initramfs (https://github.com/openbmc/openbmc/blob/master/meta-phosphor/common/recipes-phosphor/images/obmc-phosphor-initramfs.bb) that does a few things like applying staged rootfs updates before mounting the rootfs.

On Fri, Jan 20, 2017 at 4:44 AM, Eswaran Vinothkumar (BEG-PT/PJ-IOT1) <Vinothkumar.Eswaran@de.bosch.com> wrote:

Hello Yocto community developers,

 

I am currently working on the task of porting an existing build system to Yocto to create customized Linux distribution for an embedded product. I have successfully created a bare box image, the kernel and root file system image and the system startup is working fine.

 

I am now investigating on creating the initramfs using Yocto and have gone through the Yocto documents for the same.

 

Adding the options :

INITRAMFS_FSTYPES = "cpio.gz"

INITRAMFS_IMAGE = "custom-initramfs"  à my recipe which inherited core-image.bb recipe

 

Results in the creation of ‘custom-image-20170120105621.rootfs.cpio.gz’ file.

 

We are using initramfs to run a script which before mounting the root file system checks for ima policy and also responsible for loading the evm-keys. In short, the initramfs contains a script which is executed before mounting the main root file system. So I think I need to follow a different procedure than the one I mentioned above for my use case. Also we are using systemd as the init system and for the initramfs I don’t need sysv or systemd as all I will do is running a script in initramfs.

 

Is there a better way of creating this structure in Yocto, any information would be helpful.

 

 

Mit freundlichen Grüßen / Best regards

Vinothkumar Eswaran
BEG-PT/PJ-IOT1

Tel.
+49(7062)911-02


--
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto