blob: 87e1fa4159c1c4524d7c09a652f4348947c5bb77 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Peter Tyser6b8f5ad2009-10-16 17:36:25 -05002/*
3 * Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Peter Tyser6b8f5ad2009-10-16 17:36:25 -05005 */
6
7#include <common.h>
8#include <command.h>
Simon Glass4e4bf942022-07-31 12:28:48 -06009#include <display_options.h>
Pali Rohár121a1652021-08-02 15:18:38 +020010#include <timestamp.h>
Alexander Holler89ffa8d2011-01-19 00:24:40 +010011#include <version.h>
Pali Rohárbdfb6d72021-08-02 15:18:31 +020012#include <version_string.h>
Andreas Bießmann09c2e902011-07-18 20:24:04 +020013#include <linux/compiler.h>
Stefan Reinauere56cdd72012-12-14 13:05:18 +000014#ifdef CONFIG_SYS_COREBOOT
Simon Glasse35b6492021-03-15 18:00:18 +130015#include <asm/cb_sysinfo.h>
Stefan Reinauere56cdd72012-12-14 13:05:18 +000016#endif
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050017
Pali Rohárbc21ccb2021-08-02 15:18:37 +020018#define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \
19 U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING
20
Pali Rohár7629b522021-08-02 15:18:35 +020021const char version_string[] = U_BOOT_VERSION_STRING;
Simon Glass1e4d9652023-04-29 19:21:46 -060022const unsigned short version_num = U_BOOT_VERSION_NUM;
23const unsigned char version_num_patch = U_BOOT_VERSION_NUM_PATCH;
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050024
Simon Glass09140112020-05-10 11:40:03 -060025static int do_version(struct cmd_tbl *cmdtp, int flag, int argc,
26 char *const argv[])
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050027{
Simon Glass6c519f22017-06-16 12:51:42 -060028 char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
29
30 printf(display_options_get_banner(false, buf, sizeof(buf)));
Alexander Holler89ffa8d2011-01-19 00:24:40 +010031#ifdef CC_VERSION_STRING
32 puts(CC_VERSION_STRING "\n");
33#endif
34#ifdef LD_VERSION_STRING
35 puts(LD_VERSION_STRING "\n");
36#endif
Stefan Reinauere56cdd72012-12-14 13:05:18 +000037#ifdef CONFIG_SYS_COREBOOT
38 printf("coreboot-%s (%s)\n", lib_sysinfo.version, lib_sysinfo.build);
39#endif
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050040 return 0;
41}
42
43U_BOOT_CMD(
44 version, 1, 1, do_version,
Alexander Holler89ffa8d2011-01-19 00:24:40 +010045 "print monitor, compiler and linker version",
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050046 ""
47);