create-sys 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
  3. systems=$(grep -h config target/*/sys-available/*|cut -d " " -f 2)
  4. while read arch; do
  5. count=1
  6. mkdir -p $topdir/target/$arch/sys-enabled &&
  7. cd $topdir/target/$arch/sys-enabled &&
  8. ln -sf ../sys-available/toolchain-$arch 0-toolchain-$arch
  9. for i in $(ls $topdir/target/$arch/sys-available/|grep -v toolchain);do
  10. cd $topdir/target/$arch/sys-enabled/ &&
  11. ln -sf ../sys-available/$i $count-$i
  12. count=$((count+1))
  13. done
  14. done <${topdir}/target/arch.lst
  15. echo '' > $topdir/target/config/Config.in.system.default
  16. for j in $systems;do
  17. system=${j#ADK_TARGET_SYSTEM_}
  18. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  19. printf "config ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
  20. printf "\tboolean\n\n" >> $topdir/target/config/Config.in.system.default
  21. done
  22. cat >> $topdir/target/config/Config.in.system.default << EOD
  23. config ADK_TARGET_SYSTEM
  24. string
  25. EOD
  26. for i in $systems;do
  27. system=${i#ADK_TARGET_SYSTEM_}
  28. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  29. system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
  30. system=$(echo $system|sed 's#x86-64#x86_64#')
  31. if [ "${system%-*}" = "toolchain" -o "${system%-*}" = "qemu" ];then
  32. printf "\tdefault \"${system%-*}\" if ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
  33. else
  34. printf "\tdefault \"${system}\" if ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
  35. fi
  36. done
  37. exit 0