make-host.sh 726 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. # We can almost do everything from the Makefile itself by using default values for
  3. #
  4. # LINUX_DIR ?= "/lib/modules/$(uname -r)/build"
  5. # BR2_EXTERNAL_KERNEL_MODULE_PATH="$(pwd)"
  6. #
  7. # The problem with that is that if you define those variables in your environment,
  8. # the build breaks, so this is more portable.
  9. #
  10. # Trying to add `-i` to overcome incompatible modules will fail,
  11. # because any build failure prevents the generation of all `.mod.c` files.
  12. j="$(($(nproc) - 2))"
  13. while getopts j: OPT; do
  14. case "$OPT" in
  15. 'j')
  16. j="$OPTARG"
  17. ;;
  18. esac
  19. done
  20. shift $(($OPTIND - 1))
  21. make -j "$j" KERNEL_MODULE_PATH="$(pwd)" LINUX_DIR="/lib/modules/$(uname -r)/build" "$@"
  22. make -C user/ -j "$j" "$@"