update-sys 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env bash
  2. # 1. create Config.in.systems with all available target systems for each architecture
  3. # 2. if ADK configuration exist, create Config.in.arch/Config.in.system with fixed values
  4. topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
  5. defaults() {
  6. echo 'source "target/config/Config.in.arch.default"' > $topdir/target/config/Config.in.arch
  7. echo 'source "target/config/Config.in.arch.choice"' >> $topdir/target/config/Config.in.arch
  8. echo 'source "target/config/Config.in.system.default"' > $topdir/target/config/Config.in.system
  9. echo 'source "target/config/Config.in.system.choice"' >> $topdir/target/config/Config.in.system
  10. exit 0
  11. }
  12. check_native() {
  13. native=$(grep ^ADK_LINUX_NATIVE $topdir/.config)
  14. if [ ! -z "$native" ];then
  15. exit 0
  16. fi
  17. }
  18. touch $topdir/target/config/Config.in.native
  19. for i in $(ls $topdir/target/);do
  20. if [ -d "$topdir/target/$i/sys-enabled" ];then
  21. cat $topdir/target/$i/sys-enabled/* > $topdir/target/$i/Config.in.systems 2>/dev/null
  22. fi
  23. done
  24. if [ -f $topdir/.config ];then
  25. check_native
  26. arch=$(grep ^ADK_TARGET_ARCH $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
  27. systemsym=$(grep ^ADK_TARGET_SYSTEM_ $topdir/.config|cut -f 1 -d =)
  28. system=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
  29. systems=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g'|sed -e 's#-#_#g')
  30. archsym=$(echo ADK_LINUX_$arch|tr '[:lower:]-' '[:upper:]')
  31. if [ -z "$arch" -o -z "$system" ];then
  32. defaults
  33. fi
  34. cat > $topdir/target/config/Config.in.arch << EOF
  35. source "target/config/Config.in.arch.default"
  36. config $archsym
  37. boolean
  38. EOF
  39. if [ "${system}" = "toolchain" ];then
  40. sys=${system}-$arch
  41. else
  42. sys=$system
  43. fi
  44. cat > $topdir/target/config/Config.in.system << EOF
  45. source "target/config/Config.in.system.default"
  46. comment "Architecture: $arch"
  47. comment "System: $system"
  48. config $systemsym
  49. boolean
  50. select $archsym
  51. $(grep select $topdir/target/$arch/sys-available/$sys)
  52. default y
  53. EOF
  54. else
  55. defaults
  56. fi
  57. exit 0