0

I had a question about adding a new machine in Yocto.

I am trying to add both a new layer in Yocto, and a new machine. The machine is based on Atmels SAMA5D27-SOM1-EK-SD evaluation board. I want to enable another UART for this board.

I cloned the kernel source for this board (linux-at91) and added another DTS file based off of at91sama5d27-som1-ek-sd.dts file. I made the changes to enable UART0. I then added this new DTS file to the Makefile in linux-at91/arch/arm/boot/dts . I made a patch to save these changes.

I'm using meta-atmel layer and was following instructions outlined here to build the image for this board.

I have defined another layer that will act as the new Yocto layer that defines my custom machine. I have added some .bbappend files in recipes-kernel to add a patch (which adds a new dts file to the linux at91 kernel source) and to add our custom machine as a compatible machine. My understanding was that we could continue to use the definitions in the meta-atmel layer, but add .bbappend files in the meta-axon layer in the same path, and that would apply the changes that we want.

I have done the same for the recipes-bsp directory. In the meta-axon layer, all the .bbappend files in recipes-bsp only add our custom machine to the list of compatible machines. However, when I go ahead and build, I get this error:

NOTE: Resolving any missing task queue dependencies ERROR: Nothing PROVIDES 'at91bootstrap-sam-ba' at91bootstrap-sam-ba was skipped: incompatible with machine axon-ft3-sp-machine (not in COMPATIBLE_MACHINE)

I'm confused because the recipe file that defines at91bootstrap-sam-ba in meta-atmel does not mention any compatible machines, so I would want to use it from the meta-atmel layer without changing it at all. (edited)

Samyukta Ramnath
  • 371
  • 4
  • 18

1 Answers1

0

It actually does mention compatible machines.

In at91bootstrap-sam-ba recipe[1], you can find the following line:

require at91bootstrap_${PV}.bb

Let's check out in this recipe then[2]:

COMPATIBLE_MACHINE = '(sama5d3xek|sama5d3-xplained|sama5d3-xplained-sd|at91sam9x5ek|at91sam9rlek|at91sam9m10g45ek|sama5d4ek|sama5d4-xplained|sama5d4-xplained-sd|sama5d2-xplained|sama5d2-xplained-sd|sama5d2-xplained-emmc|sama5d2-ptc-ek|sama5d2-ptc-ek-sd|sama5d27-som1-ek|sama5d27-som1-ek-sd|sama5d2-icp-sd|sam9x60ek|sam9x60ek-sd|sama5d27-wlsom1-ek-sd)'

Using bitbake at91bootstrap-sam-ba -e would show you that, indeed, COMPATIBLE_MACHINE is set and would even tell you where it was set.

P.S.: In some cases, it might actually be a good idea for your custom machine to require the original machine on which it is based (e.g. sama5d27-som1-ek-sd) and make the name of the original machine part of MACHINE_OVERRIDES so that you don't have to add a bbappend for each recipe with a COMPATIBLE_MACHINE. Be careful with the order in MACHINE_OVERRIDES, it is evaluated from right to left with rightmost OVERRIDES being of the highest priority. (Use bitbake -e <recipe> to be sure it's correctly set).

[1] https://github.com/linux4sam/meta-atmel/blob/master/recipes-bsp/at91bootstrap/at91bootstrap-sam-ba_3.9.2.bb#L1

[2] https://github.com/linux4sam/meta-atmel/blob/master/recipes-bsp/at91bootstrap/at91bootstrap_3.9.2.bb#L5

qschulz
  • 1,543
  • 1
  • 9
  • 10
  • I see what you mean, but I added my custom machine to at91bootstrap_${PV}.bbappend in meta-/recipes-bsp/at91bootstrap, so I expect that it should have added that machine. I didn't want to make any changes to the actual at91bootstrap-sam-ba recipe. – Samyukta Ramnath Jun 16 '20 at 17:09
  • That's an interesting take I never thought of. 1) I do not think bbappend mechanism is intended to work for required or included .bb files. You still can add your machine to COMPATIBLE_MACHINE in at91bootstrap-sam-ba_%.bbappend. 2) If 1) were to work (gut feeling is no), you can't use ${PV} in an actual filename of a recipe (or a bbappend), so either at91bootstrap_%.bbappend or replace % with the version you're targeting. – qschulz Jun 16 '20 at 20:03
  • what I mean is, I added my machine among COMPATIBLE_MACHINE s in the at91bootstrap_${PV}.bbappend (not the at91bootstrap-sam-ba_%.bbappend), since you were saying that COMPATIBLE_MACHINE is included in at91bootstrap-sam-ba_%.bbappend via the required at91bootstrap_${PV}.bbappend file. Also, ${PV} is appropriately replaced by the version number for the required file. I don't have a at91bootstrap-sam-ba_${PV}.bbappend file. the only difference I want between this machine and the original one is a modified device tree file. Could you elaborate more on the MACHINE_OVERRIDES variable? – Samyukta Ramnath Jun 16 '20 at 20:07
  • I haven't received answers yet from maintainers if bbappend are applied when bb recipes are `include`d or `require`d but my gut feelings remain the same: not supported. Hence only the at91bootstrap_${PV}.bb will be taken without any of its bbappend being applied. So your bbappend won't be used for at91bootstrap-sam-ba recipe (but it will for at91bootstrap_${PV}.bb!). I think I forgot to say that `include` or `require` virtually just means the content of the at91bootstrap_${PV}.bb included is inserted directly in at91bootstrap-sam-ba_${PV}.bb at the `require` line. – qschulz Jun 19 '20 at 14:32
  • Which means you can actually modify the `COMPATIBLE_MACHINE` directly in at91bootstrap-sam-ba_${PV}.bb because even though it comes from at91bootstrap_${PV}.bb, it's "resolved" when parsing/resolving variables in at91bootstrap-sam-ba_${PV}.bb. For `MACHINEOVERRIDES` and `COMPATIBLE_MACHINE` relationship, see https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-MACHINEOVERRIDES and https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-COMPATIBLE_MACHINE – qschulz Jun 19 '20 at 14:35