1
0

create-menu 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 "\tboolean\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. for j in $systems;do
  30. system=${j#ADK_TARGET_SYSTEM_}
  31. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  32. printf "config ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
  33. printf "\tboolean\n\n" >> $topdir/target/config/Config.in.system.default
  34. done
  35. cat >> $topdir/target/config/Config.in.system.default << EOD
  36. config ADK_TARGET_SYSTEM
  37. string
  38. EOD
  39. for i in $systems;do
  40. system=${i#ADK_TARGET_SYSTEM_}
  41. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  42. system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
  43. system=$(echo $system|sed 's#x86-64#x86_64#')
  44. printf "\tdefault \"${system}\" if ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
  45. done
  46. # create or update systems
  47. for i in $(ls $topdir/target/);do
  48. if [ -d "$topdir/target/$i/systems" ];then
  49. cat $topdir/target/$i/systems/* > $topdir/target/$i/Config.in.systems 2>/dev/null
  50. fi
  51. done
  52. # create target/$arch/Config.in.arch and target/config/Config.in.system.choice
  53. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system.choice
  54. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch.default
  55. for arch in $(cat $topdir/target/arch.lst);do
  56. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  57. printf "choice\n" > $topdir/target/$arch/Config.in.arch
  58. printf "prompt \"Embedded system\"\n" >> $topdir/target/$arch/Config.in.arch
  59. printf "depends on ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/$arch/Config.in.arch
  60. printf "source target/$arch/Config.in.systems\n" >> $topdir/target/$arch/Config.in.arch
  61. printf "endchoice\n" >> $topdir/target/$arch/Config.in.arch
  62. printf "source target/$arch/Config.in.arch\n" >> target/config/Config.in.system.choice
  63. printf "config ADK_$arch\n" >> target/config/Config.in.arch.default
  64. printf "\tboolean\n\n" >> target/config/Config.in.arch.default
  65. done
  66. cat >> $topdir/target/config/Config.in.arch.default << EOD
  67. config ADK_TARGET_ARCH
  68. string
  69. EOD
  70. for arch in $(cat $topdir/target/arch.lst);do
  71. printf "\tdefault \"$arch\" if ADK_$arch\n" >> target/config/Config.in.arch.default
  72. done
  73. cat > $topdir/target/config/Config.in.arch.choice << EOD
  74. # autogenerated via scripts/create-menu
  75. choice
  76. prompt "Architecture"
  77. EOD
  78. for arch in $(cat $topdir/target/arch.lst);do
  79. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  80. printf "config ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/config/Config.in.arch.choice
  81. printf "\tprompt \"$arch system\"\n" >> $topdir/target/config/Config.in.arch.choice
  82. printf "\tboolean\n" >> $topdir/target/config/Config.in.arch.choice
  83. printf "\tselect ADK_$arch\n" >> $topdir/target/config/Config.in.arch.choice
  84. printf "\thelp\n" >> $topdir/target/config/Config.in.arch.choice
  85. printf "\t Support for $ARCH systems.\n\n" >> $topdir/target/config/Config.in.arch.choice
  86. done
  87. printf "endchoice\n" >> $topdir/target/config/Config.in.arch.choice
  88. exit 0