public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm" <leif@nuviainc.com>
To: "Pankaj Bansal (OSS)" <pankaj.bansal@oss.nxp.com>
Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [PATCH edk2-platforms 3/3] Silicon/NXP: Add Support for git commit info print
Date: Wed, 12 Aug 2020 13:45:39 +0100	[thread overview]
Message-ID: <20200812124539.GR23500@vanye> (raw)
In-Reply-To: <VI1PR04MB5933793A4B94BEA3C5CE61B8F1460@VI1PR04MB5933.eurprd04.prod.outlook.com>

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

      reply	other threads:[~2020-08-12 12:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08  5:19 [PATCH edk2-platforms 0/3] Add Features to NXP Platforms Pankaj Bansal
2020-07-08  5:19 ` [PATCH edk2-platforms 1/3] Silicon/NXP: Use runtime safe version of DebugLib Pankaj Bansal
2020-08-05 14:11   ` Leif Lindholm
2020-07-08  5:19 ` [PATCH edk2-platforms 2/3] Silicon/NXP: Add support for reserving a chunk from RAM Pankaj Bansal
2020-07-18 17:32   ` Pankaj Bansal
2020-08-05 15:12   ` Leif Lindholm
2020-08-05 19:16     ` [EXTERNAL] Re: [edk2-devel] " Bret Barkelew
2020-07-08  5:19 ` [PATCH edk2-platforms 3/3] Silicon/NXP: Add Support for git commit info print Pankaj Bansal
2020-08-05 14:44   ` Leif Lindholm
2020-08-08  2:39     ` Pankaj Bansal
2020-08-12 12:45       ` Leif Lindholm [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200812124539.GR23500@vanye \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox