create-menu 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 "choice\n" >> $topdir/target/config/Config.in.tasks
  15. printf "prompt \"Task\"\n\n" >> $topdir/target/config/Config.in.tasks
  16. cat $topdir/tasks/* >> $topdir/target/config/Config.in.tasks 2>/dev/null
  17. printf "\nendchoice\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. cat > $topdir/target/config/Config.in.arch.choice << EOD
  68. # autogenerated via scripts/create-menu
  69. choice
  70. prompt "Architecture"
  71. EOD
  72. for arch in $(cat $topdir/target/arch.lst);do
  73. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  74. printf "config ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/config/Config.in.arch.choice
  75. printf "\tbool \"$arch\"\n" >> $topdir/target/config/Config.in.arch.choice
  76. case $arch in
  77. alpha|ia64|sh|sparc64|s390|tile|ppc64|mips64|x86_64)
  78. printf "\tdepends on ADK_TARGET_OS_LINUX\n" >> $topdir/target/config/Config.in.arch.choice
  79. ;;
  80. nds32|moxie|v850)
  81. printf "\tdepends on ADK_TARGET_OS_BAREMETAL\n" >> $topdir/target/config/Config.in.arch.choice
  82. ;;
  83. esac
  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