Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dracut-initramfs-restore.sh): get compression method from image #2596

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

aafeijoo-suse
Copy link
Member

@aafeijoo-suse aafeijoo-suse commented Dec 20, 2023

Instead of trying every possible compression method until the right one is found, parse the header of the initramfs image to get the right one and use it without hiding possible decompression errors, using the same logic that is implemented in lsinitrd.sh.

For that, refactor lsinitrd.sh moving common code to dracut-functions.sh. In particular:

  • get_machine_id
  • get_default_initramfs_image [<kernel_version>]
  • has_early_microcode <initramfs_image>
  • get_decompression_command <initramfs_image_header>

Also, added a new get_dollar_boot function to get the $BOOT partition placeholder, as defined in the Boot Loader Specification. If bootctl is available, use it to support a possible XBOOTLDR partition, otherwise, check only the ESP, as before.

Also refactored dracut.sh using these new functions to get the outfile path.

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

Create functions with common code as a previous step to use them in other parts.
In particular:
- `get_machine_id`
- `get_default_initramfs_image [<kernel_version>]`
- `has_early_microcode <initramfs_image>`
- `get_decompression_command <initramfs_image_header>`
Instead of trying every possible compression method until the right one is
found, parse the header of the initramfs image to get the right one and use it
without hiding possible decompression errors, using the same logic that is
implemented in `lsinitrd.sh`.
@aafeijoo-suse aafeijoo-suse force-pushed the dracut-initramfs-restore-rewrite-feat branch from 5a01cd0 to 4c8320b Compare December 21, 2023 07:35
@aafeijoo-suse
Copy link
Member Author

@tblume JFYI, this is what we discussed internally this week.

@aafeijoo-suse aafeijoo-suse marked this pull request as ready for review December 21, 2023 13:51
@aafeijoo-suse aafeijoo-suse marked this pull request as draft January 25, 2024 15:08
@aafeijoo-suse aafeijoo-suse force-pushed the dracut-initramfs-restore-rewrite-feat branch from 48c298a to adbafed Compare January 25, 2024 15:14
@aafeijoo-suse aafeijoo-suse linked an issue Jan 25, 2024 that may be closed by this pull request
@aafeijoo-suse aafeijoo-suse force-pushed the dracut-initramfs-restore-rewrite-feat branch from adbafed to b063309 Compare January 25, 2024 15:51
…laceholder

Implement and use a new `get_dollar_boot` function to get the `$BOOT` partition
placeholder, as defined in the Boot Loader Specification [1].
If `bootctl` is available, use it to support a possible XBOOTLDR partition,
otherwise, check only the ESP, as before.

[1] https://uapi-group.org/specifications/specs/boot_loader_specification
Use the new functions `get_dollar_boot`, `get_machine_id` and
`get_default_initramfs_image` to get the `outfile` path.

Fixes dracutdevs#1995
@aafeijoo-suse aafeijoo-suse force-pushed the dracut-initramfs-restore-rewrite-feat branch from b063309 to 43469bf Compare January 25, 2024 16:05
Since v6.8-rc1 [1], when the kernel was booted with an initrd and the
`retain_initrd` option is set on the kernel command line, /sys/firmware/initrd
contains the contents of the initrd that the kernel was booted with.

Therefore, there is no need to guess the path of the initrd for `lsinitrd`
and `dracut-initramfs-restore` if this sysfs file exists on the running system.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2678fd2fe9ee2c569e9cb6b17e786bc8f0753538
@github-actions github-actions bot added the man label Jan 30, 2024
Copy link

stale bot commented Mar 13, 2024

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

@stale stale bot added the stale communication is stuck label Mar 13, 2024
@aafeijoo-suse aafeijoo-suse removed the stale communication is stuck label Mar 14, 2024
Copy link

stale bot commented Apr 22, 2024

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

@stale stale bot added the stale communication is stuck label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
man stale communication is stuck
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefer XBOOTLDR to ESP when installing unified kernel images.
1 participant