libpayload 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/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=$( libpayload_config "$@" )
  35. local config_path="configs/$config"
  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. project_action "build" "crossgcc" "$arch"
  40. rm -f "$sources_path/.xcompile"
  41. mkdir -p "$build_path"
  42. make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" KBUILD_DEFCONFIG="$config_path" "defconfig"
  43. make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" -j$TASKS
  44. make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" DESTDIR="$build_install_path" "install"
  45. rm -f "$sources_path/.xcompile"
  46. }
  47. build_check() {
  48. project_build_check "$project" "$@"
  49. }
  50. clean() {
  51. project_clean "$project" "$@"
  52. }