[yocto] custom image recipes

Paul Eggleton paul.eggleton at linux.intel.com
Mon Mar 12 10:55:22 PDT 2012


On Sunday 11 March 2012 13:14:12 João Henrique Freitas wrote:
> One of my custom recipes (via-image-st.bb) is to make a custom image
> (adding some files). Example:
> 
> SRC_URI = " \
>         file://interfaces \
>         file://snmpd.conf \
>         file://snmp.conf \
>         file://syslog.conf \
>         file://ntpd \
>         file://syslog.lr \
>     "
> 
> inherit core-image
> 
> ROOTFS_POSTPROCESS_COMMAND_append = "remove_packaging_data_files ; "
> ROOTFS_POSTPROCESS_COMMAND_append = "setup_target_image ; "
> 
> setup_target_image() {
>     mkdir -p ${IMAGE_ROOTFS}/opt/sistema/conf
>     install -m 0644 ${WORKDIR}/interfaces
> ${IMAGE_ROOTFS}/etc/network/interfaces
> 
>     ...
> 
> }
> 
> When I run: bitbake via-image-st:
> 
> install: cannot stat
> `/mnt/yocto/build/mst_1.2/tmp/work/qemux86-tp-linux/via-image-st-1.0-r1/inte
> rfaces': No such file or directory
> NOTE: package via-image-st-1.0-r1: task do_rootfs: Failed
> ERROR: Task 8
> (/home/joaohf/jhf/tropico/projetos/yocto-1.1tropico/meta-tropico/meta-viast/
> images/ via-image-st.bb, do_rootfs) failed with exit code '1'
> NOTE: Tasks Summary: Attempted 3192 tasks of which 3190 didn't need to be
> rerun and 1 failed.
> 
> Summary: 1 task failed:
> 
> /home/joaohf/jhf/tropico/projetos/yocto-1.1tropico/meta-tropico/meta-viast/i
> mages/ via-image-st.bb, do_rootfs
> 
> 
> I think this commit
> http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/meta/classes/image.bbc
> lass?id=6706c7bdd2de6e0e447d90062e74a718a8d31778the others task doesn't
> perform.

Indeed, this seems to no longer be supported. I think this is probably a good
idea because then there is less confusion as to where files come from.

> The main question is: How I can create a recipe to customize some files
> inside of the image?
> 
> I need to have a recipe like base-files? (recipes-core/base-files/
> base-files_3.0.14.bb)

Yes, the preferred method to achieve this is to use bbappends for the recipes
where these files appear if they are already provided by a recipe, e.g. netbase
for /etc/network/interfaces - see here for a machine-specific example:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta-yocto/recipes-core/netbase

For new files you can either include them via the same bbappend mechanism if
that makes sense for the particular files, or a separate recipe.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the yocto mailing list