[yocto] Image specific configuration files

Alan Martinovic alan.martinovic at senic.com
Fri Jun 1 03:07:54 PDT 2018


Hey Alexander,
you seem to have a good understanding on the concepts.
Would you say that:

> A build always builds a single distro

is somewhat of a rule?




On Fri, Jun 1, 2018 at 11:24 AM, Alexander Kanavin <alex.kanavin at gmail.com>
wrote:

> I have to say defining multiple distros and then tweaking recipes
> according to those definitions is not a good practice, as recipes should
> generally only access DISTRO_FEATURES and otherwise be distro-agnostic. The
> above iptables scenario should be handled with different image recipes,
> which pull in (via packages) or create different configurations.
>
> Alex
>
> 2018-06-01 12:04 GMT+03:00 Iván Castell <icastell at nayarsystems.com>:
>
>> I can provide more details. My custom layer has these files related with
>> distro:
>>
>>     my_layer/conf/distro/include/common.conf
>>     my_layer/conf/distro/develop.conf
>>     my_layer/conf/distro/production.conf
>>     my_layer/conf/distro/integration.conf
>>
>> As an example of the previous files, my_layer/conf/distro/include/develop.conf
>> has this content:
>>
>>     require conf/distro/include/common.conf
>>     DISTRO = "my-distro-development"
>>     DISTRO_NAME = "OS Development"
>>     DISTRO_STAGE = "development"
>>     # And here more customizations as setting root password, PRSERV_HOST,
>> or PACKAGE_FEED_URIS
>>
>> In common.conf I define all features common to all my distros
>> (PACKAGE_CLASSES and so on)
>>
>> I have custom iptables rules, then I have different files for that rules:
>>
>>     my/layer/recipes-extended/iptables/files/iptables.rules.development
>>     my/layer/recipes-extended/iptables/files/iptables.rules.production
>>     my/layer/recipes-extended/iptables/files/iptables.rules.integration
>>
>> I use a bbappend recipe for iptables, modifiying do_install_append task
>> like this:
>>
>>     install -m 0600 ${WORKDIR}/iptables.rules.${DISTRO_STAGE}
>> ${D}/etc/iptables/iptables.rules
>>
>> I use a single image recipe to define all packages installed in my final
>> image (all of them have the same set if packages, but with different
>> customizations)
>>
>> Finally, I wrote a setup-build-env.sh script in my custom layer to
>> configure the build easily. That script creates
>> build-${DISTRO_STAGE}/conf/bblayers.conf and build-${DISTRO_STAGE}/conf/
>> local.conf files with the proper setup, setting MACHINE, DISTRO and
>> DL_DIR (shared by all distros) properly.
>>
>> Hope this helps!
>>
>>
>>
>>
>>
>> 2018-06-01 10:21 GMT+02:00 Alan Martinovic <alan.martinovic at senic.com>:
>>
>>> Hey,
>>> would really like to see your example.
>>> Am struggling to get creation of these types of images for a while now.
>>>
>>> So far have avoided diving into multiple distros because would like to
>>> have the option
>>> of building all the images at the same time (so they are basically the
>>> same distro).
>>>
>>> On Fri, Jun 1, 2018 at 8:13 AM, Iván Castell <icastell at nayarsystems.com>
>>> wrote:
>>>
>>>> I fixed this issue defining different distro.conf files in my custom
>>>> layer, adding a custom variable DISTRO_STAGE with the name of my distro
>>>> (production, rnd, retail, and so on), Then you setup DISTRO in your
>>>> local.conf to the proper value you want to use. Finally you can use that
>>>> DISTRO_STAGE variable in your custom .bb or .bbappend recipes to decide the
>>>> proper configuration files you want to install in your final image. That
>>>> works as expected. Hope this helps!
>>>>
>>>>
>>>>
>>>>
>>>> 2018-06-01 7:46 GMT+02:00 Damien LEFEVRE <lefevre.da at gmail.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>> For the same MACHINE I create the following images:
>>>>> - myimage-production
>>>>> - myimage-rnd
>>>>> - myimage-retail
>>>>>
>>>>> The production one has production assisted tools for flashing
>>>>> peripheral HW, testing vital HW components, writing some serial numbers,
>>>>> etc.
>>>>>
>>>>> The rnd one has more packages than the retail one just to help rnd
>>>>> work and debugging in device, but none of the rnd image extra packages.
>>>>>
>>>>> The retail one has the final product image.
>>>>>
>>>>> I'm using web and FTP servers. I would like for the rnd version of the
>>>>> image to have a different nginx configuration to set the root directory to
>>>>> a development folder, or set an alias.
>>>>>
>>>>> Furthermore, I'll have different variant of the device where only the
>>>>> device SW changes but the platform is identical. So I'll end up with
>>>>> - myimage2-production
>>>>> - myimage2-rnd
>>>>> - myimage2-retail
>>>>>
>>>>> I know how to make MACHINE based configuration. How could I do this in
>>>>> my nginx.bbappend based on image name?
>>>>>
>>>>> Thanks,
>>>>> -Damien
>>>>>
>>>>> --
>>>>> _______________________________________________
>>>>> yocto mailing list
>>>>> yocto at yoctoproject.org
>>>>> https://lists.yoctoproject.org/listinfo/yocto
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>>
>>>>
>>>> *NOTA LEGAL*
>>>> Este correo electrónico y, en su caso, cualquier fichero anexo al
>>>> mismo, contiene información de carácter confidencial exclusivamente
>>>> dirigida a su destinatario y se encuentra protegido por Ley. Cualquier
>>>> persona distinta de su destinataria tiene prohibida su reproducción, uso,
>>>> divulgación, copia o impresión total o parcial. Si ha recibido este correo
>>>> electrónico por error, se ruega lo notifique de inmediato al remitente
>>>> borrando el mensaje original juntamente con sus ficheros anexos. Gracias.
>>>>
>>>> De conformidad con lo establecido en la LOPD, NAYAR SYSTEMS SL
>>>> garantiza la adopción de las medidas necesarias para asegurar el
>>>> tratamiento confidencial de los datos de carácter personal. Así mismo le
>>>> informamos de la inclusión de sus datos en un fichero bajo la
>>>> responsabilidad de NAYAR SYSTEMS SL, con la finalidad de poder atender los
>>>> compromisos derivados de la relación que mantenemos con usted. Si lo desea,
>>>> puede ejercer sus derechos de acceso, rectificación, cancelación y
>>>> oposición mediante un escrito a la siguiente dirección:
>>>> info at nayarsystems.com
>>>>
>>>> *LEGAL NOTE*
>>>> This email and any attachments to it contains is confidential
>>>> information exclusively intended for the recipients. Any divulgation, copy
>>>> or distribution to third parties is prohibited without written permission
>>>> of NAYAR SYSTEMS SL. If you have received this e-mail in error, please
>>>> notify the sender immediately. In accordance with Law 15/1999 of 13
>>>> December on the Protection of Personal Data, the NAYAR SYSTEMS SL
>>>> guarantees that it has adopted the necessary measures to ensure the
>>>> confidential treatment of personal information. We also inform you that you
>>>> can exercise your access, rectification, cancellation and opposition rights
>>>> by send us a mail to: info at nayarsystems.com
>>>>
>>>>
>>>> --
>>>> _______________________________________________
>>>> yocto mailing list
>>>> yocto at yoctoproject.org
>>>> https://lists.yoctoproject.org/listinfo/yocto
>>>>
>>>>
>>>
>>
>>
>> --
>>
>>
>>
>>
>> *NOTA LEGAL*
>> Este correo electrónico y, en su caso, cualquier fichero anexo al mismo,
>> contiene información de carácter confidencial exclusivamente dirigida a su
>> destinatario y se encuentra protegido por Ley. Cualquier persona distinta
>> de su destinataria tiene prohibida su reproducción, uso, divulgación, copia
>> o impresión total o parcial. Si ha recibido este correo electrónico por
>> error, se ruega lo notifique de inmediato al remitente borrando el mensaje
>> original juntamente con sus ficheros anexos. Gracias.
>>
>> De conformidad con lo establecido en la LOPD, NAYAR SYSTEMS SL garantiza
>> la adopción de las medidas necesarias para asegurar el tratamiento
>> confidencial de los datos de carácter personal. Así mismo le informamos de
>> la inclusión de sus datos en un fichero bajo la responsabilidad de NAYAR
>> SYSTEMS SL, con la finalidad de poder atender los compromisos derivados de
>> la relación que mantenemos con usted. Si lo desea, puede ejercer sus
>> derechos de acceso, rectificación, cancelación y oposición mediante un
>> escrito a la siguiente dirección: info at nayarsystems.com
>>
>> *LEGAL NOTE*
>> This email and any attachments to it contains is confidential information
>> exclusively intended for the recipients. Any divulgation, copy or
>> distribution to third parties is prohibited without written permission of
>> NAYAR SYSTEMS SL. If you have received this e-mail in error, please notify
>> the sender immediately. In accordance with Law 15/1999 of 13 December on
>> the Protection of Personal Data, the NAYAR SYSTEMS SL guarantees that it
>> has adopted the necessary measures to ensure the confidential treatment of
>> personal information. We also inform you that you can exercise your access,
>> rectification, cancellation and opposition rights by send us a mail to:
>> info at nayarsystems.com
>>
>>
>> --
>> _______________________________________________
>> yocto mailing list
>> yocto at yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20180601/21eb0843/attachment-0001.html>


More information about the yocto mailing list