depmodwrapper-cross_1.0.bb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. SUMMARY = "Wrapper script for the Linux kernel module dependency indexer"
  2. LICENSE = "MIT"
  3. S = "${WORKDIR}"
  4. INHIBIT_DEFAULT_DEPS = "1"
  5. # The kernel and the staging dir for it is machine specific
  6. PACKAGE_ARCH = "${MACHINE_ARCH}"
  7. # We need the following for the sstate code to process the wrapper
  8. SSTATE_SCAN_FILES += "depmodwrapper"
  9. EXTRA_STAGING_FIXMES += "PKGDATA_DIR"
  10. DEPENDS += "kmod-native"
  11. do_populate_sysroot[depends] = ""
  12. do_install() {
  13. install -d ${D}${bindir_crossscripts}/
  14. cat > ${D}${bindir_crossscripts}/depmodwrapper << EOF
  15. #!/bin/sh
  16. # Expected to be called as: depmodwrapper -a KERNEL_VERSION
  17. if [ "\$1" != "-a" -o "\$2" != "-b" ]; then
  18. echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2
  19. exit 1
  20. fi
  21. kernelabi=""
  22. if [ -r "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" ]; then
  23. kernelabi=\$(cat "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion")
  24. fi
  25. if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then
  26. echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2
  27. exec env depmod "\$1" "\$2" "\$3" "\$4"
  28. else
  29. exec env depmod "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/kernel-depmod/System.map-\$4" "\$4"
  30. fi
  31. EOF
  32. chmod +x ${D}${bindir_crossscripts}/depmodwrapper
  33. }
  34. SYSROOT_DIRS += "${bindir_crossscripts}"
  35. PACKAGES = ""
  36. inherit nopackages