xref: /openbmc/u-boot/cmd/version.c (revision 5751ee2f)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright 2000-2009
4  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5  */
6 
7 #include <common.h>
8 #include <command.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/arch/sysinfo.h>
15 #endif
16 
17 const char __weak version_string[] = U_BOOT_VERSION_STRING;
18 
do_version(cmd_tbl_t * cmdtp,int flag,int argc,char * const argv[])19 static int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
20 {
21 	char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
22 
23 	printf(display_options_get_banner(false, buf, sizeof(buf)));
24 #ifdef CC_VERSION_STRING
25 	puts(CC_VERSION_STRING "\n");
26 #endif
27 #ifdef LD_VERSION_STRING
28 	puts(LD_VERSION_STRING "\n");
29 #endif
30 #ifdef CONFIG_SYS_COREBOOT
31 	printf("coreboot-%s (%s)\n", lib_sysinfo.version, lib_sysinfo.build);
32 #endif
33 	return 0;
34 }
35 
36 U_BOOT_CMD(
37 	version,	1,		1,	do_version,
38 	"print monitor, compiler and linker version",
39 	""
40 );
41