public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Tan, Dun" <dun.tan@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Feng, Bob C" <bob.c.feng@intel.com>,
	"Chen, Christine" <yuwei.chen@intel.com>
Cc: "Dong, Guo" <guo.dong@intel.com>,
	"Ma, Maurice" <maurice.ma@intel.com>,
	"You, Benjamin" <benjamin.you@intel.com>,
	"Liu, Zhiguang" <zhiguang.liu@intel.com>
Subject: Re: [PATCH] UefiPayloadPkg: Add script to build UniversalPayload in UefiPayloadPkg
Date: Fri, 10 Sep 2021 10:04:54 +0000	[thread overview]
Message-ID: <CO1PR11MB49302ECC7F7F1FC5F9359AB68CD69@CO1PR11MB4930.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210910081548.1816-1-dun.tan@intel.com>

+ Bob for general python language level review.
more comments embedded.

> +def BuildUniversalPayload(args, MacroList):
> +    build_target = args.Target
> +    tool_chain_tag = args.ToolChain
> +    elf_tool_chain = 'CLANGDWARF'
> +    entry_module_inf = os.path.join("UefiPayloadPkg", "UefiPayloadEntry", "UniversalPayloadEntry.inf")

1. Lots of hardcode file/directory names here.
Can we write in below way?
entry_module_inf = "UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf"
entry_module_inf = os.path.normpath(entry_module_inf)

> +    fv = os.path.join(os.environ['WORKSPACE'], "Build", "UefiPayloadPkgX64", "%s_%s"%(build_target, tool_chain_tag), "FV",
> "DXEFV.Fv")
> +    entry = os.path.join(os.environ['WORKSPACE'], "Build", "UefiPayloadPkgX64", "%s_%s"%(build_target, elf_tool_chain), "X64",
> "UefiPayloadPkg", "UefiPayloadEntry", "UniversalPayloadEntry", "DEBUG", "UniversalPayloadEntry.dll")

2.
build_directory = os.path.join(os.environ['WORKSPACE'], os.path.normpath ("Build/UefiPayloadPkgX64")
fv = os.path.join(build_directory, "%s_%s"%(build_target, tool_chain_tag), os.path.normpath("FV/DXEFV.fv"))
entry = ......

> +    dsc_patch = os.path.join("UefiPayloadPkg", "UefiPayloadPkg.dsc")

3.
Similar change can be applied to dsc_patch (typo? dsc_path?)


> +    macro_list = " "
> +    for key in MacroList:
> +        macro_list +="-D {0}={1} ".format(key, MacroList[key])

4.  you can set macro_list = "", then insert space before each "-D" in the loop.

> +
> +    #
> +    # Building DXE core and DXE drivers as DXEFV.
> +    #
> +    build_payload = "build -p %s -b %s -a X64 -t %s -y UplBuildReport.txt"%(dsc_patch, build_target, tool_chain_tag)
> +    build_payload += macro_list

5. you could write in following way
build_payload = f"build -p {dsc_patch} ..."

> +    RunCommand(build_payload)
> +    #
> +    # Building Universal Payload entry.
> +    #
> +    build_module = "build -p %s -b %s -a X64 -m %s -t %s -y UplBuildReportEntry.txt"%(dsc_patch, build_target,
> entry_module_inf, elf_tool_chain)

6. can you please make sure that there is no file generated in the workspace directory. All files are generated under build directory including the report file and the ELF file.

> +    shutil.copy (entry, os.path.join(os.environ['WORKSPACE'], 'UPL.elf'))

7. do you copy out.

> +
> +def main():
> +    print ("Begin to build Universal Payload...")

8. above message is not needed when printing help. maybe just remove the above message completely.

> +    parser = argparse.ArgumentParser(description='For build Universal Payload')
> +    parser.add_argument('-t', '--ToolChain', help="Using the ToolChain to build the UniversalPayload")
> +    parser.add_argument('-b', '--Target', help="Using the TARGET to build the UniversalPayload")

9. set TARGET to DEBUG as default?


  reply	other threads:[~2021-09-10 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10  8:15 [PATCH] UefiPayloadPkg: Add script to build UniversalPayload in UefiPayloadPkg duntan
2021-09-10 10:04 ` Ni, Ray [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-10  8:06 duntan
2021-09-10  8:01 duntan

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=CO1PR11MB49302ECC7F7F1FC5F9359AB68CD69@CO1PR11MB4930.namprd11.prod.outlook.com \
    --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