Hello all,
I'm using Shell.efi, a magic binary that is included in my aarch64 FVP binary.
I'm trying to manipulate boot options using the BCFG command. And
I've failed to work out how to set optional data.
Before I clone ShellPkg and trawl through the code, I thought I'd post
here and see if someone can tell me what's going wrong.
First step, I created a boot option to run Shell.efi using the Intel
BDS menu system. Thanks to Lazlo fixing cursor key support ;-) I
added some simple optional data, "1 2 3 4".
Next, I deleted all the other boot entries that were created by
default, leaving only my new boot option.
I created the option again, without optional data, giving it the
description "xxxxxxxx" instead of "Shell.efi" (they're the same
length) and here's what I see:
Then I started the first new Shell.efi option. It gives an error that
is hardly unexpected:
'2' is not recognized as an internal or external command, operable
program, or script file.
So I ask bcfg to list my boot options and it says:
Shell> bcfg boot dump
Option: 00. Variable: Boot0006
Desc - Shell.efi
DevPath - Fv(87940482-FC81-41C3-87E6-399CF85AC8A0)/\Shell.efi
Optional- N
Option: 01. Variable: Boot0000
Desc - xxxxxxxxx
DevPath - Fv(87940482-FC81-41C3-87E6-399CF85AC8A0)/\Shell.efi
Optional- N
It claims there is no optional data. Hmmmm. So I dumped the value of
variables Boot0006 and Boot0000 and I can see the optional data in
there:
Shell> setvar Boot0006
8BE4DF61-93CA-11D2-AA0D-00E098032B8C - Boot0006 - 005C Bytes
01 00 00 00 32 00 53 00 68 00 65 00 6C 00 6C 00 2E 00 65 00 66 00 69
00 00 00 04 07 14 00 82 04 94 87 81 FC C3 41 87 E6 39 9C F8 5A C8 A0
04 04 1A 00 5C 00 53 00 68 00 65 00 6C 00 6C 00 2E 00 65 00 66 00 69
00 00 00 7F FF 04 00 31 00 20 00 32 00 20 00 33 00 20 00 34 00 00 00
Shell> setvar Boot0000
8BE4DF61-93CA-11D2-AA0D-00E098032B8C - Boot0000 - 004C Bytes
01 00 00 00 32 00 78 00 78 00 78 00 78 00 78 00 78 00 78 00 78 00 78
00 00 00 04 07 14 00 82 04 94 87 81 FC C3 41 87 E6 39 9C F8 5A C8 A0
04 04 1A 00 5C 00 53 00 68 00 65 00 6C 00 6C 00 2E 00 65 00 66 00 69
00 00 00 7F FF 04 00
Shell>
I started out this investigation because I was trying to add a boot
option from the Shell command line and I can't work out how to add
optional data:
Shell> bcfg boot add 0 fs0:\Shell.efi "zzzzzzzzz"
Target = 0001.
bcfg: Add Boot0001 as 0
Shell> bcfg boot dump
Option: 00. Variable: Boot0001
Desc - zzzzzzzzz
DevPath - Fv(87940482-FC81-41C3-87E6-399CF85AC8A0)/\Shell.efi
Optional- N
Option: 01. Variable: Boot0006
Desc - Shell.efi
DevPath - Fv(87940482-FC81-41C3-87E6-399CF85AC8A0)/\Shell.efi
Optional- N
Option: 02. Variable: Boot0000
Desc - xxxxxxxxx
DevPath - Fv(87940482-FC81-41C3-87E6-399CF85AC8A0)/\Shell.efi
Optional- N
Shell> setvar Boot0001
8BE4DF61-93CA-11D2-AA0D-00E098032B8C - Boot0001 - 004C Bytes
01 00 00 00 32 00 7A 00 7A 00 7A 00 7A 00 7A 00 7A 00 7A 00 7A 00 7A
00 00 00 04 07 14 00 82 04 94 87 81 FC C3 41 87 E6 39 9C F8 5A C8 A0
04 04 1A 00 5C 00 53 00 68 00 65 00 6C 00 6C 00 2E 00 65 00 66 00 69
00 00 00 7F FF 04 00
Shell> bcfg boot -opt 0 1 2 3 4
Shell> setvar Boot0001
8BE4DF61-93CA-11D2-AA0D-00E098032B8C - Boot0001 - 004C Bytes
01 00 00 00 32 00 7A 00 7A 00 7A 00 7A 00 7A 00 7A 00 7A 00 7A 00 7A
00 00 00 04 07 14 00 82 04 94 87 81 FC C3 41 87 E6 39 9C F8 5A C8 A0
04 04 1A 00 5C 00 53 00 68 00 65 00 6C 00 6C 00 2E 00 65 00 66 00 69
00 00 00 7F FF 04 00
And after setting the optional data, the output of bcfg and setvar
remain the same.
I also tried setting the optional data at the same time as creating
the boot option, but that fails in the same way:
Shell> bcfg boot add 0 fs0:\Shell.efi "Shell" -opt 0 1 2 3
So, am I doing something wrong or is BCFG buggy?? I'm off to look at
the code, because I think there's at least one bug...
Regards,
Ryan.
ARM Ltd Platform support is migrating to use OpenPlatformPkg [1].
Currently, Juno and FVP exist both in EDK2's ArmPlatformPkg and in
OpenPlatformPkg. And they are starting to diverge, with
OpenPlatformPkg being the most up-to-date with current developments.
To prevent this divergence, remove the .dsc and .fdf files from
ArmPlatformPkg and leave OpenPlatformPkg as the master.
We can't remove ArmJuno.dec yet because ACPI still uses it to set the
include path to ArmPlatform.h.
[PATCH 1/2] ArmPlatformPkg: remove ArmVExpress-FVP-AArch64
[PATCH 2/2] ArmPlatformPkg: remove ArmJuno.dsc/fdf
ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc | 291 -----------------------------------------------------------------------
ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf | 365 -----------------------------------------------------------------------------------------
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc | 317 -----------------------------------------------------------------------------
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf | 401 --------------------------------------------------------------------------------------------------
[1] https://git.linaro.org/uefi/OpenPlatformPkg.git
BdsConnectAndUpdateDevicePath() won't set right handle if device path
is file path or memory mapped. Now try to tranverse all handles for
FvFile in Fv.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang(a)linaro.org>
---
ArmPkg/Library/BdsLib/BdsFilePath.c | 135 ++++++++++++++++++++----------------
1 file changed, 75 insertions(+), 60 deletions(-)
diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c
index 42c6dc4..2751500 100644
--- a/ArmPkg/Library/BdsLib/BdsFilePath.c
+++ b/ArmPkg/Library/BdsLib/BdsFilePath.c
@@ -630,81 +630,96 @@ BdsFirmwareVolumeLoadImage (
EFI_FV_FILE_ATTRIBUTES Attrib;
UINT32 AuthenticationStatus;
VOID* ImageBuffer;
+ UINTN NoHandles, HandleIndex;
+ EFI_HANDLE *Handles;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FwDevicePath;
ASSERT (IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP));
- Status = gBS->HandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FwVol);
- if (EFI_ERROR (Status)) {
+ Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, NULL, &NoHandles, &Handles);
+ if (EFI_ERROR (Status) || (NoHandles == 0)) {
+ DEBUG ((EFI_D_ERROR, "FAIL to find Firmware Volume\n"));
return Status;
}
+ // Search in all Firmware Volume for the EFI Application
+ for (HandleIndex = 0; HandleIndex < NoHandles; HandleIndex++) {
+ Status = gBS->HandleProtocol (Handles[HandleIndex], &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FwVol);
+ if (EFI_ERROR (Status))
+ continue;
+
+ FwDevicePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)RemainingDevicePath;
+ FvNameGuid = &(FwDevicePath->FvFileName);
+ if (FvNameGuid == NULL) {
+ Status = EFI_INVALID_PARAMETER;
+ continue;
+ }
- FvNameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)RemainingDevicePath);
- if (FvNameGuid == NULL) {
- Status = EFI_INVALID_PARAMETER;
- }
-
- SectionType = EFI_SECTION_PE32;
- AuthenticationStatus = 0;
- //Note: ReadSection at the opposite of ReadFile does not allow to pass ImageBuffer == NULL to get the size of the file.
- ImageBuffer = NULL;
- Status = FwVol->ReadSection (
- FwVol,
- FvNameGuid,
- SectionType,
- 0,
- &ImageBuffer,
- ImageSize,
- &AuthenticationStatus
- );
- if (!EFI_ERROR (Status)) {
+ SectionType = EFI_SECTION_PE32;
+ AuthenticationStatus = 0;
+ //Note: ReadSection at the opposite of ReadFile does not allow to pass ImageBuffer == NULL to get the size of the file.
+ ImageBuffer = NULL;
+ Status = FwVol->ReadSection (
+ FwVol,
+ FvNameGuid,
+ SectionType,
+ 0,
+ &ImageBuffer,
+ ImageSize,
+ &AuthenticationStatus
+ );
+ if (!EFI_ERROR (Status)) {
#if 0
- // In case the buffer has some address requirements, we must copy the buffer to a buffer following the requirements
- if (Type != AllocateAnyPages) {
- Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize),Image);
- if (!EFI_ERROR (Status)) {
- CopyMem ((VOID*)(UINTN)(*Image), ImageBuffer, *ImageSize);
- FreePool (ImageBuffer);
+ // In case the buffer has some address requirements, we must copy the buffer to a buffer following the requirements
+ if (Type != AllocateAnyPages) {
+ Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize),Image);
+ if (!EFI_ERROR (Status)) {
+ CopyMem ((VOID*)(UINTN)(*Image), ImageBuffer, *ImageSize);
+ FreePool (ImageBuffer);
+ }
}
- }
#else
- // We must copy the buffer into a page allocations. Otherwise, the caller could call gBS->FreePages() on the pool allocation
- Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
- // Try to allocate in any pages if failed to allocate memory at the defined location
- if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
- Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
- }
- if (!EFI_ERROR (Status)) {
- CopyMem ((VOID*)(UINTN)(*Image), ImageBuffer, *ImageSize);
- FreePool (ImageBuffer);
- }
-#endif
- } else {
- // Try a raw file, since a PE32 SECTION does not exist
- Status = FwVol->ReadFile (
- FwVol,
- FvNameGuid,
- NULL,
- ImageSize,
- &FvType,
- &Attrib,
- &AuthenticationStatus
- );
- if (!EFI_ERROR (Status)) {
+ // We must copy the buffer into a page allocations. Otherwise, the caller could call gBS->FreePages() on the pool allocation
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
// Try to allocate in any pages if failed to allocate memory at the defined location
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
}
if (!EFI_ERROR (Status)) {
- Status = FwVol->ReadFile (
- FwVol,
- FvNameGuid,
- (VOID**)Image,
- ImageSize,
- &FvType,
- &Attrib,
- &AuthenticationStatus
- );
+ CopyMem ((VOID*)(UINTN)(*Image), ImageBuffer, *ImageSize);
+ FreePool (ImageBuffer);
+ return Status;
+ }
+#endif
+ } else {
+ // Try a raw file, since a PE32 SECTION does not exist
+ Status = FwVol->ReadFile (
+ FwVol,
+ FvNameGuid,
+ NULL,
+ ImageSize,
+ &FvType,
+ &Attrib,
+ &AuthenticationStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
+ // Try to allocate in any pages if failed to allocate memory at the defined location
+ if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
+ Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
+ }
+ if (!EFI_ERROR (Status)) {
+ Status = FwVol->ReadFile (
+ FwVol,
+ FvNameGuid,
+ (VOID*)(UINTN)(*Image),
+ ImageSize,
+ &FvType,
+ &Attrib,
+ &AuthenticationStatus
+ );
+ if (!EFI_ERROR (Status))
+ return Status;
+ }
}
}
}
--
1.9.1
Hi Ard,
ArmPlatformGlobalVariable is removed from edk2. But I still find the
reference in OpenPlatformPkg tree. And I also have a few issues on it.
1. Without it, I failed to build my HiKey platform. Could you help to
figure out how to resolve the build issue.
2. I stored global variables by this lib. Now it's removed. How could
I store global variable? Do you have any solution on it?
Regards
Haojian
This adds support for the C99 uintXX_t types when building for older versions
of the standard, like the other architectures already implement.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
---
v2: define int8_t as 'signed char' explicitly, since unqualified 'char' is
unsigned on ARM
inc/aarch64/efibind.h | 33 +++++++++++++++++++-
inc/arm/efibind.h | 31 ++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h
index 693fe5279031..ef7148d5312d 100644
--- a/inc/aarch64/efibind.h
+++ b/inc/aarch64/efibind.h
@@ -1,5 +1,36 @@
-
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long uint64_t;
+typedef long int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef signed char int8_t; // unqualified 'char' is unsigned on ARM
+
+#else
#include <stdint.h>
+#endif
//
// Basic EFI types of various widths
diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h
index cc4b5c598bf6..8c37f64c2dc8 100644
--- a/inc/arm/efibind.h
+++ b/inc/arm/efibind.h
@@ -1,5 +1,36 @@
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef signed char int8_t; // unqualified 'char' is unsigned on ARM
+
+#else
#include <stdint.h>
+#endif
/*
* This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32
--
2.5.0
This adds support for the C99 uintXX_t types when building for older versions
of the standard, like the other architectures already implement.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
---
inc/aarch64/efibind.h | 33 ++++++++++++++++++++++++++++++++-
inc/arm/efibind.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h
index 693fe5279031..04e3360cf653 100644
--- a/inc/aarch64/efibind.h
+++ b/inc/aarch64/efibind.h
@@ -1,5 +1,36 @@
-
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long uint64_t;
+typedef long int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef char int8_t;
+
+#else
#include <stdint.h>
+#endif
//
// Basic EFI types of various widths
diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h
index cc4b5c598bf6..f273db9c9658 100644
--- a/inc/arm/efibind.h
+++ b/inc/arm/efibind.h
@@ -1,5 +1,36 @@
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef char int8_t;
+
+#else
#include <stdint.h>
+#endif
/*
* This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32
--
2.5.0
I am starting on the task of refactoring ARM Platform support.
Initially in the ARM Ltd sense, but also in the general ARM-based SoC
case.
The existing platform code, mostly under ArmPlatformPkg is fragmented,
duplicated and hard to maintain. Adding a new platform often involves
copy/paste of a lot of code that the platform owner neither
understands nor really needs to care about.
The basic concept is to have as much common/generic code as possible
and have as little in the platform specific code. Thus making porting
to a new platform as simple as can be.
A new board using code that’s already in the tree should just be able
to provide a .dsc file with some defines in it and include the
common.dsc.inc file.
The common.dsc.inc file would then define everything, with conditional
statements including various drivers or features.
For example, juno.dsc would define that it is using the CFI NOR flash
driver and provide the defines for the flash config. The
common.dsc.inc file would only include the CFI NOR flash driver in the
build if it is specified in its parent .dsc file.
The other concept is to move the platform code from the EDK2 tree to
the OpenPlatformPkg tree.
In my experiments, I have included OpenPlatformPkg as a sub-tree of
the EDK2 git tree. This allows me to “git mv” files between the two
repos. In reality, we would have to “git add” to the OpenPlatformPkg
repo and “git rm” from EDK2 as separate patches.
---------------
Failed attempts
---------------
I had several plays with the code.
In one attempt, I moved all the code in ArmPlatformPkg that was used
by Juno and attempted to get this working in the new location.
Unfortunately, in my opinion, the build system is so obtuse that this
becomes a tangled web of build failures. I aborted this attempt very
quickly.
In another attempt, I thought I would start from scratch by creating a
new BSP. But I realised that my understanding of much of the
code/config was severely lacking. There are some components and
sections of the DSC and FDF files where I have absolutely no idea what
they are for. I guess many people are in this position and it’s
probably a reason why so many BSPs are boilerplate copied from
ArmPlatformPkg.
---------------
Getting started
---------------
I decided to start by splitting the Juno BSP up into common and
platform specific code. The first step is to create a new juno.dsc
file in OpenPlatformPkg.
Initially, this just #included ArmJuno.dsc from edk2.
Next, I copied ArmJuno.dsc over to
OpenPlatformPkg/Platforms/common/common.dsc.inc and included that in
the new juno.dsc.
Then, I migrated Juno specific stuff from common.dsc.inc to juno.dsc,
eg. “PLATFORM_NAME = ArmJuno”.
>From here on, I started walking through the common.dsc.inc file and
moving code across from ArmPlatformPkg to
OpenPlatformPkg/Platforms/common. Bit by bit, I moved, renamed and
fixed up components used by the Juno platform.
At this point, the “common” code is still very Juno specific.
Function names, symbols and various other pieces still reference Juno.
This needs to be fixed.
One part (of the many) that may cause controversy is that I have kept
to a “simple” file naming scheme. Instead of everything having the
words Arm, Juno, Platform and Pkg in multiple combinations, I’ve tried
to keep things simple. I also used all lower case filenames, because
we’re generally not DOS users and all these mixed case filenames drive
me insane. I expect this to go down badly with some, but hope I can
get away with it ;-)
-------------------------------
Once Juno is migrated to common
-------------------------------
After all the parts that Juno uses have been moved to OpenPlatformPkg,
I intend to add another platform. I’ll use FVP: it’s similar enough
to Juno that most of the common code will remain there, even if it is
still quite ARM platform specific, but it will allow me to demonstrate
two platforms using the common code.
What it won’t do yet is split out any functionality that is “Versatile
Express” in nature, but neither Juno nor FVP specific; i.e. any code
that is not really common to all platforms, but is common to ARM Ltd's
platforms.
After this, I was thinking that first I need to go around cleaning up
the code to remove all the Juno references. Then, adding another
platform, such as HiKey or D01/02 into the common framework might be a
brave next step to see how much we can keep common and how much needs
to be split back into Juno, FVP or Versatile Express specific areas.
-------------
My GIT branch
-------------
I’ve created a demo branch with my experimental changes here:
https://git.linaro.org/landing-teams/working/arm/edk2.git/shortlog/refs/hea…
This is only intended to demonstrate a concept, so don’t take too much
of it to heart. I haven’t gone all the way in migrating the code
either, I’ve just picked the essentials, followed by the NOR flash and
ACPI parts. I picked those because NOR is common and ACPI is Juno
specific.
--------------
So what next??
--------------
In order to push this code to OpenPlatformPkg, I think there are two
ways of doing it:
Big hit: go away, do all the work in isolation and submit a patch series.
Gradual migration: submit small patch series as they are ready and
remove the code from ArmPlatformPkg as we move along.
I’m a bit worried about doing it in one big hit. Looking at the
amount of free time I have to work on this and how long my experiments
have taken me, I worry that by the time the work is “done”, it will
need some serious fixing again to catch up to the upstream code
changes. I also think it leaves my changes less open to scrutiny by
others.
Unfortunately, a gradual migration would possibly take a longer
elapsed time to complete. I don’t think it would be realistic to
create the new code in OpenPlatformPkg without removing (some of?) the
code from ArmPlatformPkg as we go. If the migrated code is still in
ArmPlatformPkg, people will continue to use it and patch it, leaving
two diverging code bases that will need effort to sync. At the very
least, removing the ArmJuno.dsc from ArmPlatformPkg would help keep
things on track without removing the rest of the code in
ArmPlatformPkg.
At this point, I’m soliciting feedback on my approach and hoping to
get some sane critique on what can be done better/easier.
Regards,
Ryan.