Files
meta-openwrt/classes/openwrt-kmods.bbclass
Marcus Comstedt a6a2f962db classes/kmods: assure kernel-abiversion exists
If the deploy and tmp directories were zapped but the sstate-cache
retained, it could happen that openwrt_flatten_modules_hook was run
without ${STAGING_KERNEL_BUILDDIR} ever being populated.  Add an
explicit dependency to fix that.  Also add a check that something
was actually read from the kernel-abiversion file.
2021-03-02 09:57:50 -08:00

17 lines
706 B
Plaintext

#/ This file Copyright (C) 2018 Daniel Dickinson <cshored@thecshore.com>
#
# It is released under the MIT license. See COPYING.MIT
# for the terms.
do_rootfs[depends] += " virtual/kernel:do_shared_workdir"
ROOTFS_POSTUNINSTALL_COMMAND_append = ' openwrt_flatten_modules_hook; '
openwrt_flatten_modules_hook () {
export KERNEL_VERSION="${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
[ -n "${KERNEL_VERSION}" ]
if [ -d "${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}" ]; then
cd ${IMAGE_ROOTFS} && find lib/modules/${KERNEL_VERSION} -name '*.ko' -exec sh -c 'mod="{}"; ln -sf /$mod ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/$(basename "$mod")' \;
fi
}