libpayload 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/usr/bin/env bash
  2. # Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. arguments() {
  17. project_arguments_targets "$project" "$@"
  18. }
  19. usage() {
  20. project_usage_actions "$project"
  21. project_usage_arguments "$project" "$@"
  22. }
  23. build() {
  24. local repository="coreboot"
  25. project_sources_directory_missing_empty_error "$project" "$repository" "$@"
  26. if git_project_check $repository
  27. then
  28. git_project_checkout "$repository" "$repository" "$@"
  29. fi
  30. local coreboot_sources_path=$(project_sources_path "$repository" "$repository" "$@")
  31. local sources_path="$coreboot_sources_path/payloads/libpayload/"
  32. local build_path=$(project_build_path "$project" "$@")
  33. local build_install_path="$build_path/install"
  34. local config_name=$(libpayload_config "$@")
  35. local config_path="$sources_path/configs/$config_name"
  36. local arch=$(libpayload_arch "$@")
  37. local crossgcc_build_path=$(project_build_path "crossgcc" "$arch")
  38. local crossgcc_bin_path="$crossgcc_build_path/bin/"
  39. rm -f "$sources_path/.xcompile"
  40. mkdir -p "$build_path"
  41. make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" KBUILD_DEFCONFIG="$config_path" "defconfig"
  42. make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" -j$TASKS
  43. make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" DESTDIR="$build_install_path" "install"
  44. rm -f "$sources_path/.xcompile"
  45. }
  46. build_check() {
  47. project_build_check "$project" "$@"
  48. }
  49. clean() {
  50. project_clean "$project" "$@"
  51. }