update-sys 2.0 KB

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