1
0

update-sys 2.1 KB

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