From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.67]) by mx.groups.io with SMTP id smtpd.web10.4566.1594185600098310438 for ; Tue, 07 Jul 2020 22:20:00 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=gajusQpe; spf=pass (domain: oss.nxp.com, ip: 40.107.22.67, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LRTMIlD6kDq8byo2cZnyle/DjmBdDAdm9HiUErdTix4nxOOokp9m4oZ3jcLJvecEYPkzRG+pCRJroGZc8ak+cZHMm7H1vUzpHzbuQW84nyz6BagC5K30/1WM/T5GkZjmmv8j6ZnNm+x2al2p0yNSs8Cd3B6qaczuMzTaKeLR1qVHmrvtTJrOdJairv8rdjXk8r94Cv7oFxfH/KwqP688Cgu78jIX13Oexa43AK7Nxkkmz5MCqZzLXmB3kL+34RCf5i9x9vAiUIGgeioD4nVkLHdqEAUA7L3v2eDOqJAmV7dDm/L/rBAkT20C6VCxeiL+Q8Car6QpoNYqeb3XXH692Q== 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-SenderADCheck; bh=MvsZGikbis2Mb6yAt56vU9TtTlj1EyZxxyjovFMW1/o=; b=Ep9CT+Nl+Sg6y8KED73IfVmBltlNQHRQKm1yiTDWdqchlPKaXmX8CuLkgte1M22hEWwgC2EGxCX7ibpb8mrPAFlmcwN4oPbyXot1h02Us0dlCFAZ/zFw6iNKl82WtemcPbHYIHypuR++wcxICJSooVLjjkZkVN98883tR1UwvZ8bwqgXLNbNqzBDpzgFcnxND8zM33VY3Smvz6VNojF/sY4vD/kWvrEWsJ/Ov3snFdXabAGNhCSaWKK7irPYEpHOfJLZW6VP9kknPGhgvairstIEiDcblVG8k40NOk7z6Sob2Z2t6CPHCGErQe4qQAzur2f2QFGSv1n/yOe5Xqmwmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MvsZGikbis2Mb6yAt56vU9TtTlj1EyZxxyjovFMW1/o=; b=gajusQpeiegW18pvAoMhuLoKMH6xQs90H1IRjy3rM15ktgPKf4d/oAX3F76+X9CWKQF3txsZtdZILxrxHSIZb7cWcKIh9uS14epssZX0lXEoJ8aQ6Vq4LwNXGG8DicC7mr4TrGVEHe7BV7QsayRcUtB4cNpN1L96ACQhQEKAdkY= Authentication-Results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1PR04MB6959.eurprd04.prod.outlook.com (2603:10a6:803:139::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.28; Wed, 8 Jul 2020 05:19:57 +0000 Received: from VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::4521:b667:cf06:b79b]) by VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::4521:b667:cf06:b79b%7]) with mapi id 15.20.3174.021; Wed, 8 Jul 2020 05:19:57 +0000 From: "Pankaj Bansal" To: Leif Lindholm , Meenakshi Aggarwal , devel@edk2.groups.io, Ard Biesheuvel Subject: [PATCH edk2-platforms 3/3] Silicon/NXP: Add Support for git commit info print Date: Wed, 8 Jul 2020 00:19:33 -0500 Message-ID: <20200708051933.8123-4-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200708051933.8123-1-pankaj.bansal@oss.nxp.com> References: <20200708051933.8123-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: BY5PR16CA0015.namprd16.prod.outlook.com (2603:10b6:a03:1a0::28) To VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) Return-Path: pankaj.bansal@oss.nxp.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from TFTPTOUEFI.am.freescale.net (64.157.242.222) by BY5PR16CA0015.namprd16.prod.outlook.com (2603:10b6:a03:1a0::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.24 via Frontend Transport; Wed, 8 Jul 2020 05:19:56 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [64.157.242.222] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 58037d0e-8c2f-4066-b81d-08d822fe8e33 X-MS-TrafficTypeDiagnostic: VI1PR04MB6959: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:68; X-Forefront-PRVS: 04583CED1A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sesZ5xQbqnwsrdkjxufWjO5L2Z+me9FYZl2+mTM7wQIDTYTTgq4O7Dv8kYojVCMjKV7HNWmn09ya/qsPSKMs83NCKAJBGm8ArAq85MclnMUre/GVvKKnvnrKQuw5DPHlGZdFGiuO6OZ+T9tMp+MYyALFJ1vKZy+U+lPz1QtwKyiP/hTijwONPOGNDOOv7q4ur5BcdzCUTACrPqy9TJzYmM8WcTkKua4bTbQMrXhrBVTBs3LMUuT48KC7zwP2SrGp96qO0pO37XzVjMQZsaQmSpF2vxMZnsJg1aeBUJKckwozKpRo/Vo3nldf0GP5/ZlcCOpT/WawDPwl1YX57gqAxLxUE22OxlwJ0h+Yk1yiSWGhr7ffBECVNx/HW4Q/9NSfmBrKWSlJprMKj1EON2iQtw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5933.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(376002)(346002)(396003)(39860400002)(136003)(8676002)(1076003)(6666004)(5660300002)(83380400001)(6486002)(6512007)(52116002)(19627235002)(26005)(16526019)(2906002)(186003)(86362001)(2616005)(478600001)(44832011)(6506007)(956004)(8936002)(316002)(66946007)(966005)(66556008)(110136005)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: slJrGKGWfjb16hhsrIKoC0ds3C/5unl3ug0ij9ZkbjG+49NND62Fc96hcQejztPkdKtAfBxHNj73FNJR/nuvQyt/vvAxLOc4Vx9pGeToePqV2vrAAJpG1pN4E3yI82TAEU0niiMqIyLGqbBe/H9O/eHkjENQ/L80l10bQr2Yt/e2O/vl32wRL4wMPpuGDWO82rnASYN+ltRlCA5SkQGw60X6Tgtk7Hq1Qh4TE1D03U0PWYIBYQqIqcBMysJrzBL1pQwwiZ5cNgfzBYvc6ulqv02qEZMqaxPCtTO1iMiBBXaXCJp43B7Cv+txaqgssOqFp1l0/1HQP9WyRy4QTH+m9w4zOF4ZOl2m1dSWmKyVJAywtuCGenFECLRzT2w40F+hETIA75JhuqH1iTIv16/UXlMXJ/+dHA3kHnMNe2LYJYaXzSIDqj5H1NLyjHlwH3Bg39Kgplhoxs3yreQaK6cMTEwwUtzfrtpc8s+Grpkx/zo= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58037d0e-8c2f-4066-b81d-08d822fe8e33 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5933.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2020 05:19:57.7705 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Yo/kRKaaCtM4CFm+CdQgWgzfwnKFUfjfzbxc9+HQNW4jCYzFU+zAn/4xYUPXcGAw0BGp+VpN5/W6XzDtqYU3QQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6959 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Pankaj Bansal This patch adds the Support for printing the git commit information in linux build environment. Ideal place of retrieving this information should be python script in BaseTools. A Feature request for the same has been created: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2838 Signed-off-by: Pankaj Bansal --- Silicon/NXP/NxpQoriqLs.dsc.inc | 3 ++ Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf | 5 +++ Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.inf | 5 +++ Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c | 17 +++++++++ Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.c | 17 +++++++++ Silicon/NXP/set_firmware_ver.sh | 36 ++++++++++++= ++++++++ 6 files changed, 83 insertions(+) diff --git a/Silicon/NXP/NxpQoriqLs.dsc.inc b/Silicon/NXP/NxpQoriqLs.dsc.in= c index 06ee012c227a..a0762a6ef61d 100644 --- a/Silicon/NXP/NxpQoriqLs.dsc.inc +++ b/Silicon/NXP/NxpQoriqLs.dsc.inc @@ -224,6 +224,9 @@ [PcdsDynamicHii.common.DEFAULT] gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|10 =20 [PcdsFixedAtBuild.common] + !ifdef $(FIRMWARE_VER) + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_V= ER)" + !endif gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FAL= SE diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf b/Silic= on/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf index f5dbd1349dc5..69f884af9e34 100644 --- a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf @@ -16,6 +16,7 @@ [Defines] =20 [Packages] ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/NXP/Chassis2/Chassis2.dec Silicon/NXP/NxpQoriqLs.dec @@ -24,6 +25,7 @@ [LibraryClasses] IoAccessLib IoLib PcdLib + PrintLib SerialPortLib =20 [Sources.common] @@ -31,3 +33,6 @@ [Sources.common] =20 [FeaturePcd] gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString diff --git a/Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.inf b/Sil= icon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.inf index 75b68cc4ca2d..632acc52b20a 100644 --- a/Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.inf +++ b/Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.inf @@ -16,6 +16,7 @@ [Defines] =20 [Packages] ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/NXP/Chassis3V2/Chassis3V2.dec Silicon/NXP/NxpQoriqLs.dec @@ -24,6 +25,7 @@ [LibraryClasses] IoAccessLib IoLib PcdLib + PrintLib SerialPortLib =20 [Sources.common] @@ -31,3 +33,6 @@ [Sources.common] =20 [FeaturePcd] gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c b/Silicon= /NXP/Chassis2/Library/ChassisLib/ChassisLib.c index 91b19f832f00..bc782e7e3873 100644 --- a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c @@ -12,6 +12,7 @@ #include #include #include +#include #include =20 /** @@ -89,10 +90,26 @@ ChassisInit ( VOID ) { + CHAR8 Buffer[100]; + UINTN CharCount; + // // Early init serial Port to get board information. // SerialPortInitialize (); =20 + CharCount =3D AsciiSPrint ( + Buffer, sizeof (Buffer), + "UEFI firmware built at %a on %a. version:\n\r", + __TIME__, __DATE__ + ); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + CharCount =3D AsciiSPrint ( + Buffer, sizeof (Buffer), "%s\n\r", + (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString) + ); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + SmmuInit (); } diff --git a/Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.c b/Silic= on/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.c index 30f8f945b233..6d546f4754f9 100644 --- a/Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.c +++ b/Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.c @@ -12,6 +12,7 @@ #include #include #include +#include #include =20 /** @@ -64,8 +65,24 @@ ChassisInit ( VOID ) { + CHAR8 Buffer[100]; + UINTN CharCount; + // // Early init serial Port to get board information. // SerialPortInitialize (); + + CharCount =3D AsciiSPrint ( + Buffer, sizeof (Buffer), + "UEFI firmware built at %a on %a. version:\n\r", + __TIME__, __DATE__ + ); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + CharCount =3D AsciiSPrint ( + Buffer, sizeof (Buffer), "%s\n\r", + (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString) + ); + SerialPortWrite ((UINT8 *) Buffer, CharCount); } diff --git a/Silicon/NXP/set_firmware_ver.sh b/Silicon/NXP/set_firmware_ver= .sh new file mode 100755 index 000000000000..ba2336ad23dc --- /dev/null +++ b/Silicon/NXP/set_firmware_ver.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# +# Copyright 2020 NXP +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# parse PACKAGES_PATH and set FIRMWARE_VER based on that + +get_git_version() +{ + command -v git>/dev/null 2>&1 + if [ $? -eq 0 ] && [ -n "$1" ] + then + head_or_tag=3D`git -C $1 describe --tag --dirty --broken --always 2>/d= ev/null` + printf $head_or_tag + fi +} + +if [ -n "$FIRMWARE_VER" ]; then + echo "Warning FIRMWARE_VER=3D$FIRMWARE_VER is already set" + echo "Please retry after 'unset FIRMWARE_VER' command" +fi + +directories=3D$(echo $PACKAGES_PATH | tr ":" "\n") +for dir in $directories; do + if [ -n "$FIRMWARE_VER" ]; then + FIRMWARE_VER=3D"$FIRMWARE_VER;$(basename $dir):$(get_git_version $dir)= " + else + FIRMWARE_VER=3D$(basename $dir):$(get_git_version $dir) + fi +done + +echo "FIRMWARE_VER=3D$FIRMWARE_VER" +export FIRMWARE_VER=3D$FIRMWARE_VER + +echo "build edk2 firmware with -D FIRMWARE_VER=3D\$FIRMWARE_VER" --=20 2.17.1