kernel/kernel-std/files/mod-extra-blacklist.sh
Jiping Ma 2cb3d041cd Upgrade to 5.10 Linux kernel.
Move to kernel version 5.10 using source from the Yocto Project.
1. Add STX patches for kernel 5.10.
2. Support git source for linux-yocto.
3. Add build_srpm from build-tools/default_build_srpm
   and modified for git repo from yocto
4. Modify std and rt config files.
5. Build python-perf instead of python3-perf for std kernel.
   python-perf is needed by tuned-2.8.0-5.el7.noarch.
6. Modify rt spec to build out package kernel-rt-tools and kernel-rt-kvm.
7. Add kernel-5.10.30-x86_64-rt.config.tis_extra and
   kernel-5.10.30-x86_64.config.tis_extra
8. Add a dist field to avoid undesired rebuilds.
9. Ensure -unsigned package is populated

Story: 2008921
Partial-Task: 42519

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Vefa Bicakci <vefa.bicakci@windriver.com>
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
Change-Id: Id1f635302f265826f7ff2860a3bed4b7755b2888
2021-07-26 02:40:01 -04:00

57 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
buildroot="$1"
kernel_base="$2"
blacklist()
{
cat > "$buildroot/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()
{
if modinfo "$1" | grep -q '^alias:\s\+net-'; then
mod="${1##*/}"
mod="${mod%.ko*}"
echo "$mod has an alias that allows auto-loading. Blacklisting."
blacklist "$mod"
fi
}
foreachp()
{
P=$(nproc)
bgcount=0
while read mod; do
$1 "$mod" &
bgcount=$((bgcount + 1))
if [ $bgcount -eq $P ]; then
wait -n
bgcount=$((bgcount - 1))
fi
done
wait
}
[ -d "$buildroot/etc/modprobe.d/" ] || mkdir -p "$buildroot/etc/modprobe.d/"
find "$buildroot/$kernel_base/extra" -name "*.ko*" | \
foreachp check_blacklist
# 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
if [ -f $buildroot/$kernel_base/extra/drivers/block/floppy.ko* ]; then
blacklist "floppy"
fi