Skip to content

Commit

Permalink
Remove mkinitrd script.
Browse files Browse the repository at this point in the history
This changes removes the mkinitrd script and replaces all calls with direct calls to dracut.

In addition, the /boot/initrd.img-<kver> file has been renamed to /boot/initramfs-<kver>.img to match the default name used by dracut. This avoids needing to add a patch to dracut to change the default name of the initrd file.

Also, previously the mkinitrd script passed the `--hostonly` flag to dracut to ensure the hostonly option was enabled. This has been replaced with setting the hostonly only in the `/etc/dracut.conf` file instead. One nice advantage this provides is that it allows a user to override this default by adding a config file under the `/etc/dracut.conf.d` directory.
  • Loading branch information
cwize1 committed Feb 28, 2024
1 parent 9c7e51f commit 59e9bd0
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 287 deletions.
9 changes: 6 additions & 3 deletions SPECS-EXTENDED/kernel-rt/kernel-rt.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Summary: Realtime Linux Kernel
Name: kernel-rt
Version: 6.6.7.1
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -249,7 +249,7 @@ cat > %{buildroot}/boot/linux-%{uname_r}.cfg << "EOF"
# GRUB Environment Block
mariner_cmdline=init=/lib/systemd/systemd ro no-vmw-sta crashkernel=256M
mariner_linux=vmlinuz-%{uname_r}
mariner_initrd=initrd.img-%{uname_r}
mariner_initrd=initramfs-%{uname_r}.img
EOF
chmod 600 %{buildroot}/boot/linux-%{uname_r}.cfg

Expand Down Expand Up @@ -310,7 +310,7 @@ echo "initrd generation of kernel %{uname_r} will be triggered later" >&2

%triggerun -- initramfs
rm -rf %{_localstatedir}/lib/rpm-state/initramfs/pending/%{uname_r}
rm -rf /boot/initrd.img-%{uname_r}
rm -rf /boot/initramfs-%{uname_r}.img
echo "initrd of kernel %{uname_r} removed" >&2

%preun tools
Expand Down Expand Up @@ -421,6 +421,9 @@ ln -sf linux-%{uname_r}.cfg /boot/mariner.cfg
%{_sysconfdir}/bash_completion.d/bpftool

%changelog
* Fri Feb 23 2024 Chris Gunn <[email protected]> - 6.6.7.1-2
- Rename initrd.img-<kver> to initramfs-<kver>.img

* Fri Jan 26 2024 Harshit Gupta <[email protected]> - 6.6.7.1-1
- Upgrade to kernel version 6.6.7.1

Expand Down
7 changes: 5 additions & 2 deletions SPECS-SIGNED/kernel-signed/kernel-signed.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Summary: Signed Linux Kernel for %{buildarch} systems
Name: kernel-signed-%{buildarch}
Version: 6.6.14.1
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -119,7 +119,7 @@ echo "initrd generation of kernel %{uname_r} will be triggered later" >&2

%triggerun -n kernel -- initramfs
rm -rf %{_localstatedir}/lib/rpm-state/initramfs/pending/%{uname_r}
rm -rf /boot/initrd.img-%{uname_r}
rm -rf /boot/initramfs-%{uname_r}.img
echo "initrd of kernel %{uname_r} removed" >&2

%postun -n kernel
Expand Down Expand Up @@ -147,6 +147,9 @@ echo "initrd of kernel %{uname_r} removed" >&2
%exclude /module_info.ld

%changelog
* Fri Feb 23 2024 Chris Gunn <[email protected]> - 6.6.14.1-3
- Rename initrd.img-<kver> to initramfs-<kver>.img

* Tue Jan 30 2024 Cameron Baird <[email protected]> - 6.6.14.1-2
- Remove legacy /boot/mariner.cfg
- Introduce /etc/default/grub.d/10_kernel.cfg
Expand Down
49 changes: 0 additions & 49 deletions SPECS/dracut/0003-fix-initrd-naming-for-photon.patch

This file was deleted.

