[yocto] Recipes that update a shared file

Burton, Ross ross.burton at intel.com
Thu Oct 10 08:09:37 PDT 2013


On 10 October 2013 16:02, Seth Bollinger <seth.boll at gmail.com> wrote:
>> You need to use $D so that you're not attempting to write to the *host's*
>> /etc:
>>
>> echo test >> $D/etc/inittest2
>>
>> In a postinst $D may be set, and if it is then the postinst is being
>> ran on the host at rootfs time, and points to where the rootfs is
>> being constructed.
>
>
> Ok, I changed to as follows:
> pkg_postinst_${PN} () {
>     echo "testtest" >> ${D}/etc/inittest
> }
>
> After that I do a find and the file is only populated in the recipe's image
> directory, not the rootfs.

Use $D instead of ${D}. ${D} will get expanded when the package is
created but you want to use the environment variable $D.

Ross



More information about the yocto mailing list