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" |
| 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
| 4 | |
| 5 | S = "${WORKDIR}" |
| 6 | |
| 7 | INHIBIT_DEFAULT_DEPS = "1" |
| 8 | # The kernel and the staging dir for it is machine specific |
| 9 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 10 | |
| 11 | # We need the following for the sstate code to process the wrapper |
| 12 | SSTATE_SCAN_FILES += "depmodwrapper" |
| 13 | |
| 14 | do_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 |
| 20 | if [ "\$1" != "-a" -o "\$2" != "-b" ]; then |
| 21 | echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2 |
| 22 | exit 1 |
| 23 | fi |
| 24 | if [ ! -r ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion ]; then |
| 25 | echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" >&2 |
| 26 | else |
| 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 |
| 32 | fi |
| 33 | |
| 34 | if [ ! -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" |
| 37 | else |
| 38 | exec env depmod "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/kernel-depmod/System.map-\$4" "\$4" |
| 39 | fi |
| 40 | EOF |
| 41 | chmod +x ${D}${bindir_crossscripts}/depmodwrapper |
| 42 | } |
| 43 | |
| 44 | SYSROOT_PREPROCESS_FUNCS += "depmodwrapper_sysroot_preprocess" |
| 45 | |
| 46 | depmodwrapper_sysroot_preprocess () { |
| 47 | sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts} |
| 48 | } |