gen_syms.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ##
  2. ## Copyright (c) 2016 Minoca Corp.
  3. ##
  4. ## This file is licensed under the terms of the GNU General Public License
  5. ## version 3. Alternative licensing terms are available. Contact
  6. ## info@minocacorp.com for details. See the LICENSE file at the root of this
  7. ## project for complete licensing information..
  8. ##
  9. ## Script Name:
  10. ##
  11. ## gen_syms.sh
  12. ##
  13. ## Abstract:
  14. ##
  15. ## This script generates the symbol files.
  16. ##
  17. ## Author:
  18. ##
  19. ## Evan Green 29-Mar-2016
  20. ##
  21. ## Environment:
  22. ##
  23. ## Build
  24. ##
  25. set -e
  26. if test -z "$SRCROOT"; then
  27. echo "Error: SRCROOT must be set."
  28. exit 1
  29. fi
  30. REVISION="0"
  31. WORKING="$SRCROOT/symswork"
  32. if [ -d "$WORKING" ]; then
  33. echo "Removing old $WORKING"
  34. rm -rf "$WORKING"
  35. fi
  36. mkdir "$WORKING"
  37. OLDPWD="$PWD"
  38. for arch in x86 x86q armv7; do
  39. BINROOT=$SRCROOT/${arch}dbg/bin
  40. if ! [ -d $BINROOT ] ; then
  41. continue
  42. fi
  43. if [ -r $BINROOT/build-revision ] ; then
  44. rev=`cat $BINROOT/build-revision`
  45. if expr "$rev" \> "$REVISION" ; then
  46. REVISION="$rev"
  47. fi
  48. fi
  49. cd "$BINROOT"
  50. FILES=`echo *`
  51. REMOVE='*.img
  52. pagefile.sys
  53. *.zip'
  54. for file in $REMOVE; do
  55. if [ -r $file ]; then
  56. FILES=`echo $FILES | sed s/$file//`
  57. fi
  58. done
  59. mkdir -p "$WORKING/$arch/"
  60. cp -pv -- $FILES "$WORKING/$arch/"
  61. done
  62. ##
  63. ## Copy the debugger in as well.
  64. ##
  65. cd "$SRCROOT/x86$DEBUG/tools/bin"
  66. for file in debugui.exe debug.exe kexts.dll ; do
  67. cp -pv ./$file "$WORKING/"
  68. done
  69. cp -pv "$SRCROOT/os/include/minoca/debug/dbgext.h" "$WORKING/"
  70. cd "$OLDPWD"
  71. ARCHIVE="Minoca-Symbols-$REVISION.zip"
  72. 7za a -tzip -mx9 -mmt -mtc "$ARCHIVE" $WORKING/*
  73. FILE_SIZE=`ls -l $ARCHIVE | \
  74. sed -n 's/[^ ]* *[^ ]* *[^ ]* *[^ ]* *\([0123456789]*\).*/\1/p'`
  75. if test -n "$MBUILD_STEP_ID"; then
  76. python $SRCROOT/client.py --result "$ARCHIVE Size" integer "$FILE_SIZE"
  77. python $SRCROOT/client.py --upload schedule $ARCHIVE $ARCHIVE
  78. echo Uploaded file $ARCHIVE, size $FILE_SIZE
  79. fi
  80. echo "Removing $WORKING"
  81. rm -rf "$WORKING"
  82. echo "Done creating symbols."