create-menu 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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" -o -n "$ADK_CUSTOM_TASKS_DIR" ];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. if [ -d "$topdir/tasks" ];then
  17. cat $topdir/tasks/* >> $topdir/target/config/Config.in.tasks 2>/dev/null
  18. fi
  19. if [ -n "$ADK_CUSTOM_TASKS_DIR" -a -d "$ADK_CUSTOM_TASKS_DIR" ];then
  20. printf "\n# tasks pulled from ADK_CUSTOM_TASKS_DIR='%s'\n" "$ADK_CUSTOM_TASKS_DIR" >> $topdir/target/config/Config.in.tasks
  21. cat $ADK_CUSTOM_TASKS_DIR/* >> $topdir/target/config/Config.in.tasks 2>/dev/null
  22. fi
  23. printf "\nendmenu\n\n" >> $topdir/target/config/Config.in.tasks
  24. fi
  25. # create system default
  26. printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.system.default
  27. cat >> $topdir/target/config/Config.in.system.default << EOD
  28. config ADK_TARGET_SYSTEM
  29. string
  30. EOD
  31. for i in $systems;do
  32. system=${i#ADK_TARGET_SYSTEM_}
  33. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  34. system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
  35. system=$(echo $system|sed 's#x86-64#x86_64#')
  36. printf "\tdefault \"${system}\" if $i\n" >> $topdir/target/config/Config.in.system.default
  37. done
  38. # create or update systems
  39. for arch in $(cat $topdir/target/arch.lst);do
  40. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  41. printf "config ADK_TARGET_SYSTEM_GENERIC_$ARCH\n" > $topdir/target/$arch/Config.in.systems
  42. printf "\tbool \"Generic\"\n" >> $topdir/target/$arch/Config.in.systems
  43. printf "\tselect ADK_TARGET_GENERIC\n" >> $topdir/target/$arch/Config.in.systems
  44. printf "\thelp\n" >> $topdir/target/$arch/Config.in.systems
  45. printf "\t Generic $ARCH system.\n\n" >> $topdir/target/$arch/Config.in.systems
  46. printf "\tdefault \"generic-${arch}\" if ADK_TARGET_SYSTEM_GENERIC_$ARCH\n" >> $topdir/target/config/Config.in.system.default
  47. done
  48. for i in $(ls $topdir/target/);do
  49. if [ -d "$topdir/target/$i/systems" ];then
  50. cat $topdir/target/$i/systems/* >> $topdir/target/$i/Config.in.systems 2>/dev/null
  51. fi
  52. done
  53. # create target/$arch/Config.in.arch and target/config/Config.in.system.choice
  54. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system.choice
  55. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch.default
  56. for arch in $(cat $topdir/target/arch.lst);do
  57. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  58. printf "choice\n" > $topdir/target/$arch/Config.in.arch
  59. printf "prompt \"System\"\n" >> $topdir/target/$arch/Config.in.arch
  60. printf "depends on ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/$arch/Config.in.arch
  61. printf "source target/$arch/Config.in.systems\n" >> $topdir/target/$arch/Config.in.arch
  62. printf "endchoice\n" >> $topdir/target/$arch/Config.in.arch
  63. printf "source target/$arch/Config.in.arch\n" >> target/config/Config.in.system.choice
  64. done
  65. cat >> $topdir/target/config/Config.in.arch.default << EOD
  66. config ADK_TARGET_ARCH
  67. string
  68. EOD
  69. for arch in $(cat $topdir/target/arch.lst);do
  70. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  71. printf "\tdefault \"$arch\" if ADK_TARGET_ARCH_$ARCH\n" >> target/config/Config.in.arch.default
  72. done
  73. printf "\n\n" >> target/config/Config.in.arch.default
  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.default
  77. printf "\tbool\n\n" >> $topdir/target/config/Config.in.arch.default
  78. done
  79. cat > $topdir/target/config/Config.in.arch.choice << EOD
  80. # autogenerated via scripts/create-menu
  81. choice
  82. prompt "Architecture"
  83. config ADK_TARGET_CHOOSE_ARCH
  84. bool "choose architecture"
  85. EOD
  86. for os in linux frosted rtems zephyr baremetal; do
  87. for arch in $(cat $topdir/target/$os/arch.lst);do
  88. OS=$(echo $os | tr '[:lower:]' '[:upper:]')
  89. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  90. printf "config ADK_TARGET_${OS}_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.choice
  91. printf "\tbool \"$arch\"\n" >> $topdir/target/config/Config.in.arch.choice
  92. printf "\tdepends on ADK_TARGET_OS_${OS}\n" >> $topdir/target/config/Config.in.arch.choice
  93. printf "\tselect ADK_TARGET_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.choice
  94. printf "\thelp\n" >> $topdir/target/config/Config.in.arch.choice
  95. printf "\t Support for $ARCH systems.\n\n" >> $topdir/target/config/Config.in.arch.choice
  96. done
  97. done
  98. printf "endchoice\n" >> $topdir/target/config/Config.in.arch.choice
  99. exit 0