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