xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1SUMMARY = "Wrapper script for the Linux kernel module dependency indexer"
2LICENSE = "MIT"
3
4S = "${WORKDIR}"
5
6INHIBIT_DEFAULT_DEPS = "1"
7# The kernel and the staging dir for it is machine specific
8PACKAGE_ARCH = "${MACHINE_ARCH}"
9
10# We need the following for the sstate code to process the wrapper
11SSTATE_SCAN_FILES += "depmodwrapper"
12EXTRA_STAGING_FIXMES += "PKGDATA_DIR"
13
14DEPENDS += "kmod-native"
15do_populate_sysroot[depends] = ""
16
17do_install() {
18	install -d ${D}${bindir_crossscripts}/
19
20	cat > ${D}${bindir_crossscripts}/depmodwrapper << EOF
21#!/bin/sh
22# Expected to be called as: depmodwrapper -a KERNEL_VERSION
23if [ "\$1" != "-a" -o "\$2" != "-b" ]; then
24    echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2
25    exit 1
26fi
27
28kernelabi=""
29if [ -r "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" ]; then
30    kernelabi=\$(cat "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion")
31fi
32
33if [ ! -e "\$3${nonarch_base_libdir}/depmod.d/exclude.conf" ]; then
34    mkdir -p "\$3${nonarch_base_libdir}/depmod.d"
35    echo "exclude .debug" > "\$3${nonarch_base_libdir}/depmod.d/exclude.conf"
36fi
37
38if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then
39    echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2
40    exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" "\$4"
41else
42    exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/kernel-depmod/System.map-\$4" "\$4"
43fi
44EOF
45	chmod +x ${D}${bindir_crossscripts}/depmodwrapper
46}
47
48SYSROOT_DIRS += "${bindir_crossscripts}"
49
50PACKAGES = ""
51inherit nopackages
52