OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.6 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: lib/boot/boot.in
  5. # Copyright (C) 2008 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- SDE-COPYRIGHT-NOTE-END ---
  14. # by default we will peek the first suitable bootloader found
  15. #
  16. boot_choose_bootloader() { head -n 1; }
  17. # variables
  18. #
  19. bootloader=
  20. # load stuff from the architecture, if anything to load.
  21. [ ! -s "architecture/$arch/boot.in" ] || . "architecture/$arch/boot.in"
  22. # and allow targets to overload these functions and variables
  23. [ ! -s "target/$target/boot.in" ] || . "target/$target/boot.in"
  24. # if the target didn't choose one already, find the suitables and choose one
  25. if [ -z "$bootloader" ]; then
  26. bootloader="$(
  27. ls -1d `sed -n -e 's,^X [^ ]\+ [^ ]\+ \([^ ]\+\) \([^ ]\+\) .* BOOT .*,package/\1/\2/boot/boot.in,p' \
  28. "config/$config/packages"` 2> /dev/null |
  29. cut -d/ -f'2,3' | boot_choose_bootloader )"
  30. fi
  31. # validate the module, and source.
  32. #
  33. if [ -z "$bootloader" ]; then
  34. echo_error "boot: couldn't find any suitable bootloader."
  35. exit 1
  36. elif [ ! -e "package/$bootloader/boot/boot.in" ]; then
  37. echo_error "boot: '$bootloader' is not suitable."
  38. else
  39. echo_status "boot: using $bootloader."
  40. fi
  41. . "package/$bootloader/boot/boot.in"