preserve kernel module structure

This commit is contained in:
Tobias Powalowski 2022-03-17 07:46:37 +01:00
parent e98c2ef714
commit 6d20bae5c5

View file

@ -1,4 +1,4 @@
#!/bin/bash # #!/bin/bash
parseopts() { parseopts() {
local opt= optarg= i= shortopts=$1 local opt= optarg= i= shortopts=$1
@ -870,19 +870,13 @@ install_modules() {
warning "No modules were added to the image. This is probably not what you want." warning "No modules were added to the image. This is probably not what you want."
return 0 return 0
fi fi
for i in "$@"; do
cp "$@" "$moduledest/kernel" install -D -m644 "$i" "$BUILDROOT"
done
msg "Generating module dependencies" msg "Generating module dependencies"
install -m644 -t "$moduledest" "$_d_kmoduledir"/modules.builtin install -m644 -t "$moduledest" "$_d_kmoduledir"/modules.builtin
# we install all modules into kernel/, making the .order file incorrect for
# the module tree. munge it, so that we have an accurate index. This avoids
# some rare and subtle issues with module loading choices when an alias
# resolves to multiple modules, only one of which can claim a device.
awk -F'/' '{ print "kernel/" $NF }' \
"$_d_kmoduledir"/modules.order >"$moduledest/modules.order"
depmod -b "$BUILDROOT" "$KERNELVERSION" depmod -b "$BUILDROOT" "$KERNELVERSION"
# remove all non-binary module.* files (except devname for on-demand module loading) # remove all non-binary module.* files (except devname for on-demand module loading)