blob: 8acb3a858edd0463568f7372db8415f0a19b93f6 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Wrapper script for the Linux kernel module dependency indexer"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4
5S = "${WORKDIR}"
6
7INHIBIT_DEFAULT_DEPS = "1"
8# The kernel and the staging dir for it is machine specific
9PACKAGE_ARCH = "${MACHINE_ARCH}"
10
11# We need the following for the sstate code to process the wrapper
12SSTATE_SCAN_FILES += "depmodwrapper"
13
14do_install() {
15 install -d ${D}${bindir_crossscripts}/
16
17 cat > ${D}${bindir_crossscripts}/depmodwrapper << EOF
18#!/bin/sh
19# Expected to be called as: depmodwrapper -a KERNEL_VERSION
20if [ "\$1" != "-a" -o "\$2" != "-b" ]; then
21 echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2
22 exit 1
23fi
24if [ ! -r ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion ]; then
25 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" >&2
26else
27 kernelabi=\$(cat ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion)
28 if [ "\$kernelabi" != "\$4" ]; then
29 echo "Error: Kernel version \$4 does not match kernel-abiversion (\$kernelabi)" >&2
30 exit 1
31 fi
32fi
33
34if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ]; then
35 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2
36 exec env depmod "\$1" "\$2" "\$3" "\$4"
37else
38 exec env depmod "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/kernel-depmod/System.map-\$4" "\$4"
39fi
40EOF
41 chmod +x ${D}${bindir_crossscripts}/depmodwrapper
42}
43
44SYSROOT_PREPROCESS_FUNCS += "depmodwrapper_sysroot_preprocess"
45
46depmodwrapper_sysroot_preprocess () {
47 sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts}
48}