Add zstd kmod compression support
* brp-kmod-restore-perms: Add chech for "$RPM_BUILD_ROOT/$path.zst". * find-provides.ksyms: Add "\.zst" to the kernel module path matching regular expression; process kernel module with zstd if its file name ends with "zst". * find-requires.ksyms: Likewise. * firmware.prov: Add "\.zst" to the kernel module path matching regular expression. * kmodtool (%post, %preun): Likewise. * modalias.prov: Likewise. * modalias.attr (%__modalias_path): Add "ko\.zst" to the kernel module path matching regular expression. * provided_ksyms.attr (%__provided_ksyms_path): Likewise. * required_ksyms.attr (%__required_ksyms_path): Likewise. * kmod.attr (%__kmod_path): Add ".*\.ko\.zst" to the kernel module path matching regular expression. (strip_compress_sfx): Strip "\.zst" suffix, if present. Resolves: #1942537 Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
This commit is contained in:
parent
39342dd4d2
commit
1208dd48a6
@ -19,6 +19,7 @@ while read perm path; do
|
|||||||
[ \! -e "$RPM_BUILD_ROOT/$path.gz" ] || path="$path.gz"
|
[ \! -e "$RPM_BUILD_ROOT/$path.gz" ] || path="$path.gz"
|
||||||
[ \! -e "$RPM_BUILD_ROOT/$path.bz2" ] || path="$path.bz2"
|
[ \! -e "$RPM_BUILD_ROOT/$path.bz2" ] || path="$path.bz2"
|
||||||
[ \! -e "$RPM_BUILD_ROOT/$path.xz" ] || path="$path.xz"
|
[ \! -e "$RPM_BUILD_ROOT/$path.xz" ] || path="$path.xz"
|
||||||
|
[ \! -e "$RPM_BUILD_ROOT/$path.zst" ] || path="$path.zst"
|
||||||
}
|
}
|
||||||
|
|
||||||
chmod "$perm" "$RPM_BUILD_ROOT/$path"
|
chmod "$perm" "$RPM_BUILD_ROOT/$path"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
|
||||||
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@"; do
|
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
|
||||||
dep_pfx="ksym"
|
dep_pfx="ksym"
|
||||||
# For built-in kmods, "kernel()" syntax is used instead of "ksym()"
|
# For built-in kmods, "kernel()" syntax is used instead of "ksym()"
|
||||||
printf "%s" "$module" | grep -v "^${RPM_BUILD_ROOT}/\?lib/modules/[1-9][^/]*/kernel" > /dev/null \
|
printf "%s" "$module" | grep -v "^${RPM_BUILD_ROOT}/\?lib/modules/[1-9][^/]*/kernel" > /dev/null \
|
||||||
@ -13,6 +13,9 @@ for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@"; do
|
|||||||
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)
|
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)
|
||||||
proc_bin=
|
proc_bin=
|
||||||
case "${module##*.}" in
|
case "${module##*.}" in
|
||||||
|
zst)
|
||||||
|
proc_bin=zstd
|
||||||
|
;;
|
||||||
xz)
|
xz)
|
||||||
proc_bin=xz
|
proc_bin=xz
|
||||||
;;
|
;;
|
||||||
|
@ -15,6 +15,9 @@ all_provides() {
|
|||||||
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)
|
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)
|
||||||
proc_bin=
|
proc_bin=
|
||||||
case "${module##*.}" in
|
case "${module##*.}" in
|
||||||
|
zst)
|
||||||
|
proc_bin=zstd
|
||||||
|
;;
|
||||||
xz)
|
xz)
|
||||||
proc_bin=xz
|
proc_bin=xz
|
||||||
;;
|
;;
|
||||||
@ -123,7 +126,7 @@ check_kabi() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@")
|
modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@")
|
||||||
if [ ${#modules[@]} -gt 0 ]; then
|
if [ ${#modules[@]} -gt 0 ]; then
|
||||||
kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)
|
kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
|
||||||
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') $*;
|
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') $*;
|
||||||
do
|
do
|
||||||
for firmware in `/sbin/modinfo -F firmware $module`;
|
for firmware in `/sbin/modinfo -F firmware $module`;
|
||||||
do
|
do
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz)$
|
%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz|.*\.ko\.zst)$
|
||||||
%__kmod_provides() %{lua:
|
%__kmod_provides() %{lua:
|
||||||
function basename(fn)
|
function basename(fn)
|
||||||
return string.gsub(fn, "(.*/)(.*)", "%2")
|
return string.gsub(fn, "(.*/)(.*)", "%2")
|
||||||
end
|
end
|
||||||
function strip_compress_sfx(fn)
|
function strip_compress_sfx(fn)
|
||||||
return string.gsub(fn, "(.*)(\.gz|\.bz2|\.xz)?$", "%1")
|
return string.gsub(fn, "(.*)(\.gz|\.bz2|\.xz|\.zst)?$", "%1")
|
||||||
end
|
end
|
||||||
function printdep(mod)
|
function printdep(mod)
|
||||||
print("kmod("..mod..") ")
|
print("kmod("..mod..") ")
|
||||||
|
4
kmodtool
4
kmodtool
@ -211,7 +211,7 @@ if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then
|
|||||||
/usr/sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
|
/usr/sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
modules=( \$(find /lib/modules/${verrel}${dotvariant}/extra/${kmod_name} | grep -E '\.ko(\.gz|\.bz2|\.xz)?$') )
|
modules=( \$(find /lib/modules/${verrel}${dotvariant}/extra/${kmod_name} | grep -E '\.ko(\.gz|\.bz2|\.xz|\.zst)?$') )
|
||||||
if [ -x "/usr/sbin/weak-modules" ]; then
|
if [ -x "/usr/sbin/weak-modules" ]; then
|
||||||
printf '%s\n' "\${modules[@]}" \
|
printf '%s\n' "\${modules[@]}" \
|
||||||
| /usr/sbin/weak-modules --add-modules
|
| /usr/sbin/weak-modules --add-modules
|
||||||
@ -220,7 +220,7 @@ EOF
|
|||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
%preun -n kmod-${kmod_name}${dashvariant}
|
%preun -n kmod-${kmod_name}${dashvariant}
|
||||||
rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep -E '\.ko(\.gz|\.bz2|\.xz)?$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep -E '\.ko(\.gz|\.bz2|\.xz|\.zst)?$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
%__modalias_provides /usr/lib/rpm/redhat/find-provides.d/modalias.prov
|
%__modalias_provides /usr/lib/rpm/redhat/find-provides.d/modalias.prov
|
||||||
%__modalias_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz)$
|
%__modalias_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz|ko\.zst)$
|
||||||
|
@ -58,7 +58,7 @@ combine_modaliases() {
|
|||||||
print_modaliases "$class" "$variants" "$pos"
|
print_modaliases "$class" "$variants" "$pos"
|
||||||
}
|
}
|
||||||
|
|
||||||
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@"; do
|
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
|
||||||
# | head -n1 because some modules have *two* version tags. *cough*b44*cough*
|
# | head -n1 because some modules have *two* version tags. *cough*b44*cough*
|
||||||
modver=$(/sbin/modinfo -F version "$module"| head -n1)
|
modver=$(/sbin/modinfo -F version "$module"| head -n1)
|
||||||
modver=${modver// /_}
|
modver=${modver// /_}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
%__provided_ksyms_provides /usr/lib/rpm/redhat/find-provides.ksyms
|
%__provided_ksyms_provides /usr/lib/rpm/redhat/find-provides.ksyms
|
||||||
%__provided_ksyms_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz)$
|
%__provided_ksyms_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz|ko\.zst)$
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
%__required_ksyms_requires /usr/lib/rpm/redhat/find-requires.ksyms
|
%__required_ksyms_requires /usr/lib/rpm/redhat/find-requires.ksyms
|
||||||
%__required_ksyms_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz)$
|
%__required_ksyms_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz|ko\.zst)$
|
||||||
# Exclude built-in kernel modules
|
# Exclude built-in kernel modules
|
||||||
%__required_ksyms_exclude_path ^/lib/modules/[1-9][^/]*/kernel/.*
|
%__required_ksyms_exclude_path ^/lib/modules/[1-9][^/]*/kernel/.*
|
||||||
|
Loading…
Reference in New Issue
Block a user