Linaro have been carrying a few small patches in our tree for some months now; they have proven valuable and stable, so we'd like to push them upstream.
The first few patches configure the platforms with some simple default values and some extra build options.
[PATCH 1/9] ArmPlatformPkg/ArmVExpressPkg: Add support for EDK2_OUT_DIR build parameter [PATCH 2/9] ArmPlatformPkg/ArmVExpressPkg: CTA15-A7: Allow EDK2_SKIP_PEICORE to be specified at build time [PATCH 3/9] ArmPlatformPkg/ArmVExpressPkg: CTA9x4: default to EDK2_ARMVE_STANDALONE=1
There is a patch to fix shutdown on Versatile Express platforms:
[PATCH 4/9] ArmPlatformPkg/ArmVExpressPkg: add Shutdown support
There is a small fix for a case sensitivity problem in the ARM BDS:
[PATCH 5/9] ArmPlatformPkg/Bds: Make ".EFI" files recognizable as
Then there are some small improvements to the menu options in ARM BDS:
[PATCH 6/9] ArmPlatformPkg/Bds: use letters for hard coded boot menu [PATCH 7/9] ArmPlatformPkg/Bds: Add Reboot and Shutdown options to main menu [PATCH 8/9] ArmPlatformPkg/Bds: show global FDT config in main menu
Finally, there is a larger patch to allow each boot configuration to specify it's own Flattened Device Tree binary. This is important in our automated build systems, because as the DTB evolves, our "master" image may end up with a different DTB than the image under test.
[PATCH 9/9] ArmPlatformPkg/Bds: add local FDT config
Regards, Ryan.
In-Reply-To:
Add support to the build config to allow the user to specify a custom output directory to the build.
This is particularly useful for automated build systems.
Eg. build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t ARMLINUXGCC \ -D EDK2_ARMVE_STANDALONE=1 \ -D EDK2_OUT_DIR=Build/vea9
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- .../ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 4 ++++ .../ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 4 ++-- .../ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 4 ++++ .../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 4 ++++ .../ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc | 4 ++++ 5 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc index 17aba33..c8b637a 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc @@ -21,7 +21,11 @@ PLATFORM_GUID = 0b511920-978d-4b34-acc0-3d9f8e6f9d81 PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 +!ifdef $(EDK2_OUT_DIR) + OUTPUT_DIRECTORY = $(EDK2_OUT_DIR) +!else OUTPUT_DIRECTORY = Build/ArmVExpress-CTA15-A7 +!endif SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc index 3f9654f..b4040c2 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc @@ -21,8 +21,8 @@ PLATFORM_GUID = eb2bd5ff-2379-4a06-9c12-db905cdee9ea PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 -!ifdef $(EDK2_ARMVE_STANDALONE) - OUTPUT_DIRECTORY = Build/ArmVExpress-CTA9x4-Standalone +!ifdef $(EDK2_OUT_DIR) + OUTPUT_DIRECTORY = $(EDK2_OUT_DIR) !else OUTPUT_DIRECTORY = Build/ArmVExpress-CTA9x4 !endif diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc index 548eee5..16271b0 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc @@ -21,7 +21,11 @@ PLATFORM_GUID = 1665b5b1-529d-4ba1-bd51-c3c9b29a2274 PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 +!ifdef $(EDK2_OUT_DIR) + OUTPUT_DIRECTORY = $(EDK2_OUT_DIR) +!else OUTPUT_DIRECTORY = Build/ArmVExpress-RTSM-A15 +!endif SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc index 0001f8a..c0940ae 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc @@ -21,7 +21,11 @@ PLATFORM_GUID = 3a91a0f8-3af4-409d-a71d-a199dc134357 PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 +!ifdef $(EDK2_OUT_DIR) + OUTPUT_DIRECTORY = $(EDK2_OUT_DIR) +!else OUTPUT_DIRECTORY = Build/ArmVExpress-RTSM-A15_MPCore +!endif SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc index 4315179..bdc2697 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc @@ -21,7 +21,11 @@ PLATFORM_GUID = e46039e0-5bb3-11e0-a9d6-0002a5d5c51b PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 +!ifdef $(EDK2_OUT_DIR) + OUTPUT_DIRECTORY = $(EDK2_OUT_DIR) +!else OUTPUT_DIRECTORY = Build/ArmVExpress-RTSM-A9x4 +!endif SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT
I am not convinced by this patch. The use case you gave is the automated build system. Nothing prevent you to do a move the folder around after building it. Instead of changing all the DSC files of EDK2, I would prefer to see a patch that changes the 'build' command to allow to overwrite the Build directory defined in the DSC file.
-----Original Message----- From: Ryan Harkin [mailto:ryan.harkin@linaro.org] Sent: 21 June 2013 09:05 To: ryan.harkin@linaro.org; edk2-devel@lists.sourceforge.net; patches@linaro.org; boot-architecture@lists.linaro.org; Olivier Martin Subject: [PATCH 1/9] ArmPlatformPkg/ArmVExpressPkg: Add support for EDK2_OUT_DIR build parameter
Add support to the build config to allow the user to specify a custom output directory to the build.
This is particularly useful for automated build systems.
Eg. build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress- CTA9x4.dsc -t ARMLINUXGCC \ -D EDK2_ARMVE_STANDALONE=1 \ -D EDK2_OUT_DIR=Build/vea9
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org
.../ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 4 ++++ .../ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 4 ++-- .../ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 4 ++++ .../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 4 ++++ .../ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc | 4 ++++ 5 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc index 17aba33..c8b637a 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc @@ -21,7 +21,11 @@ PLATFORM_GUID = 0b511920-978d-4b34-acc0- 3d9f8e6f9d81 PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 +!ifdef $(EDK2_OUT_DIR)
- OUTPUT_DIRECTORY = $(EDK2_OUT_DIR)
+!else OUTPUT_DIRECTORY = Build/ArmVExpress-CTA15-A7 +!endif SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc index 3f9654f..b4040c2 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc @@ -21,8 +21,8 @@ PLATFORM_GUID = eb2bd5ff-2379-4a06-9c12- db905cdee9ea PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 -!ifdef $(EDK2_ARMVE_STANDALONE)
- OUTPUT_DIRECTORY = Build/ArmVExpress-CTA9x4-Standalone
+!ifdef $(EDK2_OUT_DIR)
- OUTPUT_DIRECTORY = $(EDK2_OUT_DIR)
!else OUTPUT_DIRECTORY = Build/ArmVExpress-CTA9x4 !endif diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc index 548eee5..16271b0 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc @@ -21,7 +21,11 @@ PLATFORM_GUID = 1665b5b1-529d-4ba1-bd51- c3c9b29a2274 PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 +!ifdef $(EDK2_OUT_DIR)
- OUTPUT_DIRECTORY = $(EDK2_OUT_DIR)
+!else OUTPUT_DIRECTORY = Build/ArmVExpress-RTSM-A15 +!endif SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM- A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM- A15_MPCore.dsc index 0001f8a..c0940ae 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc @@ -21,7 +21,11 @@ PLATFORM_GUID = 3a91a0f8-3af4-409d-a71d- a199dc134357 PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 +!ifdef $(EDK2_OUT_DIR)
- OUTPUT_DIRECTORY = $(EDK2_OUT_DIR)
+!else OUTPUT_DIRECTORY = Build/ArmVExpress-RTSM-A15_MPCore +!endif SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc index 4315179..bdc2697 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc @@ -21,7 +21,11 @@ PLATFORM_GUID = e46039e0-5bb3-11e0-a9d6- 0002a5d5c51b PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 +!ifdef $(EDK2_OUT_DIR)
- OUTPUT_DIRECTORY = $(EDK2_OUT_DIR)
+!else OUTPUT_DIRECTORY = Build/ArmVExpress-RTSM-A9x4 +!endif SUPPORTED_ARCHITECTURES = ARM BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT -- 1.7.9.5
The original BSP for TC2 hard codes EDK2_SKIP_PEICORE=1, but this change allows the user to over-ride the value at build time.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- .../ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc index c8b637a..58e1689 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc @@ -30,7 +30,9 @@ BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT FLASH_DEFINITION = ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf +!ifndef $(EDK2_SKIP_PEICORE) DEFINE EDK2_SKIP_PEICORE=1 +!endif
!include ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
If you want to use PEI Core (EDK2_SKIP_PEICORE=0) in CTA15-A7, you would need to add support ... Which is not the case today! Have a look at the macro EDK2_SKIP_PEICORE usage in RTSM-A9x4 DSC and FDF file.
-----Original Message----- From: Ryan Harkin [mailto:ryan.harkin@linaro.org] Sent: 21 June 2013 09:05 To: ryan.harkin@linaro.org; edk2-devel@lists.sourceforge.net; patches@linaro.org; boot-architecture@lists.linaro.org; Olivier Martin Subject: [PATCH 2/9] ArmPlatformPkg/ArmVExpressPkg: CTA15-A7: Allow EDK2_SKIP_PEICORE to be specified at build time
The original BSP for TC2 hard codes EDK2_SKIP_PEICORE=1, but this change allows the user to over-ride the value at build time.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org
.../ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc index c8b637a..58e1689 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc @@ -30,7 +30,9 @@ BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT FLASH_DEFINITION = ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf +!ifndef $(EDK2_SKIP_PEICORE) DEFINE EDK2_SKIP_PEICORE=1 +!endif
!include ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
-- 1.7.9.5
This patch changes the Versatile Express A9 BSP to build with EDK2_ARMVE_STANDALONE=1 as the default option.
The user may then specify zero if they wish to build the non-standalone version.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- .../ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc index b4040c2..e805b57 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc @@ -30,6 +30,9 @@ BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT FLASH_DEFINITION = ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf +!ifndef $(EDK2_ARMVE_STANDALONE) + DEFINE EDK2_ARMVE_STANDALONE=1 +!endif
!include ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
In your patch, I fixed (Revision 14439): - the !ifndef syntax to use '!ifndef EDK2_ARMVE_STANDALONE' - Moved the previous condition that uses EDK2_ARMVE_STANDALONE after your definition
-----Original Message----- From: Ryan Harkin [mailto:ryan.harkin@linaro.org] Sent: 21 June 2013 09:05 To: ryan.harkin@linaro.org; edk2-devel@lists.sourceforge.net; patches@linaro.org; boot-architecture@lists.linaro.org; Olivier Martin Subject: [PATCH 3/9] ArmPlatformPkg/ArmVExpressPkg: CTA9x4: default to EDK2_ARMVE_STANDALONE=1
This patch changes the Versatile Express A9 BSP to build with EDK2_ARMVE_STANDALONE=1 as the default option.
The user may then specify zero if they wish to build the non-standalone version.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org
.../ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc index b4040c2..e805b57 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc @@ -30,6 +30,9 @@ BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT FLASH_DEFINITION = ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf +!ifndef $(EDK2_ARMVE_STANDALONE)
- DEFINE EDK2_ARMVE_STANDALONE=1
+!endif
!include ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
-- 1.7.9.5
LibResetSystem was performing a cold reboot for both reboot and shutdown.
This patch updates LibResetSystem to pass SYS_CFG_SHUTDOWN to the microcontroller when called wit EfiResetShutdown.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- .../Library/ResetSystemLib/ResetSystemLib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c index f858317..f32b533 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -49,12 +49,19 @@ LibResetSystem ( case EfiResetWarm: // Map a warm reset into a cold reset case EfiResetCold: - case EfiResetShutdown: // Send the REBOOT function to the platform microcontroller ArmPlatformSysConfigSet (SYS_CFG_REBOOT, 0);
// We should never be here while(1); + break; + case EfiResetShutdown: + // Send the SHUTDOWN function to the platform microcontroller + ArmPlatformSysConfigSet (SYS_CFG_SHUTDOWN, 0); + + // We should never be here + while(1); + break; }
ASSERT(FALSE);
Done. Committed revision 14438.
-----Original Message----- From: Ryan Harkin [mailto:ryan.harkin@linaro.org] Sent: 21 June 2013 09:05 To: ryan.harkin@linaro.org; edk2-devel@lists.sourceforge.net; patches@linaro.org; boot-architecture@lists.linaro.org; Olivier Martin Subject: [PATCH 4/9] ArmPlatformPkg/ArmVExpressPkg: add Shutdown support
LibResetSystem was performing a cold reboot for both reboot and shutdown.
This patch updates LibResetSystem to pass SYS_CFG_SHUTDOWN to the microcontroller when called wit EfiResetShutdown.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org
.../Library/ResetSystemLib/ResetSystemLib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c index f858317..f32b533 100644
a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -49,12 +49,19 @@ LibResetSystem ( case EfiResetWarm: // Map a warm reset into a cold reset case EfiResetCold:
case EfiResetShutdown: // Send the REBOOT function to the platform microcontroller ArmPlatformSysConfigSet (SYS_CFG_REBOOT, 0);
// We should never be here while(1);
break;
case EfiResetShutdown:
// Send the SHUTDOWN function to the platform microcontroller
ArmPlatformSysConfigSet (SYS_CFG_SHUTDOWN, 0);
// We should never be here
while(1);
break; }
ASSERT(FALSE);
-- 1.7.9.5
From: Leif Lindholm leif.lindholm@linaro.org
Currently, only ".efi" files are recognized as valid ARM UEFI applications by BDS. This patch also makes ".EFI" files recognised.
Signed-off-by: Leif Lindholm leif.lindholm@linaro.org --- ArmPlatformPkg/Bds/BdsHelper.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c index fa3026c..d1889f4 100644 --- a/ArmPlatformPkg/Bds/BdsHelper.c +++ b/ArmPlatformPkg/Bds/BdsHelper.c @@ -205,6 +205,9 @@ HasFilePathEfiExtension ( IN CHAR16* FilePath ) { + if (StrCmp (FilePath + (StrSize(FilePath)/sizeof(CHAR16)) - 5, L".EFI") == 0) + return 1; + return (StrCmp (FilePath + (StrSize(FilePath)/sizeof(CHAR16)) - 5, L".efi") == 0); }
I committed this change after fixing the coding style (revision 14437).
-----Original Message----- From: Ryan Harkin [mailto:ryan.harkin@linaro.org] Sent: 21 June 2013 09:05 To: ryan.harkin@linaro.org; edk2-devel@lists.sourceforge.net; patches@linaro.org; boot-architecture@lists.linaro.org; Olivier Martin Subject: [PATCH 5/9] ArmPlatformPkg/Bds: Make ".EFI" files recognizable as EFI applications.
From: Leif Lindholm leif.lindholm@linaro.org
Currently, only ".efi" files are recognized as valid ARM UEFI applications by BDS. This patch also makes ".EFI" files recognised.
Signed-off-by: Leif Lindholm leif.lindholm@linaro.org
ArmPlatformPkg/Bds/BdsHelper.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c index fa3026c..d1889f4 100644 --- a/ArmPlatformPkg/Bds/BdsHelper.c +++ b/ArmPlatformPkg/Bds/BdsHelper.c @@ -205,6 +205,9 @@ HasFilePathEfiExtension ( IN CHAR16* FilePath ) {
- if (StrCmp (FilePath + (StrSize(FilePath)/sizeof(CHAR16)) - 5,
L".EFI") == 0)
- return 1;
- return (StrCmp (FilePath + (StrSize(FilePath)/sizeof(CHAR16)) - 5,
L".efi") == 0); }
-- 1.7.9.5
On Fri, Jun 21, 2013 at 9:05 AM, Ryan Harkin ryan.harkin@linaro.org wrote:
From: Leif Lindholm leif.lindholm@linaro.org
Currently, only ".efi" files are recognized as valid ARM UEFI applications by BDS. This patch also makes ".EFI" files recognised.
Signed-off-by: Leif Lindholm leif.lindholm@linaro.org
ArmPlatformPkg/Bds/BdsHelper.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c index fa3026c..d1889f4 100644 --- a/ArmPlatformPkg/Bds/BdsHelper.c +++ b/ArmPlatformPkg/Bds/BdsHelper.c @@ -205,6 +205,9 @@ HasFilePathEfiExtension ( IN CHAR16* FilePath ) {
- if (StrCmp (FilePath + (StrSize(FilePath)/sizeof(CHAR16)) - 5, L".EFI") == 0)
- return 1;
Hmmm... we really should have an StrCaseCmp implementation in efi.
return (StrCmp (FilePath + (StrSize(FilePath)/sizeof(CHAR16)) - 5, L".efi") == 0); }
-- 1.7.9.5
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel
On Jun 21, 2013, at 3:14 AM, Grant Likely grant.likely@secretlab.ca wrote:
On Fri, Jun 21, 2013 at 9:05 AM, Ryan Harkin ryan.harkin@linaro.org wrote:
From: Leif Lindholm leif.lindholm@linaro.org
Currently, only ".efi" files are recognized as valid ARM UEFI applications by BDS. This patch also makes ".EFI" files recognised.
Signed-off-by: Leif Lindholm leif.lindholm@linaro.org
ArmPlatformPkg/Bds/BdsHelper.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c index fa3026c..d1889f4 100644 --- a/ArmPlatformPkg/Bds/BdsHelper.c +++ b/ArmPlatformPkg/Bds/BdsHelper.c @@ -205,6 +205,9 @@ HasFilePathEfiExtension ( IN CHAR16* FilePath ) {
- if (StrCmp (FilePath + (StrSize(FilePath)/sizeof(CHAR16)) - 5, L".EFI") == 0)
- return 1;
Hmmm... we really should have an StrCaseCmp implementation in efi.
It is implemented as a member in the EFI_UNICODE_COLLATION_PROTOCOL as defined by the UEFI spec. https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdePkg/Include/Prot...
It exists since case insensitive compares are required for the FAT filesystem driver. I think it is only currently used in the FAT driver so that is why we did not end up with a library to wrap the protocol.
Thanks,
Andrew Fish
return (StrCmp (FilePath + (StrSize(FilePath)/sizeof(CHAR16)) - 5, L".efi") == 0); }
-- 1.7.9.5
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel
The main menu in the Boot Manager numbers all the menu options.
As you add a new boot device, the hard coded menu option numbers increment. This makes automated configuration of UEFI more complex.
This patch changes the hard coded menu options to use letters instead of numbers. For backwards compatibility, I've left the numbering support in. However, I've re-ordered the Ebl and Boot Manager entries, so the default number for the Boot Manager option is now 2, not 3.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- ArmPlatformPkg/Bds/BootMenu.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 1b101d4..4094d41 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -618,8 +618,8 @@ struct BOOT_MAIN_ENTRY { CONST CHAR16* Description; EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList); } BootMainEntries[] = { - { L"Shell", BootShell }, { L"Boot Manager", BootMenuManager }, + { L"Shell", BootShell }, };
@@ -630,6 +630,7 @@ BootMenuMain ( { LIST_ENTRY BootOptionsList; UINTN OptionCount; + UINTN HardCodedOptionCount; UINTN BootOptionCount; EFI_STATUS Status; LIST_ENTRY* Entry; @@ -637,6 +638,7 @@ BootMenuMain ( UINTN BootOptionSelected; UINTN Index; UINTN BootMainEntryCount; + CHAR8 BootOptionSelectedStr[32];
BootOption = NULL; BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY); @@ -713,16 +715,25 @@ BootMenuMain ( BootOptionCount = OptionCount-1;
// Display the hardcoded Boot entries + Print(L"-----------------------\n"); for (Index = 0; Index < BootMainEntryCount; Index++) { - Print(L"[%d] %s\n",OptionCount,BootMainEntries[Index]); + Print(L"[%c] %s\n", ('a'+Index), BootMainEntries[Index]); OptionCount++; } + HardCodedOptionCount=Index;
// Request the boot entry from the user BootOptionSelected = 0; while (BootOptionSelected == 0) { Print(L"Start: "); - Status = GetHIInputInteger (&BootOptionSelected); + Status = GetHIInputAscii (BootOptionSelectedStr,8); + + if (BootOptionSelectedStr[0]-'0' <= OptionCount) { + BootOptionSelected = BootOptionSelectedStr[0] - '0'; + } else if (BootOptionSelectedStr[0]-'a' <= HardCodedOptionCount) { + BootOptionSelected = BootOptionCount + 1 + BootOptionSelectedStr[0] - 'a'; + } + if (EFI_ERROR(Status) || (BootOptionSelected == 0) || (BootOptionSelected > OptionCount)) { Print(L"Invalid input (max %d)\n",(OptionCount-1)); BootOptionSelected = 0;
Add Reboot and Shutdown options to the main BDS menu so that users can control the platform remotely without having to physically reboot/shutdown the board.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- ArmPlatformPkg/Bds/BootMenu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 4094d41..09e1075 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -614,12 +614,32 @@ BootShell ( return Status; }
+EFI_STATUS +Reboot ( + IN LIST_ENTRY *BootOptionsList + ) +{ + gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); + return EFI_UNSUPPORTED; +} + +EFI_STATUS +Shutdown ( + IN LIST_ENTRY *BootOptionsList + ) +{ + gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); + return EFI_UNSUPPORTED; +} + struct BOOT_MAIN_ENTRY { CONST CHAR16* Description; EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList); } BootMainEntries[] = { { L"Boot Manager", BootMenuManager }, { L"Shell", BootShell }, + { L"Reboot", Reboot }, + { L"Shutdown", Shutdown }, };
Previously, there was no way to read the global FDT config.
This patch displays the global FDT config after the boot devices in the main menu.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- ArmPlatformPkg/Bds/BootMenu.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 09e1075..2b32e83 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -659,6 +659,9 @@ BootMenuMain ( UINTN Index; UINTN BootMainEntryCount; CHAR8 BootOptionSelectedStr[32]; + EFI_DEVICE_PATH_PROTOCOL* DefaultFdtDevicePath; + UINTN FdtDevicePathSize; +
BootOption = NULL; BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY); @@ -734,6 +737,33 @@ BootMenuMain ( } BootOptionCount = OptionCount-1;
+ // Display the global FDT config + Print(L"-----------------------\n"); + { + EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol; + EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath; + EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol; + CHAR16* DevicePathTxt; + + // Get the default FDT device path + Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol); + ASSERT_EFI_ERROR(Status); + DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath)); + + // Get the FDT device path + FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath); + Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath); + + // Convert FdtDevicePath to text + if (EFI_ERROR(Status)) { + DevicePathTxt = L"not configured"; + } else { + Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol); + DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ( FdtDevicePath, TRUE, TRUE ); + } + Print(L"Global FDT Config\n\t- %s\n", DevicePathTxt); + } + // Display the hardcoded Boot entries Print(L"-----------------------\n"); for (Index = 0; Index < BootMainEntryCount; Index++) {
This patch adds a local FDT config option to each boot device.
Bds was using a global FDT config for all boot devices of Loader Type = 2.
I've added a new Loader Type = 3 that stores an device path to an FDT file this is only used for this boot device.
This change will invalidate any existing configs stored on the board due to the change in structure sizes to store the boot device configurations.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- ArmPlatformPkg/ArmPlatformPkg.dec | 2 + ArmPlatformPkg/Bds/Bds.c | 30 +++- ArmPlatformPkg/Bds/Bds.inf | 1 + ArmPlatformPkg/Bds/BdsInternal.h | 11 +- ArmPlatformPkg/Bds/BootMenu.c | 246 +++++++++++++++++++++++--------- ArmPlatformPkg/Bds/BootOption.c | 46 ++++-- ArmPlatformPkg/Bds/BootOptionSupport.c | 17 ++- 7 files changed, 254 insertions(+), 99 deletions(-)
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec index 3e2900b..e672ce2 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -136,6 +136,8 @@ gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0|UINT32|0x00000010 gArmPlatformTokenSpaceGuid.PcdFdtDevicePath|L""|VOID*|0x00000011
+ gArmPlatformTokenSpaceGuid.PcdDefaultFdtLocalDevicePath|L""|VOID*|0x0000002E + ## Timeout value for displaying progressing bar in before boot OS. # According to UEFI 2.0 spec, the default TimeOut should be 0xffff. gArmPlatformTokenSpaceGuid.PcdPlatformBootTimeOut|0xffff|UINT16|0x0000001A diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c index 2801fac..d0fc6a3 100644 --- a/ArmPlatformPkg/Bds/Bds.c +++ b/ArmPlatformPkg/Bds/Bds.c @@ -223,8 +223,10 @@ DefineDefaultBootEntries ( ARM_BDS_LOADER_ARGUMENTS* BootArguments; ARM_BDS_LOADER_TYPE BootType; EFI_DEVICE_PATH* InitrdPath; + EFI_DEVICE_PATH* FdtLocalPath; UINTN CmdLineSize; UINTN InitrdSize; + UINTN FdtLocalSize;
// // If Boot Order does not exist then create a default entry @@ -262,17 +264,30 @@ DefineDefaultBootEntries ( if (BootDevicePath != NULL) { BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) { + if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) { CmdLineSize = AsciiStrSize ((CHAR8*)PcdGetPtr(PcdDefaultBootArgument)); InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath)); InitrdSize = GetDevicePathSize (InitrdPath); + if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) { + FdtLocalPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultFdtLocalDevicePath)); + FdtLocalSize = GetDevicePathSize (FdtLocalPath); + } else { + FdtLocalPath = NULL; + FdtLocalSize = 0; + }
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize); - BootArguments->LinuxArguments.CmdLineSize = CmdLineSize; - BootArguments->LinuxArguments.InitrdSize = InitrdSize; - - CopyMem ((VOID*)(BootArguments + 1), (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), CmdLineSize); - CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize), InitrdPath, InitrdSize); + BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize); + if ( BootArguments != NULL ) { + BootArguments->LinuxArguments.CmdLineSize = CmdLineSize; + BootArguments->LinuxArguments.InitrdSize = InitrdSize; + BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize; + + CopyMem ((VOID*)(BootArguments + 1), (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), CmdLineSize); + CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize), InitrdPath, InitrdSize); + CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize); + } + FreePool (FdtLocalPath); + FreePool (InitrdPath); } else { BootArguments = NULL; } @@ -285,6 +300,7 @@ DefineDefaultBootEntries ( &BdsLoadOption ); FreePool (BdsLoadOption); + FreePool (BootDevicePath); } else { Status = EFI_UNSUPPORTED; } diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf index 5faa4b2..8b3f1d2 100644 --- a/ArmPlatformPkg/Bds/Bds.inf +++ b/ArmPlatformPkg/Bds/Bds.inf @@ -68,6 +68,7 @@ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument gArmPlatformTokenSpaceGuid.PcdDefaultBootType gArmPlatformTokenSpaceGuid.PcdFdtDevicePath + gArmPlatformTokenSpaceGuid.PcdDefaultFdtLocalDevicePath gArmPlatformTokenSpaceGuid.PcdPlatformBootTimeOut gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h index a8d836d..7830066 100644 --- a/ArmPlatformPkg/Bds/BdsInternal.h +++ b/ArmPlatformPkg/Bds/BdsInternal.h @@ -38,6 +38,11 @@ #define BOOT_DEVICE_OPTION_MAX 300 #define BOOT_DEVICE_ADDRESS_MAX (sizeof(L"0x0000000000000000"))
+// Length of the buffer used to hold the user input for the main menu +// This includes the NULL terminator +// 1 chars + newline + NULL gives room for up to 9 boot device configs +#define BOOT_OPTION_LEN 3 + #define ARM_BDS_OPTIONAL_DATA_SIGNATURE SIGNATURE_32('a', 'b', 'o', 'd')
#define IS_ARM_BDS_BOOTENTRY(ptr) (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) == ARM_BDS_OPTIONAL_DATA_SIGNATURE) @@ -48,16 +53,20 @@ typedef enum { BDS_LOADER_EFI_APPLICATION = 0, BDS_LOADER_KERNEL_LINUX_ATAG, - BDS_LOADER_KERNEL_LINUX_FDT, + BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT, + BDS_LOADER_KERNEL_LINUX_LOCAL_FDT, } ARM_BDS_LOADER_TYPE;
typedef struct { UINT16 CmdLineSize; UINT16 InitrdSize;
+ UINT16 FdtLocalSize; + // These following fields have variable length and are packed: //CHAR8 *CmdLine; //EFI_DEVICE_PATH_PROTOCOL *InitrdPathList; + //EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathList; } ARM_BDS_LINUX_ARGUMENTS;
typedef union { diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 2b32e83..de2117b 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -128,9 +128,12 @@ BootMenuAddBootOption ( EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes; EFI_DEVICE_PATH_PROTOCOL *InitrdPathNodes; EFI_DEVICE_PATH_PROTOCOL *InitrdPath; + EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathNode; + EFI_DEVICE_PATH_PROTOCOL *FdtLocalPath; UINTN CmdLineSize; BOOLEAN InitrdSupport; UINTN InitrdSize; + UINTN FdtLocalSize;
Attributes = 0; SupportedBootDevice = NULL; @@ -155,12 +158,12 @@ BootMenuAddBootOption ( goto EXIT; }
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) { + if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) { Print(L"Add an initrd: "); Status = GetHIInputBoolean (&InitrdSupport); if (EFI_ERROR(Status)) { Status = EFI_ABORTED; - goto EXIT; + goto FREE_DEVICE_PATH; }
if (InitrdSupport) { @@ -168,7 +171,7 @@ BootMenuAddBootOption ( Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes, NULL, NULL); if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd Status = EFI_ABORTED; - goto EXIT; + goto FREE_DEVICE_PATH; }
if (InitrdPathNodes != NULL) { @@ -176,7 +179,7 @@ BootMenuAddBootOption ( InitrdPath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes); if (InitrdPath == NULL) { Status = EFI_OUT_OF_RESOURCES; - goto EXIT; + goto FREE_DEVICE_PATH; } } else { InitrdPath = NULL; @@ -192,15 +195,37 @@ BootMenuAddBootOption ( goto FREE_DEVICE_PATH; }
- CmdLineSize = AsciiStrSize (CmdLine); - InitrdSize = GetDevicePathSize (InitrdPath); + if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) { + // Create the specific device path node + Status = SupportedBootDevice->Support->CreateDevicePathNode (L"local FDT", &FdtLocalPathNode, NULL, NULL); + if (EFI_ERROR(Status) || (FdtLocalPathNode == NULL)) { + Status = EFI_ABORTED; + goto FREE_DEVICE_PATH; + }
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize); + if (FdtLocalPathNode != NULL) { + // Append the Device Path node to the select device path + FdtLocalPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)FdtLocalPathNode); + } else { + FdtLocalPath = NULL; + } + } else { + FdtLocalPath = NULL; + }
- BootArguments->LinuxArguments.CmdLineSize = CmdLineSize; - BootArguments->LinuxArguments.InitrdSize = InitrdSize; - CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), CmdLine, CmdLineSize); - CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize); + CmdLineSize = AsciiStrSize (CmdLine); + InitrdSize = GetDevicePathSize (InitrdPath); + FdtLocalSize = GetDevicePathSize (FdtLocalPath); + + BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize); + if ( BootArguments != NULL ) { + BootArguments->LinuxArguments.CmdLineSize = CmdLineSize; + BootArguments->LinuxArguments.InitrdSize = InitrdSize; + BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize; + CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), CmdLine, CmdLineSize); + CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize); + CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize); + } } else { BootArguments = NULL; } @@ -214,6 +239,10 @@ BootMenuAddBootOption (
// Create new entry BdsLoadOptionEntry = (BDS_LOAD_OPTION_ENTRY*)AllocatePool (sizeof(BDS_LOAD_OPTION_ENTRY)); + if ( BdsLoadOptionEntry == NULL ) { + Status = EFI_ABORTED; + goto FREE_DEVICE_PATH; + } Status = BootOptionCreate (Attributes, BootDescription, DevicePath, BootType, BootArguments, &BdsLoadOptionEntry->BdsLoadOption); if (!EFI_ERROR(Status)) { InsertTailList (BootOptionsList, &BdsLoadOptionEntry->Link); @@ -274,7 +303,7 @@ BootMenuSelectBootOption ( Print(L"\t- %s\n",DevicePathTxt); OptionalData = BdsLoadOption->OptionalData; LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType); - if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) { + if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) { Print (L"\t- Arguments: %a\n",&OptionalData->Arguments.LinuxArguments + 1); }
@@ -366,14 +395,19 @@ BootMenuUpdateBootOption ( CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX]; EFI_DEVICE_PATH *DevicePath; EFI_DEVICE_PATH *TempInitrdPath; + EFI_DEVICE_PATH *TempFdtLocalPath; ARM_BDS_LOADER_TYPE BootType; ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData; ARM_BDS_LINUX_ARGUMENTS* LinuxArguments; EFI_DEVICE_PATH *InitrdPathNodes; EFI_DEVICE_PATH *InitrdPath; UINTN InitrdSize; + EFI_DEVICE_PATH *FdtLocalPathNode; + EFI_DEVICE_PATH *FdtLocalPath; + UINTN FdtLocalSize; UINTN CmdLineSize; BOOLEAN InitrdSupport; + BOOLEAN FdtLocalSupport;
Status = BootMenuSelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, TRUE, &BootOptionEntry); if (EFI_ERROR(Status)) { @@ -397,12 +431,65 @@ BootMenuUpdateBootOption ( OptionalData = BootOption->OptionalData; BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&OptionalData->Header.LoaderType));
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) { + if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) { LinuxArguments = &OptionalData->Arguments.LinuxArguments;
CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize); + FdtLocalSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->FdtLocalSize); + + if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) { + if (FdtLocalSize > 0) { + Print(L"Keep the local FDT: "); + } else { + Print(L"Add a local FDT: "); + } + Status = GetHIInputBoolean (&FdtLocalSupport); + if (EFI_ERROR(Status)) { + Status = EFI_ABORTED; + goto EXIT; + } + if (FdtLocalSupport && BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) { + if (FdtLocalSize > 0) { + // Case we update the FDT local device path + Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize + InitrdSize), L"local FDT", &FdtLocalPath, NULL, NULL); + if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string + Status = EFI_ABORTED; + goto EXIT; + } + FdtLocalSize = GetDevicePathSize (FdtLocalPath); + } else { + // Case we create the FdtLocal device path + + Status = DeviceSupport->CreateDevicePathNode (L"local FDT", &FdtLocalPathNode, NULL, NULL); + if (EFI_ERROR(Status) || (FdtLocalPathNode == NULL)) { + Status = EFI_ABORTED; + goto EXIT; + } + + if (FdtLocalPathNode != NULL) { + // Duplicate Linux kernel Device Path + TempFdtLocalPath = DuplicateDevicePath (BootOption->FilePathList); + if ( TempFdtLocalPath != NULL ) { + // Replace Linux kernel Node by EndNode + SetDevicePathEndNode (GetLastDevicePathNode (TempFdtLocalPath)); + // Append the Device Path node to the select device path + FdtLocalPath = AppendDevicePathNode (TempFdtLocalPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)FdtLocalPathNode); + FreePool (TempFdtLocalPath); + FdtLocalSize = GetDevicePathSize (FdtLocalPath); + } + } else { + FdtLocalPath = NULL; + } + } + } else { + FdtLocalSize = 0; + } + } else { + FdtLocalSupport = FALSE; + } + if (InitrdSize > 0) { Print(L"Keep the initrd: "); } else { @@ -467,11 +554,15 @@ BootMenuUpdateBootOption (
CmdLineSize = AsciiStrSize (CmdLine);
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize); - BootArguments->LinuxArguments.CmdLineSize = CmdLineSize; - BootArguments->LinuxArguments.InitrdSize = InitrdSize; - CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize); - CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize); + BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize); + if ( BootArguments != NULL ) { + BootArguments->LinuxArguments.CmdLineSize = CmdLineSize; + BootArguments->LinuxArguments.InitrdSize = InitrdSize; + BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize; + CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize); + CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize); + CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize); + } } else { BootArguments = NULL; } @@ -648,19 +739,20 @@ BootMenuMain ( VOID ) { - LIST_ENTRY BootOptionsList; - UINTN OptionCount; - UINTN HardCodedOptionCount; - UINTN BootOptionCount; - EFI_STATUS Status; - LIST_ENTRY* Entry; - BDS_LOAD_OPTION* BootOption; - UINTN BootOptionSelected; - UINTN Index; - UINTN BootMainEntryCount; - CHAR8 BootOptionSelectedStr[32]; - EFI_DEVICE_PATH_PROTOCOL* DefaultFdtDevicePath; - UINTN FdtDevicePathSize; + LIST_ENTRY BootOptionsList; + UINTN OptionCount; + UINTN BootOptionCount; + EFI_STATUS Status; + LIST_ENTRY* Entry; + BDS_LOAD_OPTION* BootOption; + UINTN BootOptionSelected; + UINTN Index; + UINTN BootMainEntryCount; + CHAR8 BootOptionSelectedStr[BOOT_OPTION_LEN]; + EFI_DEVICE_PATH_PROTOCOL* DefaultFdtDevicePath; + UINTN FdtDevicePathSize; + EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol; + CHAR16* DevicePathTxt;
BootOption = NULL; @@ -682,11 +774,10 @@ BootMenuMain (
Print(L"[%d] %s\n", OptionCount, BootOption->Description);
- DEBUG_CODE_BEGIN(); - CHAR16* DevicePathTxt; - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol; + //DEBUG_CODE_BEGIN(); ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData; UINTN CmdLineSize; + UINTN InitrdSize; ARM_BDS_LOADER_TYPE LoaderType;
Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol); @@ -703,7 +794,7 @@ BootMenuMain ( if (IS_ARM_BDS_BOOTENTRY (BootOption)) { OptionalData = BootOption->OptionalData; LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType); - if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) { + if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) { if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) { CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize); DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ( @@ -722,16 +813,28 @@ BootMenuMain ( Print(L"\t- LoaderType: Linux kernel with ATAG support\n"); break;
- case BDS_LOADER_KERNEL_LINUX_FDT: - Print(L"\t- LoaderType: Linux kernel with FDT support\n"); + case BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT: + Print(L"\t- LoaderType: Linux kernel with global FDT support\n"); + break; + case BDS_LOADER_KERNEL_LINUX_LOCAL_FDT: + if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.FdtLocalSize) > 0) { + CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize); + InitrdSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize); + DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ( + GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize + InitrdSize)), TRUE, TRUE); + Print(L"\t- FDT: %s\n", DevicePathTxt); + } else { + Print(L"\t- FDT: error, local FDT not specified, using global FDT\n"); + } + Print(L"\t- LoaderType: Linux kernel with Local FDT\n"); break; - default: Print(L"\t- LoaderType: Not recognized (%d)\n", LoaderType); + break; } } FreePool(DevicePathTxt); - DEBUG_CODE_END(); + //DEBUG_CODE_END();
OptionCount++; } @@ -739,55 +842,56 @@ BootMenuMain (
// Display the global FDT config Print(L"-----------------------\n"); - { - EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol; - EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath; - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol; - CHAR16* DevicePathTxt; + { + EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol; + EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath;
- // Get the default FDT device path - Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol); - ASSERT_EFI_ERROR(Status); - DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath)); + // Get the default FDT device path + Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol); + ASSERT_EFI_ERROR(Status); + DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
- // Get the FDT device path - FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath); - Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath); + // Get the FDT device path + FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath); + Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
- // Convert FdtDevicePath to text - if (EFI_ERROR(Status)) { - DevicePathTxt = L"not configured"; - } else { - Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol); - DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ( FdtDevicePath, TRUE, TRUE ); - } - Print(L"Global FDT Config\n\t- %s\n", DevicePathTxt); + // Convert FdtDevicePath to text + if (EFI_ERROR(Status)) { + DevicePathTxt = L"not configured"; + } else { + Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol); + DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ( FdtDevicePath, TRUE, TRUE ); } + Print(L"Global FDT Config\n\t- %s\n", DevicePathTxt); + FreePool(DevicePathTxt); + FreePool(DefaultFdtDevicePath); + }
// Display the hardcoded Boot entries Print(L"-----------------------\n"); for (Index = 0; Index < BootMainEntryCount; Index++) { - Print(L"[%c] %s\n", ('a'+Index), BootMainEntries[Index]); + Print(L"[%c] %s\n", ('a' + Index), BootMainEntries[Index]); OptionCount++; } - HardCodedOptionCount=Index;
// Request the boot entry from the user BootOptionSelected = 0; while (BootOptionSelected == 0) { Print(L"Start: "); - Status = GetHIInputAscii (BootOptionSelectedStr,8); + Status = GetHIInputAscii (BootOptionSelectedStr, BOOT_OPTION_LEN);
- if (BootOptionSelectedStr[0]-'0' <= OptionCount) { - BootOptionSelected = BootOptionSelectedStr[0] - '0'; - } else if (BootOptionSelectedStr[0]-'a' <= HardCodedOptionCount) { - BootOptionSelected = BootOptionCount + 1 + BootOptionSelectedStr[0] - 'a'; - } + if (!EFI_ERROR(Status)) { + if ((BootOptionSelectedStr[0] - '0') < OptionCount) { + BootOptionSelected = BootOptionSelectedStr[0] - '0'; + } else if ((BootOptionSelectedStr[0] - 'a') < BootMainEntryCount) { + BootOptionSelected = BootOptionCount + 1 + BootOptionSelectedStr[0] - 'a'; + }
- if (EFI_ERROR(Status) || (BootOptionSelected == 0) || (BootOptionSelected > OptionCount)) { - Print(L"Invalid input (max %d)\n",(OptionCount-1)); - BootOptionSelected = 0; - } + if ((BootOptionSelected == 0) || (BootOptionSelected > OptionCount)) { + Print(L"Invalid input, please choose a menu option from the list above\n"); + BootOptionSelected = 0; + } + } }
// Start the selected entry diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c index ee0301e..6b756a3 100644 --- a/ArmPlatformPkg/Bds/BootOption.c +++ b/ArmPlatformPkg/Bds/BootOption.c @@ -33,6 +33,7 @@ BootOptionStart ( UINTN CmdLineSize; UINTN InitrdSize; EFI_DEVICE_PATH* Initrd; + UINTN FdtLocalSize; UINT16 LoadOptionIndexSize;
if (IS_ARM_BDS_BOOTENTRY (BootOption)) { @@ -59,7 +60,7 @@ BootOptionStart ( Status = BdsBootLinuxAtag (BootOption->FilePathList, Initrd, // Initrd (CHAR8*)(LinuxArguments + 1)); // CmdLine - } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) { + } else if ((LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) { LinuxArguments = &(OptionalData->Arguments.LinuxArguments); CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize); InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize); @@ -70,17 +71,27 @@ BootOptionStart ( Initrd = NULL; }
- // Get the default FDT device path - Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol); - ASSERT_EFI_ERROR(Status); - DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath)); - - // Get the FDT device path - FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath); - Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, - DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath); - ASSERT_EFI_ERROR(Status); + if (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) { + FdtLocalSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->FdtLocalSize);
+ if (FdtLocalSize > 0) { + FdtDevicePath = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize + InitrdSize)); + } else { + FdtDevicePath = NULL; + } + } else { + // Get the default FDT device path + Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol); + ASSERT_EFI_ERROR(Status); + DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath)); + + // Get the FDT device path + FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath); + Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, + DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath); + ASSERT_EFI_ERROR(Status); + FreePool (DefaultFdtDevicePath); + } Status = BdsBootLinuxFdt (BootOption->FilePathList, Initrd, // Initrd (CHAR8*)(LinuxArguments + 1), @@ -159,6 +170,7 @@ BootOptionSetFields ( UINT16 FilePathListLength; UINT8* EfiLoadOptionPtr; UINT8* InitrdPathListPtr; + UINT8* FdtLocalPathListPtr; UINTN OptionalDataSize; ARM_BDS_LINUX_ARGUMENTS* DestLinuxArguments; ARM_BDS_LINUX_ARGUMENTS* SrcLinuxArguments; @@ -170,8 +182,8 @@ BootOptionSetFields (
BootDescriptionSize = StrSize (BootDescription); BootOptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER); - if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) { - BootOptionalDataSize += sizeof(ARM_BDS_LINUX_ARGUMENTS) + BootArguments->LinuxArguments.CmdLineSize + BootArguments->LinuxArguments.InitrdSize; + if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) { + BootOptionalDataSize += sizeof(ARM_BDS_LINUX_ARGUMENTS) + BootArguments->LinuxArguments.CmdLineSize + BootArguments->LinuxArguments.InitrdSize + BootArguments->LinuxArguments.FdtLocalSize; }
// Compute the size of the FilePath list @@ -213,12 +225,13 @@ BootOptionSetFields (
OptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) { + if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) { SrcLinuxArguments = &(BootArguments->LinuxArguments); DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->CmdLineSize), SrcLinuxArguments->CmdLineSize); WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->InitrdSize), SrcLinuxArguments->InitrdSize); + WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->FdtLocalSize), SrcLinuxArguments->FdtLocalSize); OptionalDataSize += sizeof (ARM_BDS_LINUX_ARGUMENTS);
if (SrcLinuxArguments->CmdLineSize > 0) { @@ -230,6 +243,11 @@ BootOptionSetFields ( InitrdPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize); CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize); } + + if (SrcLinuxArguments->FdtLocalSize > 0) { + FdtLocalPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize); + CopyMem (FdtLocalPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize), SrcLinuxArguments->FdtLocalSize); + } } BootOption->OptionalDataSize = OptionalDataSize;
diff --git a/ArmPlatformPkg/Bds/BootOptionSupport.c b/ArmPlatformPkg/Bds/BootOptionSupport.c index 190169a..c2df7f9 100644 --- a/ArmPlatformPkg/Bds/BootOptionSupport.c +++ b/ArmPlatformPkg/Bds/BootOptionSupport.c @@ -25,6 +25,7 @@ #include <Guid/FileSystemInfo.h>
#define IS_DEVICE_PATH_NODE(node,type,subtype) (((node)->Type == (type)) && ((node)->SubType == (subtype))) +#define LOCAL_FDT_RESPONSE_LEN 2 // 1 character, plus carriage return
EFI_STATUS BdsLoadOptionFileSystemList ( @@ -233,7 +234,7 @@ BootDeviceGetType ( EFI_STATUS Status; BOOLEAN IsEfiApp; BOOLEAN IsBootLoader; - BOOLEAN HasFDTSupport; + CHAR16 FDTType[ LOCAL_FDT_RESPONSE_LEN ];
if (FileName == NULL) { Print(L"Is an EFI Application? "); @@ -258,15 +259,19 @@ BootDeviceGetType ( } *BootType = BDS_LOADER_EFI_APPLICATION; } else { - Print(L"Has FDT support? "); - Status = GetHIInputBoolean (&HasFDTSupport); + Print(L"Boot Type: [a] ATAGS, [g] Global FDT or [l] Local FDT? [a/g/l] "); + Status = GetHIInputStr (FDTType, LOCAL_FDT_RESPONSE_LEN ); if (EFI_ERROR(Status)) { return EFI_ABORTED; } - if (HasFDTSupport) { - *BootType = BDS_LOADER_KERNEL_LINUX_FDT; - } else { + if (StrCmp(FDTType, L"g") == 0) { + *BootType = BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT; + } else if (StrCmp(FDTType, L"l") == 0) { + *BootType = BDS_LOADER_KERNEL_LINUX_LOCAL_FDT; + } else if (StrCmp(FDTType, L"a") == 0) { *BootType = BDS_LOADER_KERNEL_LINUX_ATAG; + } else { + return EFI_ABORTED; } }
On 21 June 2013 09:05, Ryan Harkin ryan.harkin@linaro.org wrote:
Linaro have been carrying a few small patches in our tree for some months now; they have proven valuable and stable, so we'd like to push them upstream.
The first few patches configure the platforms with some simple default values and some extra build options.
[PATCH 1/9] ArmPlatformPkg/ArmVExpressPkg: Add support for EDK2_OUT_DIR build parameter [PATCH 2/9] ArmPlatformPkg/ArmVExpressPkg: CTA15-A7: Allow EDK2_SKIP_PEICORE to be specified at build time [PATCH 3/9] ArmPlatformPkg/ArmVExpressPkg: CTA9x4: default to EDK2_ARMVE_STANDALONE=1
There is a patch to fix shutdown on Versatile Express platforms:
[PATCH 4/9] ArmPlatformPkg/ArmVExpressPkg: add Shutdown support
There is a small fix for a case sensitivity problem in the ARM BDS:
[PATCH 5/9] ArmPlatformPkg/Bds: Make ".EFI" files recognizable as
Then there are some small improvements to the menu options in ARM BDS:
[PATCH 6/9] ArmPlatformPkg/Bds: use letters for hard coded boot menu [PATCH 7/9] ArmPlatformPkg/Bds: Add Reboot and Shutdown options to main menu [PATCH 8/9] ArmPlatformPkg/Bds: show global FDT config in main menu
Finally, there is a larger patch to allow each boot configuration to specify it's own Flattened Device Tree binary. This is important in our automated build systems, because as the DTB evolves, our "master" image may end up with a different DTB than the image under test.
[PATCH 9/9] ArmPlatformPkg/Bds: add local FDT config
I forgot to add that I've pushed all of these changes to a branch that can be pulled for further investigate/merging/etc...
https://git.linaro.org/gitweb?p=arm/uefi/uefi-next.git%3Ba=shortlog%3Bh=refs...
This is based off quite recent Tianocore upstream code only:
edk2@14395 BaseTools@2582 edk2-fatdriver2/trunk@73
Regards, Ryan.
boot-architecture@lists.linaro.org