version.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2000-2009
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. #include <common.h>
  7. #include <command.h>
  8. #include <display_options.h>
  9. #include <timestamp.h>
  10. #include <version.h>
  11. #include <version_string.h>
  12. #include <linux/compiler.h>
  13. #ifdef CONFIG_SYS_COREBOOT
  14. #include <asm/cb_sysinfo.h>
  15. #endif
  16. #define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \
  17. U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING
  18. const char version_string[] = U_BOOT_VERSION_STRING;
  19. const unsigned short version_num = U_BOOT_VERSION_NUM;
  20. const unsigned char version_num_patch = U_BOOT_VERSION_NUM_PATCH;
  21. static int do_version(struct cmd_tbl *cmdtp, int flag, int argc,
  22. char *const argv[])
  23. {
  24. char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
  25. printf(display_options_get_banner(false, buf, sizeof(buf)));
  26. #ifdef CC_VERSION_STRING
  27. puts(CC_VERSION_STRING "\n");
  28. #endif
  29. #ifdef LD_VERSION_STRING
  30. puts(LD_VERSION_STRING "\n");
  31. #endif
  32. #ifdef CONFIG_SYS_COREBOOT
  33. printf("coreboot-%s (%s)\n", lib_sysinfo.version, lib_sysinfo.build);
  34. #endif
  35. return 0;
  36. }
  37. U_BOOT_CMD(
  38. version, 1, 1, do_version,
  39. "print monitor, compiler and linker version",
  40. ""
  41. );