update-sys 2.2 KB

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