daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. # This file is part of the coreboot project.
  4. #
  5. # Copyright (C) 2014 Sage Electronic Engineering, LLC.
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; version 2 of the License.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15. #
  16.  
  17. DATE=""
  18. GITREV=""
  19. TIMESOURCE=""
  20.  
  21. export LANG=C
  22. export LC_ALL=C
  23. export TZ=UTC0
  24.  
  25. ASL_REV=`get_iasl_version`
  26.  
  27. if [ "${BUILD_TIMELESS}" = "1" ]; then
  28.     GITREV=Timeless
  29.     TIMESOURCE="fixed"
  30.     DATE=0
  31. elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then
  32.     GITREV=$(LANG= git log -1 --format=format:%h)
  33.     TIMESOURCE=git
  34.     DATE=$(git log --pretty=format:%ct -1)
  35. else
  36.     GITREV=Unknown
  37.     TIMESOURCE="date"
  38.     DATE=$(LANG= LC_ALL=C TZ=UTC0 date +%s)
  39. fi
  40.  
  41. our_date() {
  42. case $(uname) in
  43. NetBSD|OpenBSD|DragonFly|FreeBSD|Darwin)
  44.     date -r $1 $2
  45.     ;;
  46. *)
  47.     date -d @$1 $2
  48. esac
  49. }
  50.  
  51. get_iasl_version()
  52. {
  53. local x version
  54.     x="$(./util/crossgcc/xgcc/bin/iasl -v | grep "Compiler/Disassembler version")"
  55.     version=`echo "$x" | "cut -d' ' -f5"`
  56.  
  57.     echo "$version"
  58. }
  59.  
  60. #Print out the information that goes into build.h
  61. printf "/* build system definitions (autogenerated) */\n"
  62. printf "#ifndef __BUILD_H\n"
  63. printf "#define __BUILD_H\n\n"
  64. printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
  65. printf "#define ASL_REVISION %d\n" "$ASL_REV"
  66.  
  67. #See if the build is running in a git repo and the git command is available
  68. printf "/* timesource: $TIMESOURCE */\n"
  69. printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
  70. printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
  71.  
  72. printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
  73. printf "#define COREBOOT_BUILD \"$(our_date "$DATE")\"\n"
  74. printf "#define COREBOOT_BUILD_YEAR_BCD 0x$(our_date "$DATE" +%y)\n"
  75. printf "#define COREBOOT_BUILD_MONTH_BCD 0x$(our_date "$DATE" +%m)\n"
  76. printf "#define COREBOOT_BUILD_DAY_BCD 0x$(our_date "$DATE" +%d)\n"
  77. printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x$(our_date "$DATE" +%w)\n"
  78. printf "#define COREBOOT_DMI_DATE \"$(our_date "$DATE" +%m/%d/%Y)\"\n"
  79. printf "\n"
  80. printf "#define COREBOOT_COMPILE_TIME \"$(our_date "$DATE" +%T)\"\n"
  81. printf "#endif\n"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top