184 lines
5.1 KiB
Diff
184 lines
5.1 KiB
Diff
diff --git a/debian/control b/debian/control
|
|
index 76a5627..70b8ff4 100644
|
|
--- a/debian/control
|
|
+++ b/debian/control
|
|
@@ -29,7 +29,6 @@ Multi-Arch: foreign
|
|
Recommends: zstd, ${busybox:Recommends}
|
|
Depends: coreutils (>= 8.24),
|
|
cpio (>= 2.12),
|
|
- dracut-install,
|
|
klibc-utils (>= 2.0.4-8~),
|
|
kmod,
|
|
logsave | e2fsprogs (<< 1.45.3-1~),
|
|
diff --git a/hook-functions b/hook-functions
|
|
index 7fccf0e..1ad074c 100644
|
|
--- a/hook-functions
|
|
+++ b/hook-functions
|
|
@@ -93,35 +93,47 @@ add_firmware()
|
|
# Call apply_add_modules to copy the kernel modules.
|
|
manual_add_modules()
|
|
{
|
|
- for module in "$@"; do
|
|
- echo "$module" >> "$__MODULES_TO_ADD"
|
|
- done
|
|
-}
|
|
-
|
|
-# Copy the kernel modules that were marked in manual_add_modules
|
|
-apply_add_modules()
|
|
-{
|
|
- # shellcheck disable=SC2046
|
|
- _call_dracut_install $(sort -u "$__MODULES_TO_ADD")
|
|
- true > "$__MODULES_TO_ADD"
|
|
-}
|
|
-
|
|
-_call_dracut_install()
|
|
-{
|
|
- local dracut_verbose fw_path_para
|
|
+ local prefix kmod options firmware
|
|
|
|
if [ $# -eq 0 ]; then
|
|
return
|
|
fi
|
|
|
|
- if [ "${verbose?}" = "y" ]; then
|
|
- dracut_verbose=-v
|
|
- fi
|
|
+ # modprobe --ignore-install inhibits processing of 'install'
|
|
+ # configuration lines, so that instead we will see 'insmod
|
|
+ # module.ko' as we want. However it also means that 'softdep'
|
|
+ # configuration lines and embedded softdep information is not
|
|
+ # processed. So we run twice, with and without this option.
|
|
+ # shellcheck disable=SC2034
|
|
+ { /sbin/modprobe --all --set-version="${version?}" --ignore-install --quiet --show-depends "$@";
|
|
+ /sbin/modprobe --all --set-version="${version}" --quiet --show-depends "$@"; } |
|
|
+ while read -r prefix kmod options ; do
|
|
+ if [ "${prefix}" != "insmod" ]; then
|
|
+ continue
|
|
+ fi
|
|
|
|
- read -r fw_path_para < /sys/module/firmware_class/parameters/path
|
|
- /usr/lib/dracut/dracut-install -D "$DESTDIR" --kerneldir "/lib/modules/${version?}" \
|
|
- --firmwaredirs "${fw_path_para:+${fw_path_para}:}/lib/firmware/updates/${version?}:/lib/firmware/updates:/lib/firmware/${version?}:/lib/firmware" \
|
|
- ${dracut_verbose-} -o -m "$@"
|
|
+ copy_file module "${kmod}" || continue
|
|
+
|
|
+ # Add required firmware
|
|
+ for firmware in $(modinfo -k "${version}" -F firmware "${kmod}"); do
|
|
+ # Only print warning for missing fw of loaded module
|
|
+ # or forced loaded module
|
|
+ if ! add_firmware "$firmware"; then
|
|
+ # Only warn about missing firmware if
|
|
+ # /proc/modules exists
|
|
+ if [ ! -e /proc/modules ] ; then
|
|
+ continue
|
|
+ fi
|
|
+
|
|
+ kmod_modname="${kmod##*/}"
|
|
+ kmod_modname="${kmod_modname%%.*}"
|
|
+ if grep -q "^$kmod_modname\\>" /proc/modules "${CONFDIR}/modules"; then
|
|
+ echo "W: Possible missing firmware /lib/firmware/${firmware} for module ${kmod_modname}" >&2
|
|
+ fi
|
|
+ continue
|
|
+ fi
|
|
+ done
|
|
+ done
|
|
}
|
|
|
|
# manual_add_modules() takes care of adding firmware for things that were built
|
|
@@ -795,72 +807,6 @@ auto_add_modules()
|
|
manual_add_modules $modules
|
|
}
|
|
|
|
-# 'depmod' only looks at symbol dependencies and the 'softdep' module
|
|
-# information field; there is no way for modules to declare weaker
|
|
-# dependencies (modules that *might* be needed at run-time) through
|
|
-# module information, Until this is fixed, we need to handle those
|
|
-# hidden dependencies.
|
|
-hidden_dep_add_modules()
|
|
-{
|
|
- # shellcheck disable=SC2046
|
|
- _call_dracut_install $(
|
|
- {
|
|
- cat "${DESTDIR}/lib/modules/${version}/modules.builtin"
|
|
- if [ -d "${DESTDIR}/lib/modules/${version}/kernel" ]; then
|
|
- find "${DESTDIR}/lib/modules/${version}/kernel" -name '*.ko*'
|
|
- fi
|
|
- } |
|
|
- while read -r module; do
|
|
- module="${module##*/}"
|
|
- module="${module%%.*}"
|
|
- case "$module" in
|
|
- libcrc32c)
|
|
- echo crc32c
|
|
- ;;
|
|
- ubifs)
|
|
- echo deflate zlib lzo
|
|
- ;;
|
|
- btrfs)
|
|
- echo crc32c
|
|
- ;;
|
|
- f2fs)
|
|
- echo crc32
|
|
- ;;
|
|
- mlx4_core)
|
|
- echo mlx4_ib
|
|
- ;;
|
|
- mlx5_core)
|
|
- echo mlx5_ib
|
|
- ;;
|
|
- i8042)
|
|
- echo psmouse
|
|
- ;;
|
|
- nvme)
|
|
- echo vmd
|
|
- ;;
|
|
- spi-rockchip)
|
|
- echo pl330
|
|
- ;;
|
|
- dw_mmc-rockchip)
|
|
- echo rockchip-io-domain io-domain
|
|
- ;;
|
|
- mediatek-drm)
|
|
- echo mediatek-drm-hdmi mtk_iommu mtk-smi
|
|
- ;;
|
|
- mtk_iommu)
|
|
- echo mtk-smi
|
|
- ;;
|
|
- phy-mtk-mipi-dsi-drv)
|
|
- echo nvmem_mtk-efuse
|
|
- ;;
|
|
- mt6397)
|
|
- echo mtk-pmic-wrap
|
|
- ;;
|
|
- esac
|
|
- done
|
|
- )
|
|
-}
|
|
-
|
|
# Find the source for a script file. This is needed to work around
|
|
# temporary directories mounted with the noexec option. The source
|
|
# will be on / or /usr which must be executable.
|
|
diff --git a/mkinitramfs b/mkinitramfs
|
|
index 40e0fd1..bc90423 100755
|
|
--- a/mkinitramfs
|
|
+++ b/mkinitramfs
|
|
@@ -424,7 +424,6 @@ for file in /etc/modprobe.d/*.conf /lib/modprobe.d/*.conf ; do
|
|
done
|
|
|
|
# Copy kernel modules here, because some hooks rely on them being copied
|
|
-apply_add_modules
|
|
run_scripts /usr/share/initramfs-tools/hooks
|
|
run_scripts "${CONFDIR}"/hooks
|
|
|
|
@@ -433,10 +432,6 @@ for b in $(cd "${DESTDIR}/scripts" && find . -mindepth 1 -type d); do
|
|
cache_run_scripts "${DESTDIR}" "/scripts/${b#./}"
|
|
done
|
|
|
|
-apply_add_modules
|
|
-# Resolve hidden dependencies
|
|
-hidden_dep_add_modules
|
|
-
|
|
# decompress modules for boot speed, if possible
|
|
find "${DESTDIR}/${MODULESDIR}" -name '*.ko.*' | while read -r ko; do
|
|
case "$ko" in
|