create-menu 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
  4. systems=$(grep -h config target/*/systems/*|cut -d " " -f 2)
  5. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch
  6. printf "source target/config/Config.in.arch.default\n" >> target/config/Config.in.arch
  7. printf "source target/config/Config.in.arch.choice\n" >> target/config/Config.in.arch
  8. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system
  9. printf "source target/config/Config.in.system.default\n" >> target/config/Config.in.system
  10. printf "source target/config/Config.in.system.choice\n" >> target/config/Config.in.system
  11. # update tasks
  12. if [ -d "$topdir/tasks" ];then
  13. printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.tasks
  14. printf "menu \"Tasks\"\n" >> $topdir/target/config/Config.in.tasks
  15. printf "\tvisible if ADK_TARGET_OS_LINUX && !ADK_TARGET_CHOOSE_ARCH\n\n" >> $topdir/target/config/Config.in.tasks
  16. cat $topdir/tasks/* >> $topdir/target/config/Config.in.tasks 2>/dev/null
  17. printf "\nendmenu\n\n" >> $topdir/target/config/Config.in.tasks
  18. fi
  19. # create system default
  20. printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.system.default
  21. cat >> $topdir/target/config/Config.in.system.default << EOD
  22. config ADK_TARGET_SYSTEM
  23. string
  24. EOD
  25. for i in $systems;do
  26. system=${i#ADK_TARGET_SYSTEM_}
  27. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  28. system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
  29. system=$(echo $system|sed 's#x86-64#x86_64#')
  30. printf "\tdefault \"${system}\" if $i\n" >> $topdir/target/config/Config.in.system.default
  31. done
  32. # create or update systems
  33. for arch in $(cat $topdir/target/arch.lst);do
  34. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  35. printf "config ADK_TARGET_SYSTEM_GENERIC_$ARCH\n" > $topdir/target/$arch/Config.in.systems
  36. printf "\tbool \"Generic\"\n" >> $topdir/target/$arch/Config.in.systems
  37. printf "\tselect ADK_TARGET_GENERIC\n" >> $topdir/target/$arch/Config.in.systems
  38. printf "\thelp\n" >> $topdir/target/$arch/Config.in.systems
  39. printf "\t Generic $ARCH system.\n\n" >> $topdir/target/$arch/Config.in.systems
  40. printf "\tdefault \"generic-${arch}\" if ADK_TARGET_SYSTEM_GENERIC_$ARCH\n" >> $topdir/target/config/Config.in.system.default
  41. done
  42. for i in $(ls $topdir/target/);do
  43. if [ -d "$topdir/target/$i/systems" ];then
  44. cat $topdir/target/$i/systems/* >> $topdir/target/$i/Config.in.systems 2>/dev/null
  45. fi
  46. done
  47. # create target/$arch/Config.in.arch and target/config/Config.in.system.choice
  48. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system.choice
  49. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch.default
  50. for arch in $(cat $topdir/target/arch.lst);do
  51. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  52. printf "choice\n" > $topdir/target/$arch/Config.in.arch
  53. printf "prompt \"System\"\n" >> $topdir/target/$arch/Config.in.arch
  54. printf "depends on ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/$arch/Config.in.arch
  55. printf "source target/$arch/Config.in.systems\n" >> $topdir/target/$arch/Config.in.arch
  56. printf "endchoice\n" >> $topdir/target/$arch/Config.in.arch
  57. printf "source target/$arch/Config.in.arch\n" >> target/config/Config.in.system.choice
  58. done
  59. cat >> $topdir/target/config/Config.in.arch.default << EOD
  60. config ADK_TARGET_ARCH
  61. string
  62. EOD
  63. for arch in $(cat $topdir/target/arch.lst);do
  64. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  65. printf "\tdefault \"$arch\" if ADK_TARGET_ARCH_$ARCH\n" >> target/config/Config.in.arch.default
  66. done
  67. printf "\n\n" >> target/config/Config.in.arch.default
  68. for arch in $(cat $topdir/target/arch.lst);do
  69. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  70. printf "config ADK_TARGET_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.default
  71. printf "\tbool\n\n" >> $topdir/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. config ADK_TARGET_CHOOSE_ARCH
  78. bool "choose architecture"
  79. EOD
  80. for os in linux frosted baremetal; do
  81. for arch in $(cat $topdir/target/$os/arch.lst);do
  82. OS=$(echo $os | tr '[:lower:]' '[:upper:]')
  83. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  84. printf "config ADK_TARGET_${OS}_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.choice
  85. printf "\tbool \"$arch\"\n" >> $topdir/target/config/Config.in.arch.choice
  86. printf "\tdepends on ADK_TARGET_OS_${OS}\n" >> $topdir/target/config/Config.in.arch.choice
  87. printf "\tselect ADK_TARGET_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.choice
  88. printf "\thelp\n" >> $topdir/target/config/Config.in.arch.choice
  89. printf "\t Support for $ARCH systems.\n\n" >> $topdir/target/config/Config.in.arch.choice
  90. done
  91. done
  92. printf "endchoice\n" >> $topdir/target/config/Config.in.arch.choice
  93. exit 0