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 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 14 | DEPENDS += "kmod-native" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 15 | do_populate_sysroot[depends] = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | |
| 17 | do_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 |
| 23 | if [ "\$1" != "-a" -o "\$2" != "-b" ]; then |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 24 | echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION [KERNEL_PACKAGE_NAME]" >&2 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 25 | exit 1 |
| 26 | fi |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 27 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 28 | kernelpkgname="kernel" |
| 29 | # If no KERNEL_PACKAGE_NAME, assume "kernel". |
| 30 | [ -z "\$5" ] || kernelpkgname="\$5" |
| 31 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 32 | kernelabi="" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 33 | if [ -r "${PKGDATA_DIR}/\${kernelpkgname}-depmod/\${kernelpkgname}-abiversion" ]; then |
| 34 | kernelabi=\$(cat "${PKGDATA_DIR}/\${kernelpkgname}-depmod/\${kernelpkgname}-abiversion") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | fi |
| 36 | |
Patrick Williams | de0582f | 2022-04-08 10:23:27 -0500 | [diff] [blame] | 37 | if [ ! -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" |
| 40 | fi |
| 41 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 42 | if [ ! -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 Williams | de0582f | 2022-04-08 10:23:27 -0500 | [diff] [blame] | 44 | exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" "\$4" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | else |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 46 | exec env depmod -C "\$3${nonarch_base_libdir}/depmod.d" "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/\${kernelpkgname}-depmod/System.map-\$4" "\$4" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | fi |
| 48 | EOF |
| 49 | chmod +x ${D}${bindir_crossscripts}/depmodwrapper |
| 50 | } |
| 51 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 52 | SYSROOT_DIRS += "${bindir_crossscripts}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 53 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 54 | PACKAGES = "" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 55 | inherit nopackages |