1
0

create-menu 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/usr/bin/env bash
  2. # This file is part of the OpenADK project. OpenADK is copyrighted
  3. # material, please see the LICENCE file in the top-level directory.
  4. topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
  5. systems=$(grep -h config target/*/systems/*|cut -d " " -f 2)
  6. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch
  7. printf "source target/config/Config.in.arch.default\n" >> target/config/Config.in.arch
  8. printf "source target/config/Config.in.arch.choice\n" >> target/config/Config.in.arch
  9. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system
  10. printf "source target/config/Config.in.system.default\n" >> target/config/Config.in.system
  11. printf "source target/config/Config.in.system.choice\n" >> target/config/Config.in.system
  12. # update appliances
  13. if [ -d "$topdir/target/appliances" ];then
  14. printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.appliances
  15. printf "choice\n" >> $topdir/target/config/Config.in.appliances
  16. printf "prompt \"Appliance\"\n\n" >> $topdir/target/config/Config.in.appliances
  17. printf "config ADK_CHOOSE_APPLIANCE\n" >> $topdir/target/config/Config.in.appliances
  18. printf "\tprompt \"choose an appliance\"\n" >> $topdir/target/config/Config.in.appliances
  19. printf "\tbool\n\n" >> $topdir/target/config/Config.in.appliances
  20. cat $topdir/target/appliances/*.appliance >> $topdir/target/config/Config.in.appliances 2>/dev/null
  21. printf "\nendchoice\n\n" >> $topdir/target/config/Config.in.appliances
  22. printf "menu \"Appliance Options\"\n" >> $topdir/target/config/Config.in.appliances
  23. printf "\tvisible if !ADK_CHOOSE_APPLIANCE\n" >> $topdir/target/config/Config.in.appliances
  24. cat $topdir/target/appliances/*.options >> $topdir/target/config/Config.in.appliances 2>/dev/null
  25. printf "endmenu\n" >> $topdir/target/config/Config.in.appliances
  26. fi
  27. # create system default
  28. printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.system.default
  29. cat >> $topdir/target/config/Config.in.system.default << EOD
  30. config ADK_TARGET_SYSTEM
  31. string
  32. EOD
  33. for i in $systems;do
  34. system=${i#ADK_TARGET_SYSTEM_}
  35. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  36. system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
  37. system=$(echo $system|sed 's#x86-64#x86_64#')
  38. printf "\tdefault \"${system}\" if $i\n" >> $topdir/target/config/Config.in.system.default
  39. done
  40. # create or update systems
  41. for i in $(ls $topdir/target/);do
  42. if [ -d "$topdir/target/$i/systems" ];then
  43. cat $topdir/target/$i/systems/* > $topdir/target/$i/Config.in.systems 2>/dev/null
  44. fi
  45. done
  46. # create target/$arch/Config.in.arch and target/config/Config.in.system.choice
  47. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system.choice
  48. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch.default
  49. for arch in $(cat $topdir/target/arch.lst);do
  50. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  51. printf "choice\n" > $topdir/target/$arch/Config.in.arch
  52. printf "prompt \"Embedded system\"\n" >> $topdir/target/$arch/Config.in.arch
  53. printf "depends on ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/$arch/Config.in.arch
  54. printf "source target/$arch/Config.in.systems\n" >> $topdir/target/$arch/Config.in.arch
  55. printf "endchoice\n" >> $topdir/target/$arch/Config.in.arch
  56. printf "source target/$arch/Config.in.arch\n" >> target/config/Config.in.system.choice
  57. done
  58. cat >> $topdir/target/config/Config.in.arch.default << EOD
  59. config ADK_TARGET_ARCH
  60. string
  61. EOD
  62. for arch in $(cat $topdir/target/arch.lst);do
  63. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  64. printf "\tdefault \"$arch\" if ADK_TARGET_ARCH_$ARCH\n" >> target/config/Config.in.arch.default
  65. done
  66. cat > $topdir/target/config/Config.in.arch.choice << EOD
  67. # autogenerated via scripts/create-menu
  68. choice
  69. prompt "Architecture"
  70. EOD
  71. for arch in $(cat $topdir/target/arch.lst);do
  72. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  73. printf "config ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/config/Config.in.arch.choice
  74. printf "\tbool \"$arch system\"\n" >> $topdir/target/config/Config.in.arch.choice
  75. printf "\thelp\n" >> $topdir/target/config/Config.in.arch.choice
  76. printf "\t Support for $ARCH systems.\n\n" >> $topdir/target/config/Config.in.arch.choice
  77. done
  78. printf "endchoice\n" >> $topdir/target/config/Config.in.arch.choice
  79. exit 0