Skip to content

stages: add efi_src_dir config to grub2.iso stage#2202

Merged
mvo5 merged 1 commit intoosbuild:mainfrom
mvo5:bib-anaconda-1
Sep 26, 2025
Merged

stages: add efi_src_dir config to grub2.iso stage#2202
mvo5 merged 1 commit intoosbuild:mainfrom
mvo5:bib-anaconda-1

Conversation

@mvo5
Copy link
Contributor

@mvo5 mvo5 commented Sep 24, 2025

We currently hardcode the location of the efi binaries to /boot/efi/EFI. This makes sense in general but when working with bootc containers the location is usually different and inside /usr/lib/bootupd/updates/EFI. So this commit makes the location configurable in a similar way as we already have it for the grub2 (non-iso) stage (in the grub2 stage its under uefi but in this stage everything is flat incuding the vendor so efi_src_dir is flat as well).

The rational is that we want to build ISOs from bootc base images (c.f.
osbuild/bootc-image-builder#1053) but also do not want every bootc installer image to have a special bootupd grub iso configuration (which would also hard to maintain as it would be duplicated in every container). So instead we use this stage to generate the config and just point to a different EFI dir.

Needed for osbuild/bootc-image-builder#1053

@mvo5 mvo5 requested a review from a team as a code owner September 24, 2025 10:01
@mvo5 mvo5 requested review from achilleas-k, bcl, croissanne, supakeen and thozza and removed request for a team September 24, 2025 10:01
@supakeen
Copy link
Member

Is this bootupd path an implementation detail or documented that this is the path that will contain EFI binaries? It doesn't matter much since we can pick the source by users of this stage but it would be nice to know if this is 'the right place' :)

mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Sep 24, 2025
@mvo5
Copy link
Contributor Author

mvo5 commented Sep 24, 2025

Is this bootupd path an implementation detail or documented that this is the path that will contain EFI binaries? It doesn't matter much since we can pick the source by users of this stage but it would be nice to know if this is 'the right place' :)

You mean this path ({"efi_src_dir": "/usr/lib/bootupd/updates/"}, "/usr/lib/bootupd/updates"), from the test_grub2_iso.py test? Its both an example and the real path, I decided to put the "real" one in there so that the test is also documentation for how we expect it will be used (I hope I understood the question correctly).

achilleas-k
achilleas-k previously approved these changes Sep 25, 2025
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ondrej is right. Regardless, this LGTM :)

@mvo5 mvo5 enabled auto-merge (rebase) September 26, 2025 07:19
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI/`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI/`. So this commit makes
the location configurable in a  similar way as we already
have it for the grub2 (non-iso) stage (in the grub2 stage
its under `uefi` but in this stage everything is flat
incuding the vendor so `efi_src_dir` is flat as well).

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
@mvo5 mvo5 merged commit a0aa746 into osbuild:main Sep 26, 2025
53 checks passed
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 26, 2025
Sadly the support for a single custom `efi_src_dir` [0] to look
for EFI binaries is not enough for the anaconda-bootc work:

The default shim on a bootc system is diverted from
`/boot/efi/EFI/` to `/usr/lib/bootupd/updates/EFI/`.

We also need to install "grub2-iso-x64-cdboot" for a booting
iso from the base bootc container. This will be put under
the regular `/boot/efi/EFI/<vendor>/gcdx64.efi` location.

So the `org.osbuild.grub2.iso` stage will need to be able
to lookup the required binaries in both places. Hence
this commit tweaks the option to allow an array of
paths for the `efi_src_dirs` so that this can be supported.

