From: Pankaj Bansal <pankaj.bansal@nxp.com>
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=2838
Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
---
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.inc
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"|gEfiGlobalVariableGuid|0x0|10
[PcdsFixedAtBuild.common]
+ !ifdef $(FIRMWARE_VER)
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
+ !endif
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf b/Silicon/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]
[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
[Sources.common]
@@ -31,3 +33,6 @@ [Sources.common]
[FeaturePcd]
gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian
+
+[FixedPcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
diff --git a/Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.inf b/Silicon/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]
[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
[Sources.common]
@@ -31,3 +33,6 @@ [Sources.common]
[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 <Library/IoAccessLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
+#include <Library/PrintLib.h>
#include <Library/SerialPortLib.h>
/**
@@ -89,10 +90,26 @@ ChassisInit (
VOID
)
{
+ CHAR8 Buffer[100];
+ UINTN CharCount;
+
//
// Early init serial Port to get board information.
//
SerialPortInitialize ();
+ CharCount = AsciiSPrint (
+ Buffer, sizeof (Buffer),
+ "UEFI firmware built at %a on %a. version:\n\r",
+ __TIME__, __DATE__
+ );
+ SerialPortWrite ((UINT8 *) Buffer, CharCount);
+
+ CharCount = 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/Silicon/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 <Library/IoAccessLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
+#include <Library/PrintLib.h>
#include <Library/SerialPortLib.h>
/**
@@ -64,8 +65,24 @@ ChassisInit (
VOID
)
{
+ CHAR8 Buffer[100];
+ UINTN CharCount;
+
//
// Early init serial Port to get board information.
//
SerialPortInitialize ();
+
+ CharCount = AsciiSPrint (
+ Buffer, sizeof (Buffer),
+ "UEFI firmware built at %a on %a. version:\n\r",
+ __TIME__, __DATE__
+ );
+ SerialPortWrite ((UINT8 *) Buffer, CharCount);
+
+ CharCount = 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=`git -C $1 describe --tag --dirty --broken --always 2>/dev/null`
+ printf $head_or_tag
+ fi
+}
+
+if [ -n "$FIRMWARE_VER" ]; then
+ echo "Warning FIRMWARE_VER=$FIRMWARE_VER is already set"
+ echo "Please retry after 'unset FIRMWARE_VER' command"
+fi
+
+directories=$(echo $PACKAGES_PATH | tr ":" "\n")
+for dir in $directories; do
+ if [ -n "$FIRMWARE_VER" ]; then
+ FIRMWARE_VER="$FIRMWARE_VER;$(basename $dir):$(get_git_version $dir)"
+ else
+ FIRMWARE_VER=$(basename $dir):$(get_git_version $dir)
+ fi
+done
+
+echo "FIRMWARE_VER=$FIRMWARE_VER"
+export FIRMWARE_VER=$FIRMWARE_VER
+
+echo "build edk2 firmware with -D FIRMWARE_VER=\$FIRMWARE_VER"
--
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#62215): https://edk2.groups.io/g/devel/message/62215
Mute This Topic: https://groups.io/mt/75371035/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
On Wed, Jul 08, 2020 at 00:19:33 -0500, Pankaj Bansal wrote:
> From: Pankaj Bansal <pankaj.bansal@nxp.com>
>
> 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=2838
>
> Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
> ---
> 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.inc
> 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"|gEfiGlobalVariableGuid|0x0|10
>
> [PcdsFixedAtBuild.common]
> + !ifdef $(FIRMWARE_VER)
> + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
> + !endif
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
> diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf b/Silicon/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]
>
> [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
>
> [Sources.common]
> @@ -31,3 +33,6 @@ [Sources.common]
>
> [FeaturePcd]
> gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian
> +
> +[FixedPcd]
> + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
> diff --git a/Silicon/NXP/Chassis3V2/Library/ChassisLib/ChassisLib.inf b/Silicon/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]
>
> [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
>
> [Sources.common]
> @@ -31,3 +33,6 @@ [Sources.common]
>
> [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 <Library/IoAccessLib.h>
> #include <Library/IoLib.h>
> #include <Library/PcdLib.h>
> +#include <Library/PrintLib.h>
> #include <Library/SerialPortLib.h>
>
> /**
> @@ -89,10 +90,26 @@ ChassisInit (
> VOID
> )
> {
> + CHAR8 Buffer[100];
> + UINTN CharCount;
> +
> //
> // Early init serial Port to get board information.
> //
> SerialPortInitialize ();
>
> + CharCount = AsciiSPrint (
> + Buffer, sizeof (Buffer),
> + "UEFI firmware built at %a on %a. version:\n\r",
> + __TIME__, __DATE__
> + );
> + SerialPortWrite ((UINT8 *) Buffer, CharCount);
Drop space before Buffer.
> +
> + CharCount = 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/Silicon/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 <Library/IoAccessLib.h>
> #include <Library/IoLib.h>
> #include <Library/PcdLib.h>
> +#include <Library/PrintLib.h>
> #include <Library/SerialPortLib.h>
>
> /**
> @@ -64,8 +65,24 @@ ChassisInit (
> VOID
> )
> {
> + CHAR8 Buffer[100];
> + UINTN CharCount;
> +
> //
> // Early init serial Port to get board information.
> //
> SerialPortInitialize ();
> +
> + CharCount = AsciiSPrint (
> + Buffer, sizeof (Buffer),
> + "UEFI firmware built at %a on %a. version:\n\r",
> + __TIME__, __DATE__
> + );
> + SerialPortWrite ((UINT8 *) Buffer, CharCount);
Drop space before Buffer.
I will note here that you are adding identical content to two
different ChassisLib implementations.
This is a strong indicator that the abstraction level is currently
incorrect and should be revisited.
> +
> + CharCount = 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
This script doesn't *set* anything (which is good, since I would have
rejected that outright), so the name should reflect the actual function.
> 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
This too should reflect actual function.
> +
> +get_git_version()
> +{
> + command -v git>/dev/null 2>&1
> + if [ $? -eq 0 ] && [ -n "$1" ]
> + then
> + head_or_tag=`git -C $1 describe --tag --dirty --broken --always 2>/dev/null`
> + printf $head_or_tag
> + fi
> +}
> +
> +if [ -n "$FIRMWARE_VER" ]; then
> + echo "Warning FIRMWARE_VER=$FIRMWARE_VER is already set"
> + echo "Please retry after 'unset FIRMWARE_VER' command"
> +fi
Just do
FIRMWARE_VER=
before the first code in the script.
> +
> +directories=$(echo $PACKAGES_PATH | tr ":" "\n")
Could set IFS=: instead, it would have the same effect.
> +for dir in $directories; do
> + if [ -n "$FIRMWARE_VER" ]; then
> + FIRMWARE_VER="$FIRMWARE_VER;$(basename $dir):$(get_git_version $dir)"
> + else
> + FIRMWARE_VER=$(basename $dir):$(get_git_version $dir)
> + fi
> +done
> +
> +echo "FIRMWARE_VER=$FIRMWARE_VER"
> +export FIRMWARE_VER=$FIRMWARE_VER
What is this line supposed to achieve?
/
Leif
> +
> +echo "build edk2 firmware with -D FIRMWARE_VER=\$FIRMWARE_VER"
> --
> 2.17.1
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#63724): https://edk2.groups.io/g/devel/message/63724
Mute This Topic: https://groups.io/mt/75371035/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
> > 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 <Library/IoAccessLib.h>
> > #include <Library/IoLib.h>
> > #include <Library/PcdLib.h>
> > +#include <Library/PrintLib.h>
> > #include <Library/SerialPortLib.h>
> >
> > /**
> > @@ -89,10 +90,26 @@ ChassisInit (
> > VOID
> > )
> > {
> > + CHAR8 Buffer[100];
> > + UINTN CharCount;
> > +
> > //
> > // Early init serial Port to get board information.
> > //
> > SerialPortInitialize ();
> >
> > + CharCount = AsciiSPrint (
> > + Buffer, sizeof (Buffer),
> > + "UEFI firmware built at %a on %a. version:\n\r",
> > + __TIME__, __DATE__
> > + );
> > + SerialPortWrite ((UINT8 *) Buffer, CharCount);
>
> Drop space before Buffer.
OK.
>
> > +
> > + CharCount = 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/Silicon/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 <Library/IoAccessLib.h>
> > #include <Library/IoLib.h>
> > #include <Library/PcdLib.h>
> > +#include <Library/PrintLib.h>
> > #include <Library/SerialPortLib.h>
> >
> > /**
> > @@ -64,8 +65,24 @@ ChassisInit (
> > VOID
> > )
> > {
> > + CHAR8 Buffer[100];
> > + UINTN CharCount;
> > +
> > //
> > // Early init serial Port to get board information.
> > //
> > SerialPortInitialize ();
> > +
> > + CharCount = AsciiSPrint (
> > + Buffer, sizeof (Buffer),
> > + "UEFI firmware built at %a on %a. version:\n\r",
> > + __TIME__, __DATE__
> > + );
> > + SerialPortWrite ((UINT8 *) Buffer, CharCount);
>
> Drop space before Buffer.
OK.
>
> I will note here that you are adding identical content to two
> different ChassisLib implementations.
>
> This is a strong indicator that the abstraction level is currently
> incorrect and should be revisited.
>
I am preparing the patches to get the core/cluster info in NXP SOCs.
I will move the version print in that code.
> > +
> > + CharCount = 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
>
> This script doesn't *set* anything (which is good, since I would have
> rejected that outright), so the name should reflect the actual function.
it *does* set the FIRMWARE_VER environment variable.
FIRMWARE_VER is just like WORKSPACE and PACKAGES_PATH.
>
> > 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
>
> This too should reflect actual function.
see explanation above.
>
> > +
> > +get_git_version()
> > +{
> > + command -v git>/dev/null 2>&1
> > + if [ $? -eq 0 ] && [ -n "$1" ]
> > + then
> > + head_or_tag=`git -C $1 describe --tag --dirty --broken --always 2>/dev/null`
> > + printf $head_or_tag
> > + fi
> > +}
> > +
> > +if [ -n "$FIRMWARE_VER" ]; then
> > + echo "Warning FIRMWARE_VER=$FIRMWARE_VER is already set"
> > + echo "Please retry after 'unset FIRMWARE_VER' command"
> > +fi
>
> Just do
> FIRMWARE_VER=
> before the first code in the script.
OK.
>
> > +
> > +directories=$(echo $PACKAGES_PATH | tr ":" "\n")
>
> Could set IFS=: instead, it would have the same effect.
Good suggestion. will modify.
>
> > +for dir in $directories; do
> > + if [ -n "$FIRMWARE_VER" ]; then
> > + FIRMWARE_VER="$FIRMWARE_VER;$(basename $dir):$(get_git_version
> $dir)"
> > + else
> > + FIRMWARE_VER=$(basename $dir):$(get_git_version $dir)
> > + fi
> > +done
> > +
> > +echo "FIRMWARE_VER=$FIRMWARE_VER"
> > +export FIRMWARE_VER=$FIRMWARE_VER
>
> What is this line supposed to achieve?
It would set the FIRMWARE_VER environment variable when "set_firmware_ver.sh" script is executed.
After that user can build platform firmware with -D FIRMWARE_VER=$ FIRMWARE_VER flag.
I have put this suggestion for users in "set_firmware_ver.sh" script.
>
> /
> Leif
>
> > +
> > +echo "build edk2 firmware with -D FIRMWARE_VER=\$FIRMWARE_VER"
> > --
> > 2.17.1
> >
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#63892): https://edk2.groups.io/g/devel/message/63892
Mute This Topic: https://groups.io/mt/75371035/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Pankaj,
Apologies for slow response - having a bit of a heatwave and no AC...
On Sat, Aug 08, 2020 at 02:39:32 +0000, Pankaj Bansal (OSS) wrote:
> > I will note here that you are adding identical content to two
> > different ChassisLib implementations.
> >
> > This is a strong indicator that the abstraction level is currently
> > incorrect and should be revisited.
>
> I am preparing the patches to get the core/cluster info in NXP SOCs.
> I will move the version print in that code.
Works for me.
> > > +
> > > + CharCount = 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
> >
> > This script doesn't *set* anything (which is good, since I would have
> > rejected that outright), so the name should reflect the actual function.
>
> it *does* set the FIRMWARE_VER environment variable.
> FIRMWARE_VER is just like WORKSPACE and PACKAGES_PATH.
1) OK, so the expectation is that this script should be sourced?
This is not mentioned in the commit message, in comments in the
script itself, and it does not warn you about that if you simply
run it.
2) It's not like WORKSPACE or PACKAGES_PATH. Nothing in the EDK2
BuildTools environment looks at FIRMWARE_VER.
3) It relies on PACKAGES_PATH being set in the environment.
So if I try to deduce the undocumented intended build steps, this
patch intends for the user to execute
$ . <edk2-platforms>/Silicon/NXP/set_firmware_ver.sh
which then prints for me that I should
"build edk2 firmware with -D FIRMWARE_VER=$FIRMWARE_VER"
This is not something that is of any use outside of your own build
infrastructure, so I would suggest you keep it downstream.
Having a generic (and portable) way of printing what you're currently
building isn't a bad idea however. If you were willing to create a
script for BaseTools based on roughly the below mechanics:
---
from __future__ import print_function
import os
import git
PACKAGES = os.environ['PACKAGES_PATH'].split(':')
# Trim empty entries caused by leading/trailing delimiter
try:
while True:
PACKAGES.remove('')
except ValueError:
pass
for package in PACKAGES:
REPO = git.Repo(path=package)
HEAD = REPO.head
SHA = REPO.git.rev_parse(HEAD, short=12)
if REPO.is_dirty():
STATE = 'dirty'
else:
STATE = 'clean'
print('%s: %s-%s' % (os.path.basename(package), SHA, STATE))
---
I think that would be a lot more useful. If you were to add some
BinWrappers as well, you could then add in your build instructions to
use -D FIRMWARE_VER="`commandname`"
/
Leif
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#64069): https://edk2.groups.io/g/devel/message/64069
Mute This Topic: https://groups.io/mt/75371035/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.