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

Add initramfs-tools implementation for cpio firmware loading #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tobhe
Copy link
Contributor

@tobhe tobhe commented Jun 19, 2023

This PR adds our Ubuntu implementation for firmware loading with initramfs-tools. I am sharing this here because I think it might also be useful for other initramfs-tools based distros such as Debian or Pop!_Os.

The changes added are:

  • Add initramfs hooks and boot scripts to extract and mount firmware
  • Add initramfs and ubuntu make targets
  • busybox mount doesn't support PARTUUID= so use /dev/disk/by-partuuid

The initramfs scripts are pretty much identical to the dracut and initcpio versions.
The only change I had to make to the existing code is because of a limitation in busybox which we use in our initrd.
busybox mount does not support PARTUUID so I am using /dev/disk/by-partuuid instead. As I understand it that approach should be fairly portable but I wouldn't mind making it a Ubuntu-only quirk either.

- Add initramfs hooks and boot scripts to extract and mount firmware
- Add initramfs and ubuntu make targets
- busybox mount doesn't support PARTUUID= so use /dev/disk/by-partuuid

Signed-off-by: Tobias Heider <[email protected]>
#!/usr/bin/sh
# SPDX-License-Identifier: MIT

PREREQ="udev"

Choose a reason for hiding this comment

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

Shouldn't this script run before udev? From https://github.com/AsahiLinux/docs/wiki/Open-OS-Ecosystem-on-Apple-Silicon-Macs#linux-specific:

Firmware must be located and loaded before udev starts up. This is because udev can arbitrarily cause modules to load and devices to probe (even if not triggered directly, the kernel can e.g. discover PCI devices while the initramfs is already running), and this creates race conditions where firmware might not be available when it is needed.

Copy link
Contributor

@Conan-Kudo Conan-Kudo left a comment

Choose a reason for hiding this comment

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

Can you please rename the directory initramfstools as initramfs is not descriptive enough?

install-fedora: install install-dracut

install-ubuntu: install install-initramfs
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be install-debian.

@@ -75,4 +91,6 @@ uninstall-arch: uninstall-mkinitcpio

uninstall-fedora: uninstall-dracut

uninstall-ubuntu: uninstall-initramfs
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be uninstall-debian.

@@ -54,8 +54,19 @@ install-arch: install install-mkinitcpio
install -dD $(DESTDIR)$(PREFIX)/share/libalpm/hooks
install -m0644 -t $(DESTDIR)$(PREFIX)/share/libalpm/hooks libalpm/hooks/95-m1n1-install.hook

install-initramfs: install
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use initramfstools here instead of initramfs? Otherwise it's confusing to people...

@@ -67,6 +78,11 @@ uninstall-mkinitcpio:
uninstall-dracut:
rm -f $(DESTDIR)$(DRACUT_CONF_DIR)/10-asahi.conf

uninstall-initramfs:
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto here wrt initramfs.

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.

3 participants