[PATCH] build kernel-firmware rpms again

Martin Dengler martin at martindengler.com
Thu Jul 9 12:17:23 EDT 2009


---
 olpc/SPECS/kernel-xo1.5.spec |   37 +++++++++++++++++++++++++++++++++++--
 olpc/SPECS/kernel-xo1.spec   |   37 +++++++++++++++++++++++++++++++++++--
 2 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/olpc/SPECS/kernel-xo1.5.spec b/olpc/SPECS/kernel-xo1.5.spec
index 32f2c3f..67615ac 100644
--- a/olpc/SPECS/kernel-xo1.5.spec
+++ b/olpc/SPECS/kernel-xo1.5.spec
@@ -14,6 +14,8 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define builddoc 0
 %define buildkdump 0
 %define buildheaders 1
+# kernel-firmware
+%define with_firmware  %{?_with_firmware:  1} %{?!_with_firmware:  0}
 %define _enable_debug_packages 0
 
 # Versions of various parts
@@ -54,6 +56,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define buildxen 0
 %define buildkdump 0
 %define all_arch_configs $RPM_SOURCE_DIR/kernel-xo1.5-custom.config
+%define with_firmware 1
 %endif
 # Don't build 586 kernels for RHEL builds.
 %if 0%{?rhel}
@@ -73,6 +76,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define buildup 0
 %define buildheaders 0
 %define all_arch_configs $RPM_SOURCE_DIR/kernel-%{kversion}-*.config
+%define with_firmware 0
 %endif
 
 # kdump only builds on i686, x86_64, ppc64 ...
@@ -215,7 +219,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 # Packages that need to be installed before the kernel is, because the %post
 # scripts use them.
 #
-%define kernel_prereq  fileutils, module-init-tools, initscripts >= 8.11.1-1, dracut, dracut-modules-olpc >= 0.2.0
+%define kernel_prereq  fileutils, module-init-tools, initscripts >= 8.11.1-1, kernel-firmware >= %{rpmversion}-%{pkg_release}, dracut, dracut-modules-olpc >= 0.2.0
 
 Name: kernel
 Group: System Environment/Kernel
@@ -323,6 +327,21 @@ header files define structures and constants that are needed for
 building most standard programs and are also needed for rebuilding the
 glibc package.
 
+
+%package firmware
+Summary: Firmware files used by the Linux kernel
+Group: Development/System
+# This is... complicated.
+# Look at the WHENCE file.
+License: GPL+ and GPLv2+ and MIT and Redistributable, no modification permitted
+%if "x%{?variant}" != "x"
+Provides: kernel-firmware = %{rpmversion}-%{pkg_release}
+%endif
+%description firmware
+Kernel-firmware includes firmware files required for some devices to
+operate.
+
+
 %prep
 #if a rhel kernel, apply the rhel config options
 %if 0%{?rhel}
@@ -518,7 +537,9 @@ Config=kernel-xo1.5-custom.config
     fi
 
     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
-    make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer
+    # Override $(mod-fw) because we don't want it to install any firmware
+    # We'll do that ourselves with 'make firmware_install'
+    make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw=
 
     # And save the headers/makefiles etc for building modules against
     #
@@ -805,6 +826,11 @@ rm -f $RPM_BUILD_ROOT/usr/include/asm*/atomic.h
 rm -f $RPM_BUILD_ROOT/usr/include/asm*/io.h
 rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h
 %endif
+
+%if %{with_firmware}
+make INSTALL_FW_PATH=$RPM_BUILD_ROOT/lib/firmware firmware_install
+%endif
+
 ###
 ### clean
 ###
@@ -888,6 +914,13 @@ fi
 /usr/include/*
 %endif
 
+%if %{with_firmware}
+%files firmware
+%defattr(-,root,root)
+/lib/firmware/*
+%doc linux-%{kversion}.%{_target_cpu}/firmware/WHENCE
+%endif
+
 # only some architecture builds need kernel-doc
 
 %if %{builddoc}
diff --git a/olpc/SPECS/kernel-xo1.spec b/olpc/SPECS/kernel-xo1.spec
index feb2b65..46b3f5d 100644
--- a/olpc/SPECS/kernel-xo1.spec
+++ b/olpc/SPECS/kernel-xo1.spec
@@ -14,6 +14,8 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define builddoc 0
 %define buildkdump 0
 %define buildheaders 1
+# kernel-firmware
+%define with_firmware  %{?_with_firmware:  1} %{?!_with_firmware:  0}
 %define _enable_debug_packages 0
 
 # Versions of various parts
@@ -54,6 +56,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define buildxen 0
 %define buildkdump 0
 %define all_arch_configs $RPM_SOURCE_DIR/kernel-xo1-custom.config
+%define with_firmware 1
 %endif
 # Don't build 586 kernels for RHEL builds.
 %if 0%{?rhel}
@@ -73,6 +76,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define buildup 0
 %define buildheaders 0
 %define all_arch_configs $RPM_SOURCE_DIR/kernel-%{kversion}-*.config
+%define with_firmware 0
 %endif
 
 # kdump only builds on i686, x86_64, ppc64 ...
@@ -215,7 +219,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 # Packages that need to be installed before the kernel is, because the %post
 # scripts use them.
 #
-%define kernel_prereq  fileutils, module-init-tools, initscripts >= 8.11.1-1
+%define kernel_prereq  fileutils, module-init-tools, initscripts >= 8.11.1-1, kernel-firmware >= %{rpmversion}-%{pkg_release}
 
 Name: kernel
 Group: System Environment/Kernel
@@ -323,6 +327,21 @@ header files define structures and constants that are needed for
 building most standard programs and are also needed for rebuilding the
 glibc package.
 
+
+%package firmware
+Summary: Firmware files used by the Linux kernel
+Group: Development/System
+# This is... complicated.
+# Look at the WHENCE file.
+License: GPL+ and GPLv2+ and MIT and Redistributable, no modification permitted
+%if "x%{?variant}" != "x"
+Provides: kernel-firmware = %{rpmversion}-%{pkg_release}
+%endif
+%description firmware
+Kernel-firmware includes firmware files required for some devices to
+operate.
+
+
 %prep
 #if a rhel kernel, apply the rhel config options
 %if 0%{?rhel}
@@ -518,7 +537,9 @@ Config=kernel-xo1-custom.config
     fi
 
     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
-    make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer
+    # Override $(mod-fw) because we don't want it to install any firmware
+    # We'll do that ourselves with 'make firmware_install'
+    make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw=
 
     # And save the headers/makefiles etc for building modules against
     #
@@ -805,6 +826,11 @@ rm -f $RPM_BUILD_ROOT/usr/include/asm*/atomic.h
 rm -f $RPM_BUILD_ROOT/usr/include/asm*/io.h
 rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h
 %endif
+
+%if %{with_firmware}
+make INSTALL_FW_PATH=$RPM_BUILD_ROOT/lib/firmware firmware_install
+%endif
+
 ###
 ### clean
 ###
@@ -887,6 +913,13 @@ fi
 /usr/include/*
 %endif
 
+%if %{with_firmware}
+%files firmware
+%defattr(-,root,root)
+/lib/firmware/*
+%doc linux-%{kversion}.%{_target_cpu}/firmware/WHENCE
+%endif
+
 # only some architecture builds need kernel-doc
 
 %if %{builddoc}
-- 
1.6.0.6




More information about the Devel mailing list