Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Wrapper script for the Linux kernel module dependency indexer" |
| 2 | LICENSE = "MIT" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 3 | |
| 4 | S = "${WORKDIR}" |
| 5 | |
| 6 | INHIBIT_DEFAULT_DEPS = "1" |
| 7 | # The kernel and the staging dir for it is machine specific |
| 8 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 9 | |
| 10 | # We need the following for the sstate code to process the wrapper |
| 11 | SSTATE_SCAN_FILES += "depmodwrapper" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 12 | EXTRA_STAGING_FIXMES += "PKGDATA_DIR" |
| 13 | |
| 14 | do_populate_sysroot[depends] = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 15 | |
| 16 | do_install() { |
| 17 | install -d ${D}${bindir_crossscripts}/ |
| 18 | |
| 19 | cat > ${D}${bindir_crossscripts}/depmodwrapper << EOF |
| 20 | #!/bin/sh |
| 21 | # Expected to be called as: depmodwrapper -a KERNEL_VERSION |
| 22 | if [ "\$1" != "-a" -o "\$2" != "-b" ]; then |
| 23 | echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2 |
| 24 | exit 1 |
| 25 | fi |
| 26 | if [ ! -r ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion ]; then |
| 27 | echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" >&2 |
| 28 | else |
| 29 | kernelabi=\$(cat ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion) |
| 30 | if [ "\$kernelabi" != "\$4" ]; then |
| 31 | echo "Error: Kernel version \$4 does not match kernel-abiversion (\$kernelabi)" >&2 |
| 32 | exit 1 |
| 33 | fi |
| 34 | fi |
| 35 | |
| 36 | if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ]; then |
| 37 | echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2 |
| 38 | exec env depmod "\$1" "\$2" "\$3" "\$4" |
| 39 | else |
| 40 | exec env depmod "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/kernel-depmod/System.map-\$4" "\$4" |
| 41 | fi |
| 42 | EOF |
| 43 | chmod +x ${D}${bindir_crossscripts}/depmodwrapper |
| 44 | } |
| 45 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 46 | SYSROOT_DIRS += "${bindir_crossscripts}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 47 | |
| 48 | inherit nopackages |