From patchwork Mon Oct 18 04:11:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1542374 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ulghiDZM; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=J9mYkp9S; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=gfVgyBh5; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HXk3v50mcz9s1l for ; Mon, 18 Oct 2021 15:12:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=iQCFdogGFNA6g9/EHdVEYOAah6u9KgjTepEEH50nIvc=; b=ulghiDZMugEYul lt16jmaNO9PevYlRNR7dXXDt06uls0dLY7VLupRMHTsb6OM6hpK0v8lVnuTPphRnMV0jYEzL6rfoQ LG8qsEYF0C2QBtN7evoBDoOXbAkMlHbHYKYI+67IkARSZmk87UMmZrp1e4ABM3URCf97wen/mzlrC I/qugMxaa+tYs9stN8ALSyWr/WGNVntICkY08eszH9RAEkPZxR6ftSfaj8J8g/fe3nC6bT28Dmorw 6vtslbadtUUdHdD10kqdhndJ8WxFtSZKkPXpeDY+2FVqRZ8Tg0vDf5YOylhs1z1dFPAlCkZ0YxEXl l42DwdNq0ezlRLBl7tbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcK0X-00DysA-24; Mon, 18 Oct 2021 04:12:17 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcK0U-00Dyrc-DH for opensbi@lists.infradead.org; Mon, 18 Oct 2021 04:12:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1634530333; x=1666066333; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=JTBi03gvNtRLdD3ue7N7IT52XJC+riy67JGfYKrQftA=; b=J9mYkp9SQyPwK9z3GsxhZ3+W3JjA0UKHUoTaWbMD2zHJdb2JUvw9R7WK CjH61xVXUiOtysBwF4VPfT4lPp9OB5XZkkWGbSuLigWl2sdyoKsCA/se2 gWjzZPN3hME7ZZmM4MLHE+8Sm/lMvShCY98txcE/86kwbFCP2o5auqeWz 2Ev9aTCq064zkWNOP8+gs2dg7Co/3RTo84qyCZaIm/FDucoJNK8RncTzI tqz9+O61Y7phO934KT+eED2dA7OsDkJS7Nlj2AZuGmzqlxp+LKbdQ3Wyf awyLZ+hwRZEQb9LvdJOkr70e0jItVBsgu/vxbJOHNiHoPYjXKSY/MX7qs w==; X-IronPort-AV: E=Sophos;i="5.85,381,1624291200"; d="scan'208";a="187921296" Received: from mail-mw2nam10lp2103.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.103]) by ob1.hgst.iphmx.com with ESMTP; 18 Oct 2021 12:12:12 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bVNZOFqxYhLO8lmXUUcyv/CQAidCqOpWccOXxa7E79CI1BVq15XPFsT5J4MzAcHI2ScSLeefULYGkT6ZyJ4/rYBpkZ+kbEm3I7CDopQgWKQHlOfXjUNgKjDEW5/uZK9EMu6ACq9rUTaGQbmqDM5QxQ5bjlfu5kO8d8CK3tU3Upup348+k+89q6UphbwXxS1Jg97iyLRJl8iiWLcxcky9TRGzWv8QHAyND9OjDfw2VGnBh2YlUmTtyalHoVf+0+x1YX8fx8XADQJShnBGfoLL+cRXeTL/RoNCohwO/zPotTGHxo/xwAcW5MCFdfHt5Nb7/BGT4oWII0m+1Xzavpwv4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8xn/ajBkI/bW8NEiXQhM3P4D8B3SaQUg3xEDdulWHko=; b=DHVYAZ/i1e3OT3kJUiYnUpPsXCXIKKY+S+RMZTBJZod1BfJdy0VnI99IXll/l1k6sRRBWPcsGIZZY8ZbmGWLLfPSPNGceG15CbIKrnq8W7SnZjoI/mfP+9mzXSyEzyiffxEgpALRyZaWvBRXWpYGpwColARyj5aeEj/sBX92SNmu3CLDfwDOXvbdgN4hItJ1ms18RMUnUshc0Jq90X6Ov7fM8REHmG+bc82MqhhuMnOtPAcEjXSNgwWImkh6taM0aGgQLewOvdicHmNdPDDORuAle2LaUS4Gkn5i4OiwY3NAcEOmj5il10kBiwZYCqNFQpPTNA81MAn8tjHL+vuZUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8xn/ajBkI/bW8NEiXQhM3P4D8B3SaQUg3xEDdulWHko=; b=gfVgyBh5+67W89/71kRi2lgSyXDjTqawLC2z9YOSQgCYwxEhXDLLadsq8YIyCNRXkd1HStCwrz/M+r5UeweKUig4/QB3iVLKoWuripEqpYdymeLBoQ2NOgYJkWNfcLF+acSExAvv9bK367LYVxKgju3nMDffowgGM0Bnzaqp8yQ= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from CO6PR04MB7812.namprd04.prod.outlook.com (2603:10b6:303:138::6) by CO6PR04MB8330.namprd04.prod.outlook.com (2603:10b6:303:135::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Mon, 18 Oct 2021 04:12:11 +0000 Received: from CO6PR04MB7812.namprd04.prod.outlook.com ([fe80::8100:4308:5b21:8d97]) by CO6PR04MB7812.namprd04.prod.outlook.com ([fe80::8100:4308:5b21:8d97%9]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 04:12:11 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Wei Fu , Anup Patel Subject: [PATCH v5] Makefile: Add build time and compiler info string Date: Mon, 18 Oct 2021 09:41:48 +0530 Message-Id: <20211018041148.1343731-1-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: MAXPR01CA0118.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::36) To CO6PR04MB7812.namprd04.prod.outlook.com (2603:10b6:303:138::6) MIME-Version: 1.0 Received: from wdc.com (122.171.138.218) by MAXPR01CA0118.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Mon, 18 Oct 2021 04:12:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d2eedc3-5bf0-4769-3649-08d991ed757f X-MS-TrafficTypeDiagnostic: CO6PR04MB8330: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6fLmVOMStE+YUZtGCs1QGknjMaJ9Gqda191R4X7AbJtxkYIhAWlaqatipBVHVxnR9PDaoBUBbYiSB3+JhvxtnPBZ1WnHm2Bcl9lpzizvsuNv3rfa2+gRTjFcXmQP0AMkbawyp4pS/lIVjDeS98XHSSWWtYv+qdHAW2FWChyg+9r8XCR2GqzjKowK4NmozJUTUx3SXmXN63Me6mDL+pCvOwuMfX442xNn9Bayrszg5SjEguaMn0YE3UhAwre5m4YTgUC5r8hbatRClE3AEwFkfOadWjkhl4+TSnmjs0g87oJ6oa5iSTSN7cM/y4VgcBxko9eY/vyaaK+Up5sHXWscCFlrr1Sx706RJO1Fec3t26Q7aw5MUkjPsz15R1taFdxnFRcT9bcS1ToxJ3+7Hw9PlhceQtClik65G3HSCfUUh/f/gcMlIZRJvoRWMrhJFKt60o+mtAp2BjJl12RDnqhPXAguPqO9LykLTfNoZnx6sFVKZX4a8JnKH3YxMPxMhvP0hGtL6IkILzELcN9fM1yg5ALRRqxjhUqPf+/xU/j0j6SeyhLOJgMGafuRwZSQ8Haqw6P0cNUzbmv0EDXaw26RUe++hCRcfYSfacAKzzXAe6YgRmId8uhe+WkKl1JvivbSDE6DZH8VqaPeLeTia3IU/gOzFdIZAbSAqynGSIbRD771rXO9uPruQTW4+q1+u23r83EeN/wbiDl/aSecde/AZwB2lcx5PBEXw5ws7vzDSaoH/isGd8KAVxA5O8lO8OhmnYAfV3FRzRd2sUHRYRWx58E2ZT05kWJ2hSifv9PyjC4n+xXh39xKUxPEmDKHq3wqx44mAD63TsFlwW+XbpC8Vg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR04MB7812.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(54906003)(110136005)(19273905006)(186003)(52116002)(36756003)(8936002)(316002)(966005)(44832011)(6666004)(8676002)(26005)(2906002)(83380400001)(956004)(1076003)(82960400001)(66476007)(38350700002)(66946007)(508600001)(7696005)(55016002)(6636002)(86362001)(4326008)(5660300002)(8886007)(38100700002)(2616005)(66556008)(562404015)(563064011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eU+3UGIwWa61InrbHvk26XY11gL+SF7BY16MiPR5kM4+MC4EivzCJLN6RisAclIX7M6zIEtSz9M1WF0AV3/9m/9dshuBiPIvCdh6xIKdqR8Jca3lGRpotNkFARL+rbPyU6Ol1Ln2Gf0D0dTipOr0m8zueY4sYUxxwCwTDAMaHg/Lj7X3p8YgT1q6pzb8Fz5VypbMCYksIWG6rpBHnJ8DpGcT8549+DlIRQHYHz1Iuo/GYVPdZV8FF3bp3Krj7/o/xMDMF2yYxhI+/7J29DgojdcikSU92iIZ8uvqFGqO7dlobkVqPamdvjoioP1lQUOS8IuiamODzh7/9hY8ILtlii23e2uvP9d9ZUTMqgy5KELfh/MhvcWhM/0pAH4iB0ZFISGELEBJ01LKi1CVxm8rXv9oN/U7kkiem3/CxJDldFT9yfUJ27gv1b6ldxbReZE8evWgLb3FX9CAwC3ez4+bprcjtA8dWdOhjZUtY5pNoCtJDUrir+BC2m4+dULRgVWdxXEhtBc3mcMXt86KbI/zjnAjmN0iLnIrP0QSix8aumgqyqP44E7eCHN9RT17iezxXT49J0YTM5CeOg/9iEQ287cuUf57C99Oqw7wAeD+yrcjtxksQKTzG+T96mqCZ7SuEil3ORt6TjnEyHRp3Qgakh4jrOZWFTtOugX71K1Dgjb9fC+/wFjvbI6BKa/y2jooeVYKTxUGRpiiizZmj7eDVPs/LnTfFfEkNPyE7RbHSI4PrRLXBrhCv6O2o0344t7iTzpdyK8s+FtZfVebaqvhoEVBOAIY8kEZJm4nZ7fFrRw558IgwIEV6LxGVVlIfmYN2w3c6r78uA60kBYhhRjl+8IhQZ+j5hOWyBU6CbfilB2tWDQYsLkbQwtHw/w+sJwW6tfl2irJ32ClWfwjky58edEBN3xaQg8rayoxGb9SMcjN/NvwHdYVYFZlLuH3mPggH5P4srJDeGqE9DSr/jlBD622NjK7qEirnS4FRqyiO3LQaPhIvamD4VTmF8HgHh03IKgcne4SiuyUR/0p/NkT68c6aOm0s3E2UtWX06NbEzZj90oAHDjaNnPZlIsvR8DzL+lseWupq/NMXtxjtIhevps9/5qCMVa78vMBgMjVd3u7mlvE8BARseI0JnURd/BnJadKesftAerFJKqOn+FbNT67VLukipU99epbiGgJqWOs/7atIHts8NnLUP9EaFNiOy4jTViDeekvibVc7pDrVzGtIwABs0Ut+VEzxBdF21DAGX9q47vfHrT8KuWfBCQ+blsjwv1q+ja2qtcM7uVcGjjlU1iYZ704CbsAZJLISvafYZbeztSMgQ04MA6zSiw9 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d2eedc3-5bf0-4769-3649-08d991ed757f X-MS-Exchange-CrossTenant-AuthSource: CO6PR04MB7812.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 04:12:11.5866 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8IvxKTbZDu/hy2v8vb9CN6jv3gd7hdEXA+Bi1R3rlze8hNJ46NcfwVlpTDPpSL9vf+FCmQVMry7aarx3so3zXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR04MB8330 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211017_211214_583095_5569DFCB X-CRM114-Status: GOOD ( 16.05 ) X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Wei Fu When we are doing opensbi development, we want to know the build time and compiler info for debug purpose. To enable this message, please add "BUILD_INFO=y", like: ``` make BUILD_INFO=y ``` Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.141 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [216.71.153.141 listed in wl.mailspike.net] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Wei Fu When we are doing opensbi development, we want to know the build time and compiler info for debug purpose. To enable this message, please add "BUILD_INFO=y", like: ``` make BUILD_INFO=y ``` NOTE: `BUILD_INFO=y` will violate "reproducible builds". So it's ONLY for development and debug purpose, and should NOT be used in a product which follows "reproducible builds". Signed-off-by: Wei Fu Reviewed-by: Anup Patel Reviewed-by: Alistair Francis --- Changes since v4: - Updated build date format to +%Y-%m-%d %H:%M:%S %z - Rename SOURCE_DATE_EPOCH to BUILD_DATE_EPOCH --- Makefile | 31 +++++++++++++++++++++++++++++++ README.md | 23 +++++++++++++++++++++++ lib/sbi/sbi_init.c | 8 ++++++++ 3 files changed, 62 insertions(+) diff --git a/Makefile b/Makefile index 16d9dca..9548afd 100644 --- a/Makefile +++ b/Makefile @@ -150,6 +150,25 @@ endif # Check whether the linker supports creating PIEs OPENSBI_LD_PIE := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) $(USE_LD_FLAG) -fPIE -nostdlib -Wl,-pie -x c /dev/null -o /dev/null >/dev/null 2>&1 && echo y || echo n) +# Build Info: +# OPENSBI_BUILD_TIME_STAMP -- the compilation time stamp +# OPENSBI_BUILD_COMPILER_VERSION -- the compiler version info +BUILD_INFO ?= n +ifeq ($(BUILD_INFO),y) +OPENSBI_BUILD_DATE_FMT = +%Y-%m-%d %H:%M:%S %z +ifdef BUILD_DATE_EPOCH + OPENSBI_BUILD_TIME_STAMP ?= $(shell date -u -d "@$(BUILD_DATE_EPOCH)" \ + "$(OPENSBI_BUILD_DATE_FMT)" 2>/dev/null || \ + date -u -r "$(BUILD_DATE_EPOCH)" \ + "$(OPENSBI_BUILD_DATE_FMT)" 2>/dev/null || \ + date -u "$(OPENSBI_BUILD_DATE_FMT)") +else + OPENSBI_BUILD_TIME_STAMP ?= $(shell date "$(OPENSBI_BUILD_DATE_FMT)") +endif +OPENSBI_BUILD_COMPILER_VERSION=$(shell $(CC) -v 2>&1 | grep ' version ' | \ + sed 's/[[:space:]]*$$//') +endif + # Setup list of objects.mk files ifdef PLATFORM platform-object-mks=$(shell if [ -d $(platform_src_dir)/ ]; then find $(platform_src_dir) -iname "objects.mk" | sort -r; fi) @@ -247,6 +266,10 @@ GENFLAGS += -I$(include_dir) ifneq ($(OPENSBI_VERSION_GIT),) GENFLAGS += -DOPENSBI_VERSION_GIT="\"$(OPENSBI_VERSION_GIT)\"" endif +ifeq ($(BUILD_INFO),y) +GENFLAGS += -DOPENSBI_BUILD_TIME_STAMP="\"$(OPENSBI_BUILD_TIME_STAMP)\"" +GENFLAGS += -DOPENSBI_BUILD_COMPILER_VERSION="\"$(OPENSBI_BUILD_COMPILER_VERSION)\"" +endif GENFLAGS += $(libsbiutils-genflags-y) GENFLAGS += $(platform-genflags-y) GENFLAGS += $(firmware-genflags-y) @@ -398,6 +421,11 @@ $(build_dir)/%.dep: $(src_dir)/%.c $(build_dir)/%.o: $(src_dir)/%.c $(call compile_cc,$@,$<) +ifeq ($(BUILD_INFO),y) +$(build_dir)/lib/sbi/sbi_init.o: $(libsbi_dir)/sbi_init.c FORCE + $(call compile_cc,$@,$<) +endif + $(build_dir)/%.dep: $(src_dir)/%.S $(call compile_as_dep,$@,$<) @@ -551,3 +579,6 @@ ifeq ($(install_root_dir),$(install_root_dir_default)/usr) $(if $(V), @echo " RM $(install_root_dir_default)") $(CMD_PREFIX)rm -rf $(install_root_dir_default) endif + +.PHONY: FORCE +FORCE: diff --git a/README.md b/README.md index 9fdf097..c498af0 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,28 @@ to produce broken binaries with missing relocations; it is therefore currently recommended that this combination be avoided or *FW_PIC=n* be used to disable building OpenSBI as a position-independent binary. +Building with timestamp and compiler info +----------------------------------------- + +When doing development, we may want to know the build time and compiler info +for debug purpose. OpenSBI can also be built with timestamp and compiler info. +To build with those info and print it out at boot time, we can just simply add +`BUILD_INFO=y`, like: +``` +make BUILD_INFO=y +``` + +But if you have used `BUILD_INFO=y`, and want to switch back to `BUILD_INFO=n`, +you must do +``` +make clean +``` +before the next build. + +NOTE: Using `BUILD_INFO=y` will violate [reproducible builds]. This definition +is ONLY for development and debug purpose, and should NOT be used in a product +which follows "reproducible builds". + Contributing to OpenSBI ----------------------- @@ -336,3 +358,4 @@ make I= install_docs [Doxygen manual]: http://www.doxygen.nl/manual/index.html [Kendryte standalone SDK]: https://github.com/kendryte/kendryte-standalone-sdk [third party notices]: ThirdPartyNotices.md +[reproducible builds]: https://reproducible-builds.org diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index 843659e..b1c7cf0 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -48,6 +48,14 @@ static void sbi_boot_print_banner(struct sbi_scratch *scratch) OPENSBI_VERSION_MINOR); #endif +#ifdef OPENSBI_BUILD_TIME_STAMP + sbi_printf("Build time: %s\n", OPENSBI_BUILD_TIME_STAMP); +#endif + +#ifdef OPENSBI_BUILD_COMPILER_VERSION + sbi_printf("Build compiler: %s\n", OPENSBI_BUILD_COMPILER_VERSION); +#endif + sbi_printf(BANNER); }