Thanks to visit codestin.com
Credit goes to github.com

Skip to content

efi: Extend install() & update() to support usr/lib/efi#992

Merged
cgwalters merged 5 commits into
coreos:mainfrom
HuijingHei:step2-install-from-usr
Oct 15, 2025
Merged

efi: Extend install() & update() to support usr/lib/efi#992
cgwalters merged 5 commits into
coreos:mainfrom
HuijingHei:step2-install-from-usr

Conversation

@HuijingHei

@HuijingHei HuijingHei commented Aug 31, 2025

Copy link
Copy Markdown
Contributor

filetree: add copy_dir_with_args() to support additional args

copy_dir() will copy with default option '-a', and we need to
support ["-rp", "--reflink=auto"] when install.


efi: Extend install() to support usr/lib/efi


efi: Extend update() to support usr/lib/efi

Add source in FileMetadata to save the file source path, it
is needed by changes / additions.

For example add shim/15.8-5/EFI/fedora/shim.efi to Filemetadata,
and keep fedora/shim.efi as the key, when doing updates:

  • for additions/changes, will copy source path to dest path as
    shim/15.8-5/EFI/fedora/shim.efi -> fedora/shim.efi
  • for removals, only use path fedora/shim.efi as we do not need
    the source path, as only do operations in dest dir

efi: Stop copying EFI components to usr/lib/bootupd/updates/

when doing generate_update_metadata()

As we support updates from usr/lib/efi, there is no need to copy
the EFI components to usr/lib/bootupd/updates/.
Also update kola test-bootupd.

See step3 in #926 (comment)

@openshift-ci

openshift-ci Bot commented Aug 31, 2025

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch 5 times, most recently from 2c9e284 to 9ead61b Compare September 4, 2025 10:19
@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch from 9ead61b to 60160c0 Compare September 7, 2025 12:28
@HuijingHei HuijingHei marked this pull request as ready for review September 7, 2025 12:40
@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch 2 times, most recently from 84859b4 to f5a32fc Compare September 8, 2025 08:12
@HuijingHei

HuijingHei commented Sep 8, 2025

Copy link
Copy Markdown
Contributor Author

Test with this patch, the following is the new bootupd-state.json content, and the filetree path is grub2/1:2.12-41.fc44/EFI/fedora/grubx64.efi instead of old fedora/grubx64.efi

Update the result:
The new bootupd-state.json content, add source path grub2/1:2.12-32.fc42/EFI/fedora/grubx64.efi for fedora/grubx64.efi, it is needed by additions / changes.

[root@cosa-devsh core]# cat /boot/bootupd-state.json | jq
{
  "installed": {
    "BIOS": {
      "meta": {
        "timestamp": "2025-06-17T16:35:00Z",
        "version": "grub2-tools-1:2.12-32.fc42.x86_64",
        "versions": [
          {
            "name": "grub2",
            "rpm_evr": "1:2.12-32.fc42"
          }
        ]
      },
      "filetree": null,
      "adopted-from": null
    },
    "EFI": {
      "meta": {
        "timestamp": "2025-10-09T07:38:11.109411521Z",
        "version": "grub2-1:2.12-32.fc42,shim-15.8-3",
        "versions": [
          {
            "name": "grub2",
            "rpm_evr": "1:2.12-32.fc42"
          },
          {
            "name": "shim",
            "rpm_evr": "15.8-3"
          }
        ]
      },
      "filetree": {
        "children": {
          "BOOT/BOOTX64.EFI": {
            "source": "shim/15.8-3/EFI/BOOT/BOOTX64.EFI",
            "size": 949424,
            "sha512": "sha512:cc23d8c3cb2dcf749075268b77eb796fb430182cbbc04171ded14d43e32b4a5cdeeb1a08666ee0e288bd37d63f657a9af5e7f2012dd70694d11212d705c60b42"
          },
          "BOOT/fbx64.efi": {
            "source": "shim/15.8-3/EFI/BOOT/fbx64.efi",
            "size": 87816,
            "sha512": "sha512:d6107afdaebab6c6f3a9136334b54aeba089a8b40d53f38c74c791dca1274b9d6a02d744a634938516cedfa96a67cb0cff6a59c5537b36faf3c70e3bcee622af"
          },
          "fedora/BOOTX64.CSV": {
            "source": "shim/15.8-3/EFI/fedora/BOOTX64.CSV",
            "size": 110,
            "sha512": "sha512:0c29b8ae73171ef683ba690069c1bae711e130a084a81169af33a83dfbae4e07d909c2482dbe89a96ab26e171f17c53f1de8cb13d558bc1535412ff8accf253f"
          },
          "fedora/grubx64.efi": {
            "source": "grub2/1:2.12-32.fc42/EFI/fedora/grubx64.efi",
            "size": 4037952,
            "sha512": "sha512:47b3e05af35a7eea48be9a36108265989953691832b879b544d2ab2c92feb9a3859c4a77ba51306cdbb07c75e453be0ee8cf8e653b379089aedab0c0dfba36c6"
          },
          "fedora/mmx64.efi": {
            "source": "shim/15.8-3/EFI/fedora/mmx64.efi",
            "size": 848080,
            "sha512": "sha512:d62e003cae3321b3b0aea35c27868176a867b06a1a1eb3266efe84f72f01db6ce71c36073afc192500385743b5eb3d1f35519729b51d0326cebb1e3a04b24281"
          },
          "fedora/shim.efi": {
            "source": "shim/15.8-3/EFI/fedora/shim.efi",
            "size": 949424,
            "sha512": "sha512:cc23d8c3cb2dcf749075268b77eb796fb430182cbbc04171ded14d43e32b4a5cdeeb1a08666ee0e288bd37d63f657a9af5e7f2012dd70694d11212d705c60b42"
          },
          "fedora/shimx64.efi": {
            "source": "shim/15.8-3/EFI/fedora/shimx64.efi",
            "size": 949424,
            "sha512": "sha512:cc23d8c3cb2dcf749075268b77eb796fb430182cbbc04171ded14d43e32b4a5cdeeb1a08666ee0e288bd37d63f657a9af5e7f2012dd70694d11212d705c60b42"
          }
        }
      },
      "adopted-from": null
    }
  },
  "pending": null,
  "static-configs": {
    "timestamp": "2025-10-09T07:37:34.836Z",
    "version": "0.2.31",
    "versions": null
  }
}

