update-sys 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. for i in $(ls $topdir/target/);do
  19. if [ -d "$topdir/target/$i/sys-enabled" ];then
  20. cat $topdir/target/$i/sys-enabled/* > $topdir/target/$i/Config.in.systems 2>/dev/null
  21. fi
  22. done
  23. if [ -f $topdir/.config ];then
  24. check_native
  25. arch=$(grep ^ADK_TARGET_ARCH $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
  26. systemsym=$(grep ^ADK_TARGET_SYSTEM_ $topdir/.config|cut -f 1 -d =)
  27. system=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
  28. systems=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g'|sed -e 's#-#_#g')
  29. archsym=$(echo ADK_LINUX_$arch|tr '[:lower:]-' '[:upper:]')
  30. if [ -z "$arch" -o -z "$system" ];then
  31. defaults
  32. fi
  33. cat > $topdir/target/config/Config.in.arch << EOF
  34. source "target/config/Config.in.arch.default"
  35. config $archsym
  36. bool
  37. EOF
  38. cat > $topdir/target/config/Config.in.system << EOF
  39. source "target/config/Config.in.system.default"
  40. comment "Architecture: $arch"
  41. comment "System: $system"
  42. config $systemsym
  43. boolean
  44. select $archsym
  45. $(grep select $topdir/target/$arch/sys-available/$system)
  46. default y
  47. EOF
  48. else
  49. defaults
  50. fi
  51. exit 0