update-sys 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. bool
  38. EOF
  39. cat > $topdir/target/config/Config.in.system << EOF
  40. source "target/config/Config.in.system.default"
  41. comment "Architecture: $arch"
  42. comment "System: $system"
  43. config $systemsym
  44. boolean
  45. select $archsym
  46. $(grep select $topdir/target/$arch/sys-available/$system)
  47. default y
  48. EOF
  49. else
  50. defaults
  51. fi
  52. exit 0