1
0

update-sys 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. systemsym=$(grep ^ADK_TARGET_SYSTEM_ $topdir/.config|cut -f 1 -d =)
  30. system=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
  31. systems=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g'|sed -e 's#-#_#g')
  32. archsym=$(echo ADK_LINUX_$arch|tr '[:lower:]' '[:upper:]')
  33. if [ -z "$arch" -o -z "$system" ];then
  34. defaults
  35. fi
  36. cat > $topdir/target/config/Config.in.arch << EOF
  37. source "target/config/Config.in.arch.default"
  38. config $archsym
  39. boolean
  40. EOF
  41. if [ "${system}" = "toolchain" -o "${system}" = "qemu" ];then
  42. sys=${system}-$arch
  43. else
  44. sys=$system
  45. fi
  46. cat > $topdir/target/config/Config.in.system << EOF
  47. source "target/config/Config.in.system.default"
  48. comment "Architecture: $arch"
  49. comment "System: $system"
  50. config $systemsym
  51. boolean
  52. select $archsym
  53. $(grep select $topdir/target/$arch/sys-available/$sys)
  54. default y
  55. EOF
  56. else
  57. defaults
  58. fi
  59. exit 0