blob: 6c0739d64fc5168422529ef3de65caab4bc6e289 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Wrapper script for the Linux kernel module dependency indexer"
2LICENSE = "MIT"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05003
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"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050012EXTRA_STAGING_FIXMES += "PKGDATA_DIR"
13
Brad Bishop316dfdd2018-06-25 12:45:53 -040014DEPENDS += "kmod-native"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015do_populate_sysroot[depends] = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016
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
Andrew Geissler87f5cff2022-09-30 13:13:31 -050024 echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION [KERNEL_PACKAGE_NAME]" >&2
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025 exit 1
26fi
Brad Bishop316dfdd2018-06-25 12:45:53 -040027
Andrew Geissler87f5cff2022-09-30 13:13:31 -050028kernelpkgname="kernel"
29# If no KERNEL_PACKAGE_NAME, assume "kernel".
30[ -z "\$5" ] || kernelpkgname="\$5"
31
Brad Bishop316dfdd2018-06-25 12:45:53 -040032kernelabi=""
Andrew Geissler87f5cff2022-09-30 13:13:31 -050033if [ -r "${PKGDATA_DIR}/\${kernelpkgname}-depmod/\${kernelpkgname}-abiversion" ]; then
34 kernelabi=\$(cat "${PKGDATA_DIR}/\${kernelpkgname}-depmod/\${kernelpkgname}-abiversion")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035fi
36
Patrick Williamsde0582f2022-04-08 10:23:27 -050037if [ ! -e "\$3${nonarch_base_libdir}/depmod.d/exclude.conf" ]; then
38 mkdir -p "\$3${nonarch_base_libdir}/depmod.d"
39 echo "exclude .debug" > "\$3${nonarch_base_libdir}/depmod.d/exclude.conf"
40fi
41
Andrew Geissler87f5cff2022-09-30 13:13:31 -050042if [ ! -r ${PKGDATA_DIR}/\${kernelpkgname}-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then
43 echo "Unable to read: ${PKGDATA_DIR}/\${kernelpkgname}-depmod/System.map-\$4" >&2
Patrick Williamsde0582f2022-04-08 10:23:27 -050044 exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" "\$4"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045else
Andrew Geissler87f5cff2022-09-30 13:13:31 -050046 exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/\${kernelpkgname}-depmod/System.map-\$4" "\$4"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047fi
48EOF
49 chmod +x ${D}${bindir_crossscripts}/depmodwrapper
50}
51
Patrick Williamsc0f7c042017-02-23 20:41:17 -060052SYSROOT_DIRS += "${bindir_crossscripts}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050053
Brad Bishop316dfdd2018-06-25 12:45:53 -040054PACKAGES = ""
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050055inherit nopackages