Split off mkconfig from grub2 package to reduce image footprint (#8485)

This commit is contained in:
Cameron E Baird 2024-03-22 13:10:01 -07:00 коммит произвёл GitHub
Родитель db95c51ec2
Коммит b17e8b70c2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
5 изменённых файлов: 52 добавлений и 22 удалений

Просмотреть файл

@ -12,7 +12,7 @@
Summary: Signed GRand Unified Bootloader for %{buildarch} systems
Name: grub2-efi-binary-signed-%{buildarch}
Version: 2.06
Release: 16%{?dist}
Release: 17%{?dist}
License: GPLv3+
Vendor: Microsoft Corporation
Distribution: Azure Linux
@ -41,6 +41,7 @@ specifically created for installing on %{buildarch} systems
%package -n grub2-efi-binary
Summary: GRand Unified Bootloader
Group: Applications/System
Requires: grub2-tools-minimal = %{version}-%{release}
# Some distros split 'grub2' into more subpackages. For now we're bundling it all together
# inside the default package and adding these 'Provides' to make installation more user-friendly
@ -56,6 +57,7 @@ specifically created for installing on %{buildarch} systems
%package -n grub2-efi-binary-noprefix
Summary: GRand Unified Bootloader
Group: Applications/System
Requires: grub2-tools-minimal = %{version}-%{release}
%description -n grub2-efi-binary-noprefix
This package contains the GRUB EFI image with no prefix directory set and is signed for secure boot. The package is
@ -77,6 +79,9 @@ cp %{SOURCE3} %{buildroot}/boot/efi/EFI/BOOT/%{grubpxeefiname}
/boot/efi/EFI/BOOT/%{grubpxeefiname}
%changelog
* Wed Mar 20 2024 Cameron Baird <cameronbaird@microsoft.com> - 2.06-17
- Bump release number to match grub release number
* Wed Mar 07 2024 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 2.06-16
- Bumping release version to match with `grub2` release version

Просмотреть файл

@ -6,7 +6,7 @@
Summary: GRand Unified Bootloader
Name: grub2
Version: 2.06
Release: 16%{?dist}
Release: 17%{?dist}
License: GPLv3+
Vendor: Microsoft Corporation
Distribution: Azure Linux
@ -92,7 +92,7 @@ BuildRequires: xz-devel
Requires: device-mapper
Requires: systemd-udev
Requires: xz
Requires: %{name}-configuration = %{version}-%{release}
Requires: %{name}-tools-minimal = %{version}-%{release}
# Some distros split 'grub2' into more subpackages. For now we're bundling it all together
# inside the default package and adding these 'Provides' to make installation more user-friendly
@ -101,7 +101,6 @@ Provides: %{name}-common = %{version}-%{release}
Provides: %{name}-tools = %{version}-%{release}
Provides: %{name}-tools-efi = %{version}-%{release}
Provides: %{name}-tools-extra = %{version}-%{release}
Provides: %{name}-tools-minimal = %{version}-%{release}
%description
The GRUB package contains the GRand Unified Bootloader.
@ -152,6 +151,7 @@ Unsigned GRUB UEFI image
%package efi-binary
Summary: GRUB UEFI image
Group: System Environment/Base
Requires: %{name}-tools-minimal = %{version}-%{release}
# Some distros split 'grub2' into more subpackages. For now we're bundling it all together
# inside the default package and adding these 'Provides' to make installation more user-friendly
@ -166,6 +166,7 @@ GRUB UEFI bootloader binaries
%package efi-binary-noprefix
Summary: GRUB UEFI image with no prefix directory set
Group: System Environment/Base
Requires: %{name}-tools-minimal = %{version}-%{release}
%description efi-binary-noprefix
GRUB UEFI bootloader binaries with no prefix directory set
@ -186,6 +187,14 @@ Group: System Environment/Base
Directory for package-specific boot configurations
to be persistently stored on AzureLinux
%package tools-minimal
Summary: Minimal set of utilities to configure a grub-based system
Group: System Environment/Base
Requires: %{name}-configuration = %{version}-%{release}
%description tools-minimal
Minimal set of utilities to configure a grub-based system
%prep
# Remove module_info.ld script due to error "grub2-install: error: Decompressor is too big"
LDFLAGS="`echo " %{build_ldflags} " | sed 's#-Wl,-dT,%{_topdir}/BUILD/module_info.ld##'`"
@ -333,12 +342,35 @@ cp $GRUB_PXE_MODULE_SOURCE $EFI_BOOT_DIR/$GRUB_PXE_MODULE_NAME
%license COPYING
%dir /boot/%{name}
%config() %{_sysconfdir}/bash_completion.d/grub
/sbin/*
%{_bindir}/*
%{_datarootdir}/grub/*
%{_sysconfdir}/sysconfig/grub
%attr(0644,root,root) %ghost %config(noreplace) %{_sysconfdir}/default/grub
%ghost %config(noreplace) /boot/%{name}/grub.cfg
/sbin/grub2-bios-setup
/sbin/grub2-install
/sbin/grub2-macbless
/sbin/grub2-ofpathname
/sbin/grub2-reboot
/sbin/grub2-set-default
/sbin/grub2-sparc64-setup
%{_bindir}/grub2-fstest
%{_bindir}/grub2-glue-efi
%{_bindir}/grub2-kbdcomp
%{_bindir}/grub2-menulst2cfg
%{_bindir}/grub2-mkimage
%{_bindir}/grub2-mklayout
%{_bindir}/grub2-mknetdir
%{_bindir}/grub2-mkpasswd-pbkdf2
%{_bindir}/grub2-mkrescue
%{_bindir}/grub2-mkstandalone
%{_bindir}/grub2-render-label
%{_bindir}/grub2-syslinux2cfg
%files tools-minimal
%{_datarootdir}/grub/grub-mkconfig_lib
/sbin/grub2-probe
/sbin/grub2-mkconfig
%{_bindir}/grub2-editenv
%{_bindir}/grub2-script-check
%{_bindir}/grub2-file
%{_bindir}/grub2-mkrelpath
%ifarch x86_64
%files pc
@ -379,6 +411,8 @@ cp $GRUB_PXE_MODULE_SOURCE $EFI_BOOT_DIR/$GRUB_PXE_MODULE_NAME
%dir %{_sysconfdir}/grub.d
%dir %{_sysconfdir}/default/grub.d
%{_sysconfdir}/grub.d/README
%attr(0644,root,root) %ghost %config(noreplace) %{_sysconfdir}/default/grub
%ghost %config(noreplace) /boot/%{name}/grub.cfg
%config() %{_sysconfdir}/grub.d/00_header
%config() %{_sysconfdir}/grub.d/10_linux
%config() %{_sysconfdir}/grub.d/20_linux_xen
@ -388,7 +422,10 @@ cp $GRUB_PXE_MODULE_SOURCE $EFI_BOOT_DIR/$GRUB_PXE_MODULE_NAME
%config(noreplace) %{_sysconfdir}/grub.d/41_custom
%changelog
* Wed Mar 07 2024 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 2.06-16
* Tue Mar 19 2024 Cameron Baird <cameronbaird@microsoft.com> - 2.06-17
- Introduce grub2-tools-minimal subpackage
* Wed Mar 06 2024 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 2.06-16
- Updated sbat.csv.in to reflect new distro name.
* Tue Mar 05 2024 Cameron Baird <cameronbaird@microsoft.com> - 2.06-15

Просмотреть файл

@ -2,7 +2,6 @@
"packages": [
"shim-unsigned",
"grub2-efi-binary",
"grub2",
"ca-certificates",
"cronie-anacron",
"logrotate",

Просмотреть файл

@ -2,7 +2,6 @@
"packages": [
"shim",
"grub2-efi-binary",
"grub2",
"ca-certificates",
"cronie-anacron",
"logrotate",

Просмотреть файл

@ -118,7 +118,6 @@ func validatePackages(config configuration.Config) (err error) {
verityDebugPkgName = "verity-read-only-root-debug-tools"
dracutFipsPkgName = "dracut-fips"
fipsKernelCmdLine = "fips=1"
grub2PkgName = "grub2"
)
for _, systemConfig := range config.SystemConfigs {
@ -130,7 +129,6 @@ func validatePackages(config configuration.Config) (err error) {
foundVerityInitramfsPackage := false
foundVerityInitramfsDebugPackage := false
foundDracutFipsPackage := false
foundGrub2Package := false
kernelCmdLineString := systemConfig.KernelCommandLine.ExtraCommandLine
selinuxPkgName := systemConfig.KernelCommandLine.SELinuxPolicy
if selinuxPkgName == "" {
@ -153,9 +151,6 @@ func validatePackages(config configuration.Config) (err error) {
if pkg == selinuxPkgName {
foundSELinuxPackage = true
}
if pkg == grub2PkgName {
foundGrub2Package = true
}
}
if systemConfig.ReadOnlyVerityRoot.Enable {
if !foundVerityInitramfsPackage {
@ -175,11 +170,6 @@ func validatePackages(config configuration.Config) (err error) {
return fmt.Errorf("%s: [SELinux] selected, but '%s' package is not included in the package lists", validateError, selinuxPkgName)
}
}
if !systemConfig.IsRootFS() && systemConfig.EnableGrubMkconfig {
if !foundGrub2Package {
return fmt.Errorf("%s: [EnableGrubMkconfig] selected, but '%s' package is not included in the package lists", validateError, grub2PkgName)
}
}
}
return