public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools: Add embedded driver support to GenerateCapsule.py
@ 2019-03-20 17:18 Tomas Pilar (tpilar)
  2019-03-20 20:00 ` Kinney, Michael D
  0 siblings, 1 reply; 3+ messages in thread
From: Tomas Pilar (tpilar) @ 2019-03-20 17:18 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Tomas Pilar <tpilar@solarflare.com>
---
 .../Source/Python/Capsule/GenerateCapsule.py  | 25 ++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
index 7b08918857..4b275b092b 100644
--- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
+++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
@@ -9,8 +9,7 @@
 # system firmware or device firmware for integrated devices.  In order to
 # keep the tool as simple as possible, it has the following limitations:
 #   * Do not support multiple payloads in a capsule.
-#   * Do not support optional drivers in a capsule.
-#   * Do not support vendor code bytes in a capsule.
+#   * Support at most one optional driver in a capsule.
 #
 # Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
@@ -236,6 +235,12 @@ if __name__ == '__main__':
                         help = "Input binary payload filename.")
     parser.add_argument("-o", "--output", dest = 'OutputFile', type = argparse.FileType('wb'),
                         help = "Output filename.")
+
+    #
+    # Add optional embedded driver and vendor code arguments
+    #
+    parser.add_argument("--driver", dest = 'Driver', type = argparse.FileType('rb'),
+                        help = "Input binary embedded driver to package alongside the image")
     #
     # Add group for -e and -d flags that are mutually exclusive and required
     #
@@ -355,7 +360,7 @@ if __name__ == '__main__':
             parser.error ('the following option is not supported for dumpinfo operations: --output')
 
     #
-    # Read binary input file
+    # Read binary input files
     #
     try:
         if args.Verbose:
@@ -366,6 +371,17 @@ if __name__ == '__main__':
         print ('GenerateCapsule: error: can not read binary input file {File}'.format (File = args.InputFile.name))
         sys.exit (1)
 
+    DriverBuffer = b''
+    if args.Driver:
+        try:
+            if args.Verbose:
+                print ('Read binary embedded driver {File}'.format (File = args.Driver.name))
+            DriverBuffer = args.Driver.read ()
+            args.Driver.close ()
+        except:
+            print ('GenerateCapsule: error: can not read supplied binary embedded driver file {File}'.format (File = args.Driver.name))
+            sys.exit (1)
+
     #
     # Create objects
     #
@@ -423,6 +439,9 @@ if __name__ == '__main__':
 
         try:
             FmpCapsuleHeader.AddPayload (args.Guid, Result, HardwareInstance = args.HardwareInstance)
+            if args.Driver:
+                FmpCapsuleHeader.AddEmbeddedDriver(DriverBuffer)
+
             Result = FmpCapsuleHeader.Encode ()
             if args.Verbose:
                 FmpCapsuleHeader.DumpInfo ()
-- 
2.17.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] BaseTools: Add embedded driver support to GenerateCapsule.py
  2019-03-20 17:18 [PATCH] BaseTools: Add embedded driver support to GenerateCapsule.py Tomas Pilar (tpilar)
@ 2019-03-20 20:00 ` Kinney, Michael D
  2019-03-21 10:27   ` Tomas Pilar (tpilar)
  0 siblings, 1 reply; 3+ messages in thread
From: Kinney, Michael D @ 2019-03-20 20:00 UTC (permalink / raw)
  To: Tomas Pilar (tpilar), edk2-devel@lists.01.org, Kinney, Michael D

Hi Tomas,

Thanks for the contribution.  I agree we need this feature.
We have been working on updates to GenerateCapsule that
add support for one or more embedded drivers and multiple
payloads and the option to provide all the configuration
information in a JSON file.  It also extends decode
and dumpinfo to show the embedded drivers.  We will post
patch with all those features very soon.

Thanks,

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org]
> On Behalf Of Tomas Pilar (tpilar)
> Sent: Wednesday, March 20, 2019 10:18 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH] BaseTools: Add embedded driver
> support to GenerateCapsule.py
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Tomas Pilar <tpilar@solarflare.com>
> ---
>  .../Source/Python/Capsule/GenerateCapsule.py  | 25
> ++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git
> a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
> b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
> index 7b08918857..4b275b092b 100644
> --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
> +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
> @@ -9,8 +9,7 @@
>  # system firmware or device firmware for integrated
> devices.  In order to
>  # keep the tool as simple as possible, it has the
> following limitations:
>  #   * Do not support multiple payloads in a capsule.
> -#   * Do not support optional drivers in a capsule.
> -#   * Do not support vendor code bytes in a capsule.
> +#   * Support at most one optional driver in a capsule.
>  #
>  # Copyright (c) 2018, Intel Corporation. All rights
> reserved.<BR>
>  # This program and the accompanying materials
> @@ -236,6 +235,12 @@ if __name__ == '__main__':
>                          help = "Input binary payload
> filename.")
>      parser.add_argument("-o", "--output", dest =
> 'OutputFile', type = argparse.FileType('wb'),
>                          help = "Output filename.")
> +
> +    #
> +    # Add optional embedded driver and vendor code
> arguments
> +    #
> +    parser.add_argument("--driver", dest = 'Driver',
> type = argparse.FileType('rb'),
> +                        help = "Input binary embedded
> driver to package alongside the image")
>      #
>      # Add group for -e and -d flags that are mutually
> exclusive and required
>      #
> @@ -355,7 +360,7 @@ if __name__ == '__main__':
>              parser.error ('the following option is not
> supported for dumpinfo operations: --output')
> 
>      #
> -    # Read binary input file
> +    # Read binary input files
>      #
>      try:
>          if args.Verbose:
> @@ -366,6 +371,17 @@ if __name__ == '__main__':
>          print ('GenerateCapsule: error: can not read
> binary input file {File}'.format (File =
> args.InputFile.name))
>          sys.exit (1)
> 
> +    DriverBuffer = b''
> +    if args.Driver:
> +        try:
> +            if args.Verbose:
> +                print ('Read binary embedded driver
> {File}'.format (File = args.Driver.name))
> +            DriverBuffer = args.Driver.read ()
> +            args.Driver.close ()
> +        except:
> +            print ('GenerateCapsule: error: can not read
> supplied binary embedded driver file {File}'.format (File
> = args.Driver.name))
> +            sys.exit (1)
> +
>      #
>      # Create objects
>      #
> @@ -423,6 +439,9 @@ if __name__ == '__main__':
> 
>          try:
>              FmpCapsuleHeader.AddPayload (args.Guid,
> Result, HardwareInstance = args.HardwareInstance)
> +            if args.Driver:
> +
> FmpCapsuleHeader.AddEmbeddedDriver(DriverBuffer)
> +
>              Result = FmpCapsuleHeader.Encode ()
>              if args.Verbose:
>                  FmpCapsuleHeader.DumpInfo ()
> --
> 2.17.2
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] BaseTools: Add embedded driver support to GenerateCapsule.py
  2019-03-20 20:00 ` Kinney, Michael D
