From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web10.12573.1614266154180620410 for ; Thu, 25 Feb 2021 07:15:57 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([101.86.139.83]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 25 Feb 2021 23:15:40 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 101.86.139.83 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , Cc: , , , , , , "'Matteo Carlini'" , "'Ben Adderson'" , "'nd'" References: <20210122171941.30724-1-sami.mujawar@arm.com> <20210122171941.30724-2-sami.mujawar@arm.com> <006001d70b82$e723dc20$b56b9460$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYxIDEvMl0gQXJtVmlydFBrZy9QbGF0Zm9ybUNJOiBBZGQgRURLSUkgQ0kgc3VwcG9ydCBmb3IgS3ZtdG9vbA==?= Date: Thu, 25 Feb 2021 23:15:42 +0800 Message-ID: <006301d70b89$1530be20$3f923a60$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQI/qjJiPCqZhhyweM4tW6Hf/yAQqwJHvp09APhgMccCazhqAQIrThSPqVkHzZA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Sami: New patch will be sent after soft feature freeze (SFF). According to SFF,= it will not catch this stable tag. Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Sami > Mujawar > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B42=E6=9C=8825=E6=97=A5= 22:39 > =E6=94=B6=E4=BB=B6=E4=BA=BA: gaoliming ; devel= @edk2.groups.io; > spbrogan@outlook.com > =E6=8A=84=E9=80=81: ardb+tianocore@kernel.org; leif@nuviainc.com; > sean.brogan@microsoft.com; Bret.Barkelew@microsoft.com; > michael.d.kinney@intel.com; lersek@redhat.com; Matteo Carlini > ; Ben Adderson ; nd > > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH v1 1/2] ArmVirtPkg/PlatformC= I: Add EDKII CI > support for Kvmtool >=20 > Hi All, >=20 > It appears that the --dsc parameter would fail in the stuart_setup stage= when > running in the upstream EDKII Core CI environment. For some reason it > worked for me in the local CI builds. >=20 > I am testing a v2 version of my patch at > https://github.com/samimujawar/edk2/tree/1596_kvmtool_ci_v2 and will > submit it shortly. >=20 > Regards, >=20 > Sami Mujawar >=20 > -----Original Message----- > From: gaoliming > Sent: 25 February 2021 02:31 PM > To: devel@edk2.groups.io; spbrogan@outlook.com; Sami Mujawar > > Cc: ardb+tianocore@kernel.org; leif@nuviainc.com; > sean.brogan@microsoft.com; Bret.Barkelew@microsoft.com; > michael.d.kinney@intel.com; lersek@redhat.com; Matteo Carlini > ; Ben Adderson ; nd > > Subject: =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATCH v1 1/2] ArmVirtPkg/Plat= formCI: Add > EDKII CI support for Kvmtool >=20 > Sean: >=20 > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io =E4=BB=A3=E8=A1=A8 Sean > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B42=E6=9C=8824=E6=97= =A5 6:32 > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; sami.mujawar@arm.co= m > > =E6=8A=84=E9=80=81: ardb+tianocore@kernel.org; leif@nuviainc.com; > > sean.brogan@microsoft.com; Bret.Barkelew@microsoft.com; > > michael.d.kinney@intel.com; gaoliming@byosoft.com.cn; > lersek@redhat.com; > > Matteo.Carlini@arm.com; Ben.Adderson@arm.com; nd@arm.com > > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH v1 1/2] ArmVirtPkg/Platfor= mCI: Add EDKII > CI > > support for Kvmtool > > > > Sami, > > > > Do you have these in a PR or somewhere online that is already merged? > > Obviously i can do that but usually developers already have that (eith= er > > edk2 PR for ci testing or on their fork). > > > > one comment below. > > > > Thanks > > Sean > > > > > > On 1/22/2021 9:19 AM, Sami Mujawar wrote: > > > Kvmtool is a virtual machine manager that can be used to launch > > > guest partitions. ArmVirtPkg already has UEFI (virtual/guest) > > > firmware support for Kvmtool guest. > > > > > > Therefore, update the Platform CI script to add support for > > > building the Kvmtool firmware. > > > > > > Signed-off-by: Sami Mujawar > > > --- > > > ArmVirtPkg/PlatformCI/PlatformBuild.py | 132 +++++++++++--------- > > > ArmVirtPkg/PlatformCI/ReadMe.md | 21 ++-- > > > 2 files changed, 88 insertions(+), 65 deletions(-) > > > > > > diff --git a/ArmVirtPkg/PlatformCI/PlatformBuild.py > > b/ArmVirtPkg/PlatformCI/PlatformBuild.py > > > index > > > dff653e919eb42391fc56ec44b4043a75f79d162..473f7d58d15c3e26ef5a25e2 > > 10cb679679b28131 100644 > > > --- a/ArmVirtPkg/PlatformCI/PlatformBuild.py > > > +++ b/ArmVirtPkg/PlatformCI/PlatformBuild.py > > > @@ -2,6 +2,7 @@ > > > # Script to Build ArmVirtPkg UEFI firmware > > > # > > > # Copyright (c) Microsoft Corporation. > > > +# Copyright (c) 2021, Arm Limited. All rights reserved.
> > > # SPDX-License-Identifier: BSD-2-Clause-Patent > > > ## > > > import os > > > @@ -139,7 +140,8 @@ class SettingsManager(UpdateSettingsManager, > > SetupSettingsManager, PrEvalSetting > > > > > > The tuple should be (= , > > ) > > > ''' > > > > This doesn't look right. When returning the dsc to use it should only > > return 1 dsc file. The second parameter of the tuple is for key=3Dval= ue > > pairs to process the DSC file. > > >=20 > If the second parameter is not DSC file, that means ArmVirtKvmTool.dsc i= s not > used. > So, this patch doesn't enable CI support for ArmVirtKvmTool. Right? >=20 > Thanks > Liming > > > > > - return (os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc"), {}) > > > + return (os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc"), > > > + os.path.join("ArmVirtPkg", "ArmVirtKvmTool.dsc"), {= }) > > > > > > > > > # > > > ############################################################## > > ######################### # > > > @@ -150,11 +152,15 @@ class > SettingsManager(UpdateSettingsManager, > > SetupSettingsManager, PrEvalSetting > > > class PlatformBuilder(UefiBuilder, BuildSettingsManager): > > > def __init__(self): > > > UefiBuilder.__init__(self) > > > + self.PlatformList =3D [os.path.join("ArmVirtPkg", > > "ArmVirtQemu.dsc"), > > > + os.path.join("ArmVirtPkg", > > "ArmVirtKvmTool.dsc")] > > > > > > def AddCommandLineOptions(self, parserObj): > > > ''' Add command line options to the argparser ''' > > > parserObj.add_argument('-a', "--arch", dest=3D"build_arch"= , > > type=3Dstr, default=3D"AARCH64", > > > help=3D"Optional - Architecture to > > build. Default =3D AARCH64") > > > + parserObj.add_argument('-d', "--dsc", dest=3D"active_platfo= rm", > > type=3Dstr, default=3Dself.PlatformList[0], > > > + help=3D"Optional - Platform to build= . > > Default =3D " + self.PlatformList[0]) > > > > > > def RetrieveCommandLineOptions(self, args): > > > ''' Retrieve command line options from the argparser ''' > > > @@ -162,8 +168,12 @@ class PlatformBuilder(UefiBuilder, > > BuildSettingsManager): > > > shell_environment.GetBuildVars().SetValue( > > > "TARGET_ARCH", args.build_arch.upper(), "From > > CmdLine") > > > > > > - shell_environment.GetBuildVars().SetValue( > > > - "ACTIVE_PLATFORM", "ArmVirtPkg/ArmVirtQemu.dsc", > > "From CmdLine") > > > + if (args.active_platform =3D=3D self.PlatformList[1]): > > > + shell_environment.GetBuildVars().SetValue( > > > + "ACTIVE_PLATFORM", self.PlatformList[1], "From > > CmdLine") > > > + else: > > > + shell_environment.GetBuildVars().SetValue( > > > + "ACTIVE_PLATFORM", self.PlatformList[0], "From > > CmdLine") > > > > > > def GetWorkspaceRoot(self): > > > ''' get WorkspacePath ''' > > > @@ -207,9 +217,12 @@ class PlatformBuilder(UefiBuilder, > > BuildSettingsManager): > > > > > > def SetPlatformEnv(self): > > > logging.debug("PlatformBuilder SetPlatformEnv") > > > - self.env.SetValue("PRODUCT_NAME", "ArmVirtQemu", > "Platform > > Hardcoded") > > > self.env.SetValue("MAKE_STARTUP_NSH", "FALSE", "Default > to > > false") > > > self.env.SetValue("QEMU_HEADLESS", "FALSE", "Default to > > false") > > > + if (self.env.GetValue("ACTIVE_PLATFORM") =3D=3D > > self.PlatformList[1]): > > > + self.env.SetValue("PRODUCT_NAME", "ArmVirtKvmtool", > > "Platform Hardcoded") > > > + else: > > > + self.env.SetValue("PRODUCT_NAME", "ArmVirtQemu", > > "Platform Hardcoded") > > > return 0 > > > > > > def PlatformPreBuild(self): > > > @@ -219,58 +232,61 @@ class PlatformBuilder(UefiBuilder, > > BuildSettingsManager): > > > return 0 > > > > > > def FlashRomImage(self): > > > - VirtualDrive =3D os.path.join(self.env.GetValue( > > > - "BUILD_OUTPUT_BASE"), "VirtualDrive") > > > - os.makedirs(VirtualDrive, exist_ok=3DTrue) > > > - OutputPath_FV =3D os.path.join( > > > - self.env.GetValue("BUILD_OUTPUT_BASE"), "FV") > > > - Built_FV =3D os.path.join(OutputPath_FV, "QEMU_EFI.fd") > > > - > > > - # pad fd to 64mb > > > - with open(Built_FV, "ab") as fvfile: > > > - fvfile.seek(0, os.SEEK_END) > > > - additional =3D b'\0' * ((64 * 1024 * 1024)-fvfile.tell(= )) > > > - fvfile.write(additional) > > > - > > > - # QEMU must be on that path > > > - > > > - # Unique Command and Args parameters per ARCH > > > - if (self.env.GetValue("TARGET_ARCH").upper() =3D=3D "AARCH6= 4"): > > > - cmd =3D "qemu-system-aarch64" > > > - args =3D "-M virt" > > > - args +=3D " -cpu cortex-a57" > > # emulate cpu > > > - elif(self.env.GetValue("TARGET_ARCH").upper() =3D=3D "ARM")= : > > > - cmd =3D "qemu-system-arm" > > > - args =3D "-M virt" > > > - args +=3D " -cpu cortex-a15" > > # emulate cpu > > > + if (self.env.GetValue("ACTIVE_PLATFORM") =3D=3D > > self.PlatformList[1]): > > > + return 0 > > > else: > > > - raise NotImplementedError() > > > - > > > - # Common Args > > > - args +=3D " -pflash " + Built_FV > > # path to fw > > > - args +=3D " -m 1024" > > # 1gb memory > > > - # turn off network > > > - args +=3D " -net none" > > > - # Serial messages out > > > - args +=3D " -serial stdio" > > > - # Mount disk with startup.nsh > > > - args +=3D f" -drive > > file=3Dfat:rw:{VirtualDrive},format=3Draw,media=3Ddisk" > > > - > > > - # Conditional Args > > > - if (self.env.GetValue("QEMU_HEADLESS").upper() =3D=3D "TRUE= "): > > > - args +=3D " -display none" # no graphics > > > - > > > - if (self.env.GetValue("MAKE_STARTUP_NSH").upper() =3D=3D > "TRUE"): > > > - f =3D open(os.path.join(VirtualDrive, "startup.nsh"), "= w") > > > - f.write("BOOT SUCCESS !!! \n") > > > - # add commands here > > > - f.write("reset -s\n") > > > - f.close() > > > - > > > - ret =3D RunCmd(cmd, args) > > > - > > > - if ret =3D=3D 0xc0000005: > > > - # for some reason getting a c0000005 on successful retu= rn > > > - return 0 > > > - > > > - return ret > > > + VirtualDrive =3D os.path.join(self.env.GetValue( > > > + "BUILD_OUTPUT_BASE"), "VirtualDrive") > > > + os.makedirs(VirtualDrive, exist_ok=3DTrue) > > > + OutputPath_FV =3D os.path.join( > > > + self.env.GetValue("BUILD_OUTPUT_BASE"), "FV") > > > + Built_FV =3D os.path.join(OutputPath_FV, "QEMU_EFI.fd= ") > > > + > > > + # pad fd to 64mb > > > + with open(Built_FV, "ab") as fvfile: > > > + fvfile.seek(0, os.SEEK_END) > > > + additional =3D b'\0' * ((64 * 1024 * 1024)-fvfile= .tell()) > > > + fvfile.write(additional) > > > + > > > + # QEMU must be on that path > > > + > > > + # Unique Command and Args parameters per ARCH > > > + if (self.env.GetValue("TARGET_ARCH").upper() =3D=3D > > "AARCH64"): > > > + cmd =3D "qemu-system-aarch64" > > > + args =3D "-M virt" > > > + args +=3D " -cpu cortex-a57" > > # emulate cpu > > > + elif(self.env.GetValue("TARGET_ARCH").upper() =3D=3D > > "ARM"): > > > + cmd =3D "qemu-system-arm" > > > + args =3D "-M virt" > > > + args +=3D " -cpu cortex-a15" > > # emulate cpu > > > + else: > > > + raise NotImplementedError() > > > + > > > + # Common Args > > > + args +=3D " -pflash " + Built_FV > > # path to fw > > > + args +=3D " -m 1024" > > # 1gb memory > > > + # turn off network > > > + args +=3D " -net none" > > > + # Serial messages out > > > + args +=3D " -serial stdio" > > > + # Mount disk with startup.nsh > > > + args +=3D f" -drive > > file=3Dfat:rw:{VirtualDrive},format=3Draw,media=3Ddisk" > > > + > > > + # Conditional Args > > > + if (self.env.GetValue("QEMU_HEADLESS").upper() =3D=3D > > "TRUE"): > > > + args +=3D " -display none" # no graphics > > > + > > > + if (self.env.GetValue("MAKE_STARTUP_NSH").upper() > =3D=3D > > "TRUE"): > > > + f =3D open(os.path.join(VirtualDrive, "startup.ns= h"), > > "w") > > > + f.write("BOOT SUCCESS !!! \n") > > > + # add commands here > > > + f.write("reset -s\n") > > > + f.close() > > > + > > > + ret =3D RunCmd(cmd, args) > > > + > > > + if ret =3D=3D 0xc0000005: > > > + # for some reason getting a c0000005 on > successful > > return > > > + return 0 > > > + > > > + return ret > > > diff --git a/ArmVirtPkg/PlatformCI/ReadMe.md > > b/ArmVirtPkg/PlatformCI/ReadMe.md > > > index > > > 7c11d925f59ede4717d4b210df9d2b97f755ebd8..98a3ca91f40c075bf1a2069 > > edd99e9680a1252e9 100644 > > > --- a/ArmVirtPkg/PlatformCI/ReadMe.md > > > +++ b/ArmVirtPkg/PlatformCI/ReadMe.md > > > @@ -6,13 +6,14 @@ to use the same Pytools based build infrastructure > > locally. > > > ## Supported Configuration Details > > > > > > This solution for building and running ArmVirtPkg has only been > validated > > with Ubuntu > > > -18.04 and the GCC5 toolchain. Two different firmware builds are > supported > > and are > > > -described below. > > > +18.04 and the GCC5 toolchain. The supported firmware builds are > > described below. > > > > > > -| Configuration name | Architecture | DSC File > > |Additional Flags | > > > -| :---------- | :----- | :----- > > | :---- | > > > -| AARCH64 | AARCH64 | > > ArmVirtQemu.dsc | None | > > > -| ARM | ARM | > > ArmVirtQemu.dsc | None | > > > +| Configuration name | Architecture | DSC File > > |Additional Flags | > > > +| :---------- | :----- | :----- > > | :---- | > > > +| AARCH64 | AARCH64 | > > ArmVirtQemu.dsc | None | > > > +| ARM | ARM | > > ArmVirtQemu.dsc | None | > > > +| AARCH64 | AARCH64 | > > ArmVirtKvmTool.dsc | None | > > > +| ARM | ARM | > > ArmVirtKvmTool.dsc | None | > > > > > > ## EDK2 Developer environment > > > > > > @@ -79,7 +80,13 @@ Pytools build system. > > > ``` > > > > > > - use `stuart_build -c ArmVirtPkg/PlatformCI/PlatformBuild.py = -h` > > option to see additional > > > - options like `--clean` > > > + options like `--clean`, `--dsc`, etc. > > > + > > > + Example: The `--dsc` option can be used to specify the platform= to > > build. > > > + > > > + ``` bash > > > + stuart_build -c ArmVirtPkg/PlatformCI/PlatformBuild.py > > TOOL_CHAIN_TAG=3D -a --dsc > > ArmVirtPkg/ArmVirtKvmTool.dsc > > > + ``` > > > > > > 8. Running Emulator > > > - You can add `--FlashRom` to the end of your build command an= d > > the emulator will run after the > > > > > > > > > > > >=20 >=20 >=20 >=20 >=20 >=20 >=20