2011-10-05 07:01:45 +02:00
|
|
|
# A few cross-distro definitions:
|
|
|
|
%kernel_module_package_release 1
|
2010-12-01 11:20:27 +01:00
|
|
|
%kernel_module_package_buildreqs module-init-tools kernel-syms
|
2011-10-05 07:01:45 +02:00
|
|
|
|
|
|
|
# Defines %flavors_to_build and %kernel_source() as a side effect.
|
2013-05-01 08:12:39 +02:00
|
|
|
%_kernel_module_package(n:v:r:t:f:Xp:bc:) \
|
2013-09-04 08:05:35 +02:00
|
|
|
%{expand:%( \
|
2011-10-05 07:01:45 +02:00
|
|
|
subpkg=%{-t*}%{!-t:/usr/lib/rpm/kernel-module-subpackage} \
|
2013-05-01 08:12:39 +02:00
|
|
|
echo "%%define _suse_kernel_module_subpackage(n:v:r:f:p:bc) %%{expand:%%(cd %_sourcedir; cat $subpkg; echo %%%%nil)}" \
|
2011-10-05 07:01:45 +02:00
|
|
|
flavors_to_build= \
|
|
|
|
flavors="%*" \
|
|
|
|
for flavor in $(ls /usr/src/linux-obj/%_target_cpu 2>/dev/null); do \
|
|
|
|
case " $flavors " in \
|
|
|
|
(*" $flavor "*) \
|
|
|
|
[ -n "%{-X}" ] && continue ;; \
|
|
|
|
(*) \
|
|
|
|
[ -z "%{-X}" -a -n "$flavors" ] && continue ;; \
|
|
|
|
esac \
|
|
|
|
krel=$(make -s -C /usr/src/linux-obj/%_target_cpu/$flavor kernelrelease) \
|
|
|
|
kver=${krel%%-*} \
|
|
|
|
flavors_to_build="$flavors_to_build $flavor" \
|
2013-05-01 08:12:39 +02:00
|
|
|
echo "%%_suse_kernel_module_subpackage -n %{-n*}%{!-n:%name} -v %{-v*}%{!-v:%version} -r %{-r*}%{!-r:%release} %{-p} %{-b} %{-c:-c} $flavor $kver" \
|
2011-10-05 07:01:45 +02:00
|
|
|
done \
|
|
|
|
echo "%%global flavors_to_build${flavors_to_build:-%%nil}" \
|
|
|
|
echo "%%{expand:%%(test -z '%flavors_to_build' && echo %%%%internal_kmp_error)}" \
|
|
|
|
echo "%%global kernel_source() /usr/src/linux-obj/%_target_cpu/%%%%{1}" \
|
|
|
|
echo "%%global kernel_module_package_moddir() updates" \
|
|
|
|
\
|
|
|
|
echo "%package -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
|
|
|
|
echo "Version: %version" \
|
|
|
|
echo "Summary: %summary" \
|
|
|
|
echo "Group: %group" \
|
|
|
|
echo "%description -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
|
2013-05-01 08:12:39 +02:00
|
|
|
%{-c:
|
|
|
|
for fmt in DER PEM; do h=$(openssl x509 -inform $fmt -fingerprint -noout -in %{-c*}); if test -n "$h"; then break; fi; done \
|
|
|
|
cert=/etc/uefi/certs/$(echo "$h" | sed -rn 's/^SHA1 Fingerprint=//; T; s/://g; s/(.{8}).*/\\1/p').crt
|
2013-09-04 08:05:35 +02:00
|
|
|
: The -n expanstion in kernel-cert-subpackage only works if
|
|
|
|
: -n is actually passed to the macro. Fix this here, so that
|
|
|
|
: we do not have to modify the modsign-repackage script
|
|
|
|
sed "s|@CERTS@|$cert|g; s|%%{-n.}|%{-n*}%{!-n:%name}|g" /usr/lib/rpm/kernel-cert-subpackage \
|
2013-05-01 08:12:39 +02:00
|
|
|
echo "%%global __spec_build_pre %%__spec_build_pre mkdir -p %%buildroot/etc/uefi/certs; openssl x509 -in %{-c*} -inform $fmt -out %%buildroot/$cert -outform DER" } \
|
2011-10-05 07:01:45 +02:00
|
|
|
)}
|
|
|
|
|
|
|
|
# kernel_module_package: simply pass on all options and arguments.
|
2013-05-01 08:12:39 +02:00
|
|
|
%kernel_module_package(n:v:r:t:f:xp:bc:) \
|
2011-10-05 07:01:45 +02:00
|
|
|
%{expand:%%_kernel_module_package %{-x:-X} %{-n} %{-v} %{-r} %{-t} %{-f} %{-p} %*}
|
|
|
|
|
|
|
|
# suse_kernel_module_package: invert the meaning of the -x flag. (You are not
|
|
|
|
# supposed to understand why a simple %{-x:}%{!-x:-x} won't work.)
|
2013-05-01 08:12:39 +02:00
|
|
|
%suse_kernel_module_package(n:v:r:s:f:xp:bc:) \
|
2011-10-05 07:01:45 +02:00
|
|
|
%{expand:%%_kernel_module_package %{-x: }%{!-x:-X} %{-n} %{-v} %{-r} %{-s:-t %{-s*}} %{-f} %{-p} %*}
|