10 changes: 10 additions & 0 deletions SPECS/dracut/dracut-conf-add-defaults.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/dracut.conf b/dracut.conf
index d6317a0f..390c377e 100644
--- a/dracut.conf
+++ b/dracut.conf
@@ -1,3 +1,5 @@
# PUT YOUR CONFIG IN separate files
# in /etc/dracut.conf.d named "<name>.conf"
# SEE man dracut.conf(5) for options
+
+hostonly=yes
1 change: 0 additions & 1 deletion SPECS/dracut/dracut.signatures.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"dracut-059.tar.gz": "eabf0bb685420c1e1d5475b6855ef787104508f0135ff570312845256e0fcecf",
"lgpl-2.1.txt": "dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551",
"megaraid.conf": "914824cdbe0c525b71efa05a75e453335b0068beb8bc28bef2a5866d74bf7dd4",
"mkinitrd": "32a0e19de954a356a0f1903a1f75d3266493b55d71b0eeab6bd07b585e955dcf",
"module-setup.sh": "330af5c105793fb37434730ce0ff59467a9cc60a81a5e32193dc53235e9744c1",
"overlayfs-mount.sh": "63552c4115b5c37ed04c5311367301483e2dfe1091dc5717b2bd22d9cdda044b"
}
Expand Down
16 changes: 10 additions & 6 deletions SPECS/dracut/dracut.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Summary: dracut to create initramfs
Name: dracut
Version: 059
Release: 12%{?dist}
Release: 13%{?dist}
# The entire source code is GPLv2+
# except install/* which is LGPLv2+
License: GPLv2+ AND LGPLv2+
Expand All @@ -15,7 +15,6 @@ URL: https://github.com/dracutdevs/dracut/wiki

Source0: https://github.com/dracutdevs/dracut/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
Source2: mkinitrd
Source3: megaraid.conf
Source4: 20overlayfs/module-setup.sh
Source5: 20overlayfs/overlayfs-mount.sh
Expand All @@ -27,12 +26,16 @@ Patch: fix-functions-Avoid-calling-grep-with-PCRE-P.patch
Patch: allow-liveos-overlay-no-user-confirmation-prompt.patch

Patch: 0002-disable-xattr.patch
Patch: 0003-fix-initrd-naming-for-photon.patch
Patch: 0006-dracut.sh-validate-instmods-calls.patch
Patch: 0007-feat-dracut.sh-support-multiple-config-dirs.patch
Patch: 0008-fix-dracut-systemd-rootfs-generator-cannot-write-out.patch
Patch: 0009-install-systemd-executor.patch

# kdump currently uses the host system's initrd when enrolling a crash kernel
# and initrd. There is a limitation where the kdump initrd must be generated
# with dracut in hostonly mode. So, set hostonly as the default.
Patch: dracut-conf-add-defaults.patch

BuildRequires: bash
BuildRequires: kmod-devel
BuildRequires: pkg-config
Expand Down Expand Up @@ -131,8 +134,6 @@ mkdir -p %{buildroot}/boot/%{name} \
install -m 0644 dracut.conf.d/fips.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/40-fips.conf
> %{buildroot}%{_sysconfdir}/system-fips

install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/mkinitrd

install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/dracut.conf.d/50-megaraid.conf

mkdir -p %{buildroot}%{_libdir}/dracut/modules.d/20overlayfs/
Expand All @@ -148,7 +149,6 @@ ln -srv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_sbindir}/%{name}
%files
%defattr(-,root,root,0755)
%{_bindir}/%{name}
%{_bindir}/mkinitrd
%{_bindir}/lsinitrd
# compat symlink
%{_sbindir}/%{name}
Expand Down Expand Up @@ -216,6 +216,10 @@ ln -srv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_sbindir}/%{name}
%dir %{_sharedstatedir}/%{name}/overlay

%changelog
* Fri Feb 23 2024 Chris Gunn <[email protected]> - 059-13
- Remove mkinitrd script
- Set hostonly as default in /etc/dracut.conf

* Wed Feb 07 2024 Dan Streetman <[email protected]> - 059-12
- update to 059

Expand Down
184 changes: 0 additions & 184 deletions SPECS/dracut/mkinitrd

This file was deleted.

Loading

0 comments on commit 59e9bd0

Please sign in to comment.