version.c 879 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 <version.h>
  9. #include <linux/compiler.h>
  10. #ifdef CONFIG_SYS_COREBOOT
  11. #include <asm/cb_sysinfo.h>
  12. #endif
  13. const char __weak version_string[] = U_BOOT_VERSION_STRING;
  14. static int do_version(struct cmd_tbl *cmdtp, int flag, int argc,
  15. char *const argv[])
  16. {
  17. char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
  18. printf(display_options_get_banner(false, buf, sizeof(buf)));
  19. #ifdef CC_VERSION_STRING
  20. puts(CC_VERSION_STRING "\n");
  21. #endif
  22. #ifdef LD_VERSION_STRING
  23. puts(LD_VERSION_STRING "\n");
  24. #endif
  25. #ifdef CONFIG_SYS_COREBOOT
  26. printf("coreboot-%s (%s)\n", lib_sysinfo.version, lib_sysinfo.build);
  27. #endif
  28. return 0;
  29. }
  30. U_BOOT_CMD(
  31. version, 1, 1, do_version,
  32. "print monitor, compiler and linker version",
  33. ""
  34. );