blob: 130e31cd84fe664b6cced06179d5eae6ca6d5f97 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Peter Tysereabe6d92009-10-16 17:36:25 -05002/*
3 * Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Peter Tysereabe6d92009-10-16 17:36:25 -05005 */
6
7#include <common.h>
8#include <command.h>
Alexander Hollerb472d6b2011-01-19 00:24:40 +01009#include <version.h>
Pali Rohárba87ddf2021-08-02 15:18:31 +020010#include <version_string.h>
Andreas Bießmann61d01952011-07-18 20:24:04 +020011#include <linux/compiler.h>
Stefan Reinauer52d9b902012-12-14 13:05:18 +000012#ifdef CONFIG_SYS_COREBOOT
Simon Glass9a01fd92021-03-15 18:00:18 +130013#include <asm/cb_sysinfo.h>
Stefan Reinauer52d9b902012-12-14 13:05:18 +000014#endif
Peter Tysereabe6d92009-10-16 17:36:25 -050015
Pali Rohárd81f2c42021-08-02 15:18:37 +020016#define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \
17 U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING
18
Pali Rohár5a06a522021-08-02 15:18:35 +020019const char version_string[] = U_BOOT_VERSION_STRING;
Peter Tysereabe6d92009-10-16 17:36:25 -050020
Simon Glassed38aef2020-05-10 11:40:03 -060021static int do_version(struct cmd_tbl *cmdtp, int flag, int argc,
22 char *const argv[])
Peter Tysereabe6d92009-10-16 17:36:25 -050023{
Simon Glasse8583f92017-06-16 12:51:42 -060024 char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
25
26 printf(display_options_get_banner(false, buf, sizeof(buf)));
Alexander Hollerb472d6b2011-01-19 00:24:40 +010027#ifdef CC_VERSION_STRING
28 puts(CC_VERSION_STRING "\n");
29#endif
30#ifdef LD_VERSION_STRING
31 puts(LD_VERSION_STRING "\n");
32#endif
Stefan Reinauer52d9b902012-12-14 13:05:18 +000033#ifdef CONFIG_SYS_COREBOOT
34 printf("coreboot-%s (%s)\n", lib_sysinfo.version, lib_sysinfo.build);
35#endif
Peter Tysereabe6d92009-10-16 17:36:25 -050036 return 0;
37}
38
39U_BOOT_CMD(
40 version, 1, 1, do_version,
Alexander Hollerb472d6b2011-01-19 00:24:40 +010041 "print monitor, compiler and linker version",
Peter Tysereabe6d92009-10-16 17:36:25 -050042 ""
43);