Hi!

Our approach to the problem has been to leverage the `kind: junction` plugin and writing custom buildstream source plugins to parse each of the formats and translate them to Buildstream elements, essentially generating a Buildsteam project from it, leveraging the existing manifest structure. In our case the elements are mainly import ones, but no reason they couldn't generate buildable elements.

[snip]

Something like this approach might provide the functionality you are after within the existing Buildstream framework?

board.bst
```
kind: junction
sources:
  - kind: device
    supported_arches:
      - x86_64 # Most devices before 2024
      - aarch64
    kernel: boards/microsoft-surface/linux-surface.bst

    extra_packages:
     - boards/microsoft-surface/webcam-firmware.bst
     - boards/microsoft-surface/extra-power-profiles.bst
     - boards/microsoft-surface/detatchable-keyboard-daemon.bst
     - [...]

    append_cmdline: >-
      intel.iommu=force
      qcom.iommu=enable
[...]
```

Yeah that's an interesting idea. I hadn't thought of generating junctions on the fly before, in a source plugin.

I think the main downside of using junctions for your use-case is the requirement to depend on elements in the parent project (e.g. the extra_packages and kernel elements in the example), which would need some weird parent junction in the subproject. So a more tightly coupled `generator` plugin element type might be helpful here.

Hmm right that's the limitation. You can kinda work around it, and inject dependencies into the junction. You also probably need to inject project options, and also probably the entirety of project config so you have appropriate cflags, ldflags, strip rules, etc.

So, more realistically, it'd look something like this:

```
# boards/microsoft-surface/board.bst
kind: junction

sources:
  - kind: local
    path: project-conf/ # Contains project.conf (symlink'd out) and all yaml imports

  - kind: device

    supported_arches:
      - x86_64 # Most devices before 2024
      - aarch64

    append_cmdline: >-
      intel.iommu=force
      qcom.iommu=enable

config:
   options:
      arch: "%{arch}"
      whatever-other-options: "%{whatever-other-options}"
      [snip]
   override:
      # Dependencies with everything needed to build an image
      build-env.bst: boards/common/build-env.bst

      # Board-specific stuff
      kernel.bst: boards/microsoft-surface/linux-surface.bst
      extra-packages.bst: boards/microsoft-surface/extra-packages.bst
```

```
# boards/microsoft-surface/extra-packages.bst
kind: stack
depends:
- boards/microsoft-surface/webcam-firmware.bst
- boards/microsoft-surface/extra-power-profiles.bst
- boards/microsoft-surface/detatchable-keyboard-daemon.bst
- [...]
```

Best,
Adrian

Reply via email to