The images library will then set this to:
``go
bootTreePipeline.EfiSrcDirs = []string{
  "/boot/efi/EFI/",
  "/usr/lib/bootupd/updates/EFI/",
}
```

Note that this could have also been solved with something like
`efi_fallback_dir` or even hardcoding the fallback here but
an array feels more extensible (even though I don't foresee
even more locations). But YAGNI, I'm open for ideas and we
could also just hardcode the fallback here and drop the
`efi_src_dir` option entirely.

This is needed for
osbuild/bootc-image-builder#1059

[0] osbuild#2202
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 26, 2025
Sadly the support for a single custom `efi_src_dir` [0] to look
for EFI binaries is not enough for the anaconda-bootc work:

The default shim on a bootc system is diverted from
`/boot/efi/EFI/` to `/usr/lib/bootupd/updates/EFI/`.

We also need to install "grub2-iso-x64-cdboot" for a booting
iso from the base bootc container. This will be put under
the regular `/boot/efi/EFI/<vendor>/gcdx64.efi` location.

So the `org.osbuild.grub2.iso` stage will need to be able
to lookup the required binaries in both places. Hence
this commit tweaks the option to allow an array of
paths for the `efi_src_dirs` so that this can be supported.

The images library will then set this to:
```go
bootTreePipeline.EfiSrcDirs = []string{
  "/boot/efi/EFI/",
  "/usr/lib/bootupd/updates/EFI/",
}
```

Note that this could have also been solved with something like
`efi_fallback_dir` or even hardcoding the fallback here but
an array feels more extensible (even though I don't foresee
even more locations). But YAGNI, I'm open for ideas and we
could also just hardcode the fallback here and drop the
`efi_src_dir` option entirely.

This is needed for
osbuild/bootc-image-builder#1059

[0] osbuild#2202
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 26, 2025
Sadly the support for a single custom `efi_src_dir` [0] to look
for EFI binaries is not enough for the anaconda-bootc work:

The default shim on a bootc system is diverted from
`/boot/efi/EFI/` to `/usr/lib/bootupd/updates/EFI/`.

We also need to install "grub2-iso-x64-cdboot" for a booting
iso from the base bootc container. This will be put under
the regular `/boot/efi/EFI/<vendor>/gcdx64.efi` location.

So the `org.osbuild.grub2.iso` stage will need to be able
to lookup the required binaries in both places. Hence
this commit tweaks the option to allow an array of
paths for the `efi_src_dirs` so that this can be supported.

The images library will then set this to:
```go
bootTreePipeline.EfiSrcDirs = []string{
  "/boot/efi/EFI/",
  "/usr/lib/bootupd/updates/EFI/",
}
```

Note that this could have also been solved with something like
`efi_fallback_dir` or even hardcoding the fallback here but
an array feels more extensible (even though I don't foresee
even more locations). But YAGNI, I'm open for ideas and we
could also just hardcode the fallback here and drop the
`efi_src_dir` option entirely.

This is needed for
osbuild/bootc-image-builder#1059

[0] osbuild#2202
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 26, 2025
Sadly the support for a single custom `efi_src_dir` [0] to look
for EFI binaries is not enough for the anaconda-bootc work:

The default shim on a bootc system is diverted from
`/boot/efi/EFI/` to `/usr/lib/bootupd/updates/EFI/`.

We also need to install "grub2-iso-x64-cdboot" for a booting
iso from the base bootc container. This will be put under
the regular `/boot/efi/EFI/<vendor>/gcdx64.efi` location.

So the `org.osbuild.grub2.iso` stage will need to be able
to lookup the required binaries in both places. Hence
this commit tweaks the option to allow an array of
paths for the `efi_src_dirs` so that this can be supported.

The images library will then set this to:
```go
bootTreePipeline.EfiSrcDirs = []string{
  "/boot/efi/EFI/",
  "/usr/lib/bootupd/updates/EFI/",
}
```

This is needed for
osbuild/bootc-image-builder#1059

[0] osbuild#2202
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 26, 2025
Sadly the support for a single custom `efi_src_dir` [0] to look
for EFI binaries is not enough for the anaconda-bootc work:

The default shim on a bootc system is diverted from
`/boot/efi/EFI/` to `/usr/lib/bootupd/updates/EFI/`.

We also need to install "grub2-iso-x64-cdboot" for a booting
iso from the base bootc container. This will be put under
the regular `/boot/efi/EFI/<vendor>/gcdx64.efi` location.

So the `org.osbuild.grub2.iso` stage will need to be able
to lookup the required binaries in both places. Hence
this commit tweaks the option to allow an array of
paths for the `efi_src_dirs` so that this can be supported.

The images library will then set this to:
```go
bootTreePipeline.EfiSrcDirs = []string{
  "/boot/efi/EFI/",
  "/usr/lib/bootupd/updates/EFI/",
}
```

This is needed for
osbuild/bootc-image-builder#1059

[0] osbuild#2202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants