2019-07-22 22:01:03 +00:00
|
|
|
#! /bin/bash
|
2020-11-04 02:27:34 +00:00
|
|
|
# shellcheck disable=SC2164
|
2019-07-22 22:01:03 +00:00
|
|
|
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
RpmDir=$1
|
|
|
|
ModDir=$2
|
|
|
|
Dir="$1/$2"
|
|
|
|
# Note the list filename must have the format mod-[PACKAGE].list, for example,
|
|
|
|
# mod-internal.list or mod-extra.list. The PACKAGE is used to create a
|
|
|
|
# override directory for the modules.
|
|
|
|
List=$3
|
|
|
|
Dest="$4"
|
2019-07-22 22:01:03 +00:00
|
|
|
|
2020-03-31 17:22:24 +00:00
|
|
|
blacklist()
|
|
|
|
{
|
|
|
|
cat > "$RpmDir/etc/modprobe.d/$1-blacklist.conf" <<-__EOF__
|
|
|
|
# This kernel module can be automatically loaded by non-root users. To
|
|
|
|
# enhance system security, the module is blacklisted by default to ensure
|
|
|
|
# system administrators make the module available for use as needed.
|
|
|
|
# See https://access.redhat.com/articles/3760101 for more details.
|
|
|
|
#
|
|
|
|
# Remove the blacklist by adding a comment # at the start of the line.
|
|
|
|
blacklist $1
|
|
|
|
__EOF__
|
|
|
|
}
|
|
|
|
|
|
|
|
check_blacklist()
|
|
|
|
{
|
2020-11-04 02:27:34 +00:00
|
|
|
mod=$(find "$RpmDir/$ModDir" -name "$1")
|
2020-03-31 17:22:24 +00:00
|
|
|
[ ! "$mod" ] && return 0
|
2020-11-04 02:27:34 +00:00
|
|
|
if modinfo "$mod" | grep -q '^alias:\s\+net-'; then
|
2020-03-31 17:22:24 +00:00
|
|
|
mod="${1##*/}"
|
|
|
|
mod="${mod%.ko*}"
|
|
|
|
echo "$mod has an alias that allows auto-loading. Blacklisting."
|
|
|
|
blacklist "$mod"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
find_depends()
|
|
|
|
{
|
|
|
|
dep=$1
|
2020-11-04 02:27:34 +00:00
|
|
|
depends=$(modinfo "$dep" | sed -n -e "/^depends/ s/^depends:[ \t]*//p")
|
2020-03-31 17:22:24 +00:00
|
|
|
[ -z "$depends" ] && exit
|
|
|
|
for mod in ${depends//,/ }
|
|
|
|
do
|
|
|
|
match=$(grep "^$mod.ko" "$ListName")
|
|
|
|
[ -z "$match" ] && continue
|
|
|
|
# check if the module we are looking at is in mod-* too.
|
|
|
|
# if so we do not need to mark the dep as required.
|
2020-11-04 02:27:34 +00:00
|
|
|
mod2=${dep##*/} # same as $(basename $dep), but faster
|
2020-03-31 17:22:24 +00:00
|
|
|
match2=$(grep "^$mod2" "$ListName")
|
|
|
|
if [ -n "$match2" ]
|
|
|
|
then
|
|
|
|
#echo $mod2 >> notreq.list
|
|
|
|
continue
|
|
|
|
fi
|
2020-11-04 02:27:34 +00:00
|
|
|
echo "$mod".ko >> req.list
|
2020-03-31 17:22:24 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
foreachp()
|
|
|
|
{
|
|
|
|
P=$(nproc)
|
|
|
|
bgcount=0
|
2020-11-04 02:27:34 +00:00
|
|
|
while read -r mod; do
|
2020-03-31 17:22:24 +00:00
|
|
|
$1 "$mod" &
|
|
|
|
|
|
|
|
bgcount=$((bgcount + 1))
|
2020-11-04 02:27:34 +00:00
|
|
|
if [ $bgcount -eq "$P" ]; then
|
2020-03-31 17:22:24 +00:00
|
|
|
wait -n
|
|
|
|
bgcount=$((bgcount - 1))
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
wait
|
|
|
|
}
|
|
|
|
|
2019-07-22 22:01:03 +00:00
|
|
|
# Destination was specified on the command line
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
test -n "$4" && echo "$0: Override Destination $Dest has been specified."
|
2019-07-22 22:01:03 +00:00
|
|
|
|
2020-11-04 02:27:34 +00:00
|
|
|
pushd "$Dir"
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
|
2020-11-04 02:27:34 +00:00
|
|
|
OverrideDir=$(basename "$List")
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
OverrideDir=${OverrideDir%.*}
|
|
|
|
OverrideDir=${OverrideDir#*-}
|
2020-11-04 02:27:34 +00:00
|
|
|
mkdir -p "$OverrideDir"
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
|
2019-07-22 22:01:03 +00:00
|
|
|
rm -rf modnames
|
|
|
|
find . -name "*.ko" -type f > modnames
|
|
|
|
# Look through all of the modules, and throw any that have a dependency in
|
|
|
|
# our list into the list as well.
|
|
|
|
rm -rf dep.list dep2.list
|
|
|
|
rm -rf req.list req2.list
|
|
|
|
touch dep.list req.list
|
|
|
|
cp "$List" .
|
|
|
|
|
|
|
|
# This variable needs to be exported because it is used in sub-script
|
|
|
|
# executed by xargs
|
2020-11-04 02:27:34 +00:00
|
|
|
ListName=$(basename "$List")
|
|
|
|
export ListName
|
2019-07-22 22:01:03 +00:00
|
|
|
|
2020-03-31 17:22:24 +00:00
|
|
|
foreachp find_depends < modnames
|
2019-07-22 22:01:03 +00:00
|
|
|
|
|
|
|
sort -u req.list > req2.list
|
|
|
|
sort -u "$ListName" > modules2.list
|
|
|
|
join -v 1 modules2.list req2.list > modules3.list
|
|
|
|
|
2020-11-04 02:27:34 +00:00
|
|
|
while IFS= read -r mod
|
2019-07-22 22:01:03 +00:00
|
|
|
do
|
2020-11-04 02:27:34 +00:00
|
|
|
# get the path for the module
|
|
|
|
modpath=$(grep /"$mod" modnames)
|
|
|
|
[ -z "$modpath" ] && continue
|
|
|
|
echo "$modpath" >> dep.list
|
|
|
|
done < modules3.list
|
2019-07-22 22:01:03 +00:00
|
|
|
|
|
|
|
sort -u dep.list > dep2.list
|
|
|
|
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
if [ -n "$Dest" ]; then
|
2020-11-04 02:27:34 +00:00
|
|
|
# now move the modules into the $Dest directory
|
|
|
|
while IFS= read -r mod
|
|
|
|
do
|
|
|
|
newpath=$(dirname "$mod" | sed -e "s/kernel\\//$Dest\//")
|
|
|
|
mkdir -p "$newpath"
|
|
|
|
mv "$mod" "$newpath"
|
|
|
|
echo "$mod" | sed -e "s/kernel\\//$Dest\//" | sed -e "s|^.|${ModDir}|g" >> "$RpmDir"/"$ListName"
|
|
|
|
done < dep2.list
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
fi
|
2019-07-22 22:01:03 +00:00
|
|
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
# If we're signing modules, we can't leave the .mod files for the .ko files
|
|
|
|
# we've moved in .tmp_versions/. Remove them so the Kbuild 'modules_sign'
|
|
|
|
# target doesn't try to sign a non-existent file. This is kinda ugly, but
|
2020-03-31 17:22:23 +00:00
|
|
|
# so are the modules-* packages.
|
2019-07-22 22:01:03 +00:00
|
|
|
|
2020-11-04 02:27:34 +00:00
|
|
|
while IFS= read -r mod
|
2019-07-22 22:01:03 +00:00
|
|
|
do
|
2020-11-04 02:27:34 +00:00
|
|
|
modfile=$(basename "$mod" | sed -e 's/.ko/.mod/')
|
|
|
|
rm .tmp_versions/"$modfile"
|
|
|
|
done < "$Dir"/dep2.list
|
2019-07-22 22:01:03 +00:00
|
|
|
|
2020-11-04 02:27:34 +00:00
|
|
|
if [ -z "$Dest" ]; then
|
|
|
|
sed -e "s|^.|${ModDir}|g" "$Dir"/dep2.list > "$RpmDir/$ListName"
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
echo "./$RpmDir/$ListName created."
|
|
|
|
[ -d "$RpmDir/etc/modprobe.d/" ] || mkdir -p "$RpmDir/etc/modprobe.d/"
|
2020-11-04 02:27:34 +00:00
|
|
|
foreachp check_blacklist < "$List"
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
fi
|
|
|
|
|
2020-03-31 17:26:17 +00:00
|
|
|
# Many BIOS-es export a PNP-id which causes the floppy driver to autoload
|
|
|
|
# even though most modern systems don't have a 3.5" floppy driver anymore
|
|
|
|
# this replaces the old die_floppy_die.patch which removed the PNP-id from
|
|
|
|
# the module
|
2020-11-04 02:27:34 +00:00
|
|
|
|
2021-03-27 13:41:11 +00:00
|
|
|
floppylist=("$RpmDir"/"$ModDir"/kernel/drivers/block/floppy.ko*)
|
2020-11-04 02:27:34 +00:00
|
|
|
if [[ -n ${floppylist[0]} && -f ${floppylist[0]} ]]; then
|
|
|
|
blacklist "floppy"
|
2020-03-31 17:26:17 +00:00
|
|
|
fi
|
|
|
|
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
# avoid an empty kernel-extra package
|
2020-11-04 02:27:34 +00:00
|
|
|
echo "$ModDir/$OverrideDir" >> "$RpmDir/$ListName"
|
kernel packaging: Fix extra namespace collision
commit b2819ae00d4cd6380e1151dd0628f32e19a85d6f
Author: Prarit Bhargava <prarit@redhat.com>
Date: Fri Jun 7 18:00:37 2019 -0400
[rpmspec] kernel packaging: Fix extra namespace collision
Message-id: <20190607180038.20685-4-prarit@redhat.com>
Patchwork-id: 263188
O-Subject: [RHEL8.1 BZ 1699868 v4 3/4] kernel packaging: Fix extra namespace collision
Bugzilla: 1699868
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Laura Abbott <labbott@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1699868
The kernel-modules-extra package collides with the 3rd party driver
location, /lib/modules/'uname -r'/extra. When the kernel-modules-extra
package has already been installed and a new kernel is installed, the
result is a significant increase to the install time of a kernel and the
wrong kernel modules being loaded into the new kernel.
The /lib/modules/'uname -r'/extra directory is designated as a spot
where 3rd party vendors can place their out-of-box drivers. When a new
kernel is installed (specifically the kernel-core package) a call is
made to /usr/sbin/weak-modules (from the kmod package) to examine
drivers in the previously installed kernels' extra directories to bring
those drivers forward into the new kernel.
The kernel-modules-extra package installs modules into the /extra
directory. As a result, when /usr/sbin/weak-modules is executed it
brings the modules from kernel-modules-extra forward into the new kernel
as well. This is a critical mistake as the wrong modules have now been
brought forward. Additionally, /usr/sbin/weak-modules takes longer to
execute every time a new kernel is installed. After five kernels are
installed the time to install the kernel-core package climbs to
approximately 10 minutes.
After some code investigation and discussion with the authors of the
original Fedora code, and input from Herton, this can be avoided by
installing the kernel-modules-extra modules to their original
directories in 8.0.z.
The existing build process copies all the modules into a temporary area
called restore, and leaving the original modules directory as a work
area. The modules listed in mod-extra.list are copied to extra/ and
removed from the work area, and core.list and modules.list files are
created. The restore area is then copied back, and the rpm build
process continues.
My changes create a mod-extra.list and a mod-internal.list (similar to
core.list and modules.list), and remove the files from the work area so
that the core.list and modules.list can be created. The list files are
used later on to create dynamic %files sections for the subpackages.
Remove the /lib/modules/'uname -r'/extra installation path from
the kernel-modules-extra package and install the modules in their
original directories.
v4: Make modules-internal.list and modules-extra.list use consistent (mleitner).
Fix cat usage in spec file and scripts (jbenc).
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Herton R. Krzesinski <herton@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Marcelo Leitner <mleitner@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2020-03-31 17:22:23 +00:00
|
|
|
|
2020-11-04 02:27:34 +00:00
|
|
|
pushd "$Dir"
|
2019-07-22 22:01:03 +00:00
|
|
|
rm modnames dep.list dep2.list req.list req2.list
|
|
|
|
rm "$ListName" modules2.list modules3.list
|
|
|
|
popd
|