create-menu 4.4 KB

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