update-sys 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
  3. defaults() {
  4. echo 'source "target/config/Config.in.arch.default"' > $topdir/target/config/Config.in.arch
  5. echo 'source "target/config/Config.in.arch.choice"' >> $topdir/target/config/Config.in.arch
  6. echo 'source "target/config/Config.in.system.default"' > $topdir/target/config/Config.in.system
  7. echo 'source "target/config/Config.in.system.choice"' >> $topdir/target/config/Config.in.system
  8. exit 0
  9. }
  10. for i in $(ls $topdir/target/);do
  11. if [ -d "$topdir/target/$i/sys-enabled" ];then
  12. cat $topdir/target/$i/sys-enabled/* > $topdir/target/$i/Config.in.systems 2>/dev/null
  13. fi
  14. done
  15. if [ -f $topdir/.config ];then
  16. arch=$(grep ^ADK_TARGET_ARCH $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
  17. systemsym=$(grep ^ADK_TARGET_SYSTEM_ $topdir/.config|cut -f 1 -d =)
  18. system=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
  19. systems=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g'|sed -e 's#-#_#g')
  20. archsym=$(echo ADK_LINUX_$arch|tr '[:lower:]-' '[:upper:]')
  21. if [ -z "$arch" -o -z "$system" ];then
  22. defaults
  23. fi
  24. cat > $topdir/target/config/Config.in.arch << EOF
  25. source "target/config/Config.in.arch.default"
  26. config $archsym
  27. bool
  28. EOF
  29. cat > $topdir/target/config/Config.in.system << EOF
  30. source "target/config/Config.in.system.default"
  31. comment "Architecture: $arch"
  32. comment "System: $system"
  33. config $systemsym
  34. boolean
  35. select $archsym
  36. $(grep select $topdir/target/$arch/sys-available/$system)
  37. default y
  38. EOF
  39. else
  40. defaults
  41. fi
  42. exit 0