@ 2019-03-21 10:27   ` Tomas Pilar (tpilar)
  0 siblings, 0 replies; 3+ messages in thread
From: Tomas Pilar (tpilar) @ 2019-03-21 10:27 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org

Hi Mike,

Thank you, that is great news!

Cheers,
Tom

On 20/03/2019 20:00, Kinney, Michael D wrote:
> Hi Tomas,
>
> Thanks for the contribution.  I agree we need this feature.
> We have been working on updates to GenerateCapsule that
> add support for one or more embedded drivers and multiple
> payloads and the option to provide all the configuration
> information in a JSON file.  It also extends decode
> and dumpinfo to show the embedded drivers.  We will post
> patch with all those features very soon.
>
> Thanks,
>
> Mike
>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org]
>> On Behalf Of Tomas Pilar (tpilar)
>> Sent: Wednesday, March 20, 2019 10:18 AM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] [PATCH] BaseTools: Add embedded driver
>> support to GenerateCapsule.py
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Tomas Pilar <tpilar@solarflare.com>
>> ---
>>  .../Source/Python/Capsule/GenerateCapsule.py  | 25
>> ++++++++++++++++---
>>  1 file changed, 22 insertions(+), 3 deletions(-)
>>
>> diff --git
>> a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
>> b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
>> index 7b08918857..4b275b092b 100644
>> --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
>> +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
>> @@ -9,8 +9,7 @@
>>  # system firmware or device firmware for integrated
>> devices.  In order to
>>  # keep the tool as simple as possible, it has the
>> following limitations:
>>  #   * Do not support multiple payloads in a capsule.
>> -#   * Do not support optional drivers in a capsule.
>> -#   * Do not support vendor code bytes in a capsule.
>> +#   * Support at most one optional driver in a capsule.
>>  #
>>  # Copyright (c) 2018, Intel Corporation. All rights
>> reserved.<BR>
>>  # This program and the accompanying materials
>> @@ -236,6 +235,12 @@ if __name__ == '__main__':
>>                          help = "Input binary payload
>> filename.")
>>      parser.add_argument("-o", "--output", dest =
>> 'OutputFile', type = argparse.FileType('wb'),
>>                          help = "Output filename.")
>> +
>> +    #
>> +    # Add optional embedded driver and vendor code
>> arguments
>> +    #
>> +    parser.add_argument("--driver", dest = 'Driver',
>> type = argparse.FileType('rb'),
>> +                        help = "Input binary embedded
>> driver to package alongside the image")
>>      #
>>      # Add group for -e and -d flags that are mutually
>> exclusive and required
>>      #
>> @@ -355,7 +360,7 @@ if __name__ == '__main__':
>>              parser.error ('the following option is not
>> supported for dumpinfo operations: --output')
>>
>>      #
>> -    # Read binary input file
>> +    # Read binary input files
>>      #
>>      try:
>>          if args.Verbose:
>> @@ -366,6 +371,17 @@ if __name__ == '__main__':
>>          print ('GenerateCapsule: error: can not read
>> binary input file {File}'.format (File =
>> args.InputFile.name))
>>          sys.exit (1)
>>
>> +    DriverBuffer = b''
>> +    if args.Driver:
>> +        try:
>> +            if args.Verbose:
>> +                print ('Read binary embedded driver
>> {File}'.format (File = args.Driver.name))
>> +            DriverBuffer = args.Driver.read ()
>> +            args.Driver.close ()
>> +        except:
>> +            print ('GenerateCapsule: error: can not read
>> supplied binary embedded driver file {File}'.format (File
>> = args.Driver.name))
>> +            sys.exit (1)
>> +
>>      #
>>      # Create objects
>>      #
>> @@ -423,6 +439,9 @@ if __name__ == '__main__':
>>
>>          try:
>>              FmpCapsuleHeader.AddPayload (args.Guid,
>> Result, HardwareInstance = args.HardwareInstance)
>> +            if args.Driver:
>> +
>> FmpCapsuleHeader.AddEmbeddedDriver(DriverBuffer)
>> +
>>              Result = FmpCapsuleHeader.Encode ()
>>              if args.Verbose:
>>                  FmpCapsuleHeader.DumpInfo ()
>> --
>> 2.17.2
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-21 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-20 17:18 [PATCH] BaseTools: Add embedded driver support to GenerateCapsule.py Tomas Pilar (tpilar)
2019-03-20 20:00 ` Kinney, Michael D
2019-03-21 10:27   ` Tomas Pilar (tpilar)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox