[yocto] interfaces file on a per-image basis

Nicolas Dechesne nicolas.dechesne at linaro.org
Wed Jul 23 15:38:32 PDT 2014


On Thu, Jul 24, 2014 at 12:25 AM, Allan Matthew <amatthew at 3drobotics.com> wrote:
> I have two separate images, call them server and client.  The client will
> have one /network/interfaces file and the server will have another.  I can
> successfully override the init-ifupdown in my own bbappend in my layer and
> use one of my interface files, but I can't figure out how to pick between
> two interface files depending on the image I'm building.  Is there a
> variable I should be able to examine to determine which interfaces file I
> should use in my .bbappend?

nope you can't really do that. each recipe (.bb file) is built
independently. it's true for 'normal' recipe (component, libs, ..) but
also images which are .bb files too. so when you build init-ifupdown,
bitbake doesn't know if the package will be installed in image-server
or image-client.

>
> The only other option I've found is to use two separate machines, which is
> not a great option for me because the hardware and almost all of the
> packages are identical between my client and server, so I'd like to just be
> able to build two separate images instead of changing machine types as well.

well, machine conf are used to identify h/w settings. so in your case,
it would be wrong as you guessed. if the underlying h/w is the same,
you should use the same machine.

i can see a couple of options:
- create multiple init-ifupdown packages (duplicate them) and pick one
or the other in the image recipe. or maybe you can split the network
interface config from init-ifdown (e.g. remove the file from this
package), and create 2 new packages that provide this file and pick
the one you need in your image.
- you can use  ROOTFS_POSTPROCESS_COMMAND to run a custom script that
will modify the image accordingly

there are certainly other options ...



More information about the yocto mailing list