@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch 2 times, most recently from 3dd909e to 798f2a2 Compare September 10, 2025 03:33
@HuijingHei

HuijingHei commented Sep 10, 2025

Copy link
Copy Markdown
Contributor Author

Hold on, the change in the filetree path grub2/1:2.12-41.fc44/EFI/fedora/grubx64.efi (from /boot/bootupd-state.json) will make the update tricky, will do more testing.

Update the result, for the diff, the additions / changes will save the source path that will be used to do the updates, we do not need it for removals (just do opts in dest efi dir).
For example:

&diff = FileTreeDiff {
    additions: {
        "shim/15.8-5/EFI/fedora/new.efi",
    },
    removals: {
        "fedora/shim.efi",
    },
    changes: {
        "shim/15.8-5/EFI/fedora/shimx64.efi",
        "grub2/1:2.12-41.fc44/EFI/fedora/grubx64.efi",
    },
}

@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch from 798f2a2 to fbb98bc Compare September 15, 2025 02:30
@HuijingHei HuijingHei marked this pull request as draft September 15, 2025 02:31
@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch 4 times, most recently from be41d67 to 26046df Compare September 29, 2025 12:18
@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch 4 times, most recently from 34c78c8 to 6285a6a Compare October 9, 2025 06:39
@HuijingHei HuijingHei marked this pull request as ready for review October 9, 2025 07:31
@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch from 6285a6a to ee1e2ad Compare October 10, 2025 01:21
@HuijingHei HuijingHei changed the title efi: Extend install() to support usr/lib/efi efi: Extend install() & update() to support usr/lib/efi Oct 10, 2025
@HuijingHei HuijingHei requested a review from travier October 10, 2025 11:23
@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch from ee1e2ad to 0a4a859 Compare October 11, 2025 03:06
@HuijingHei

HuijingHei commented Oct 14, 2025

Copy link
Copy Markdown
Contributor Author

Hold on, I will add some unit tests for the change. Done.

Add `source` in `FileMetadata` to save the file source path, it
is needed by changes / additions.

For example add `shim/15.8-5/EFI/fedora/shim.efi` to Filemetadata,
and keep `fedora/shim.efi` as the key, when doing updates:
- for additions/changes, will copy source path to dest path as
`shim/15.8-5/EFI/fedora/shim.efi -> fedora/shim.efi`
- for removals, only use path `fedora/shim.efi` as we do not need
the source path, as only do operations in dest dir
when doing `generate_update_metadata()`

As we support updates from `usr/lib/efi`, there is no need to copy
the EFI components to `usr/lib/bootupd/updates/`.
Also update kola test-bootupd.
@HuijingHei HuijingHei force-pushed the step2-install-from-usr branch from 0a4a859 to 1c02bc7 Compare October 14, 2025 03:52
Comment thread src/filetree.rs
@cgwalters cgwalters merged commit b89642f into coreos:main Oct 15, 2025
12 checks passed
@HuijingHei HuijingHei deleted the step2-install-from-usr branch October 15, 2025 13:08
@HuijingHei

Copy link
Copy Markdown
Contributor Author

Thank you @cgwalters for the kind review!

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.

2 participants