This is a hack and is not intended to go upstream, but will be useful for Linaro's short term goals.
Linaro's development boards use SD cards, currently we have a problem where each unique SD card has a different UUID when created with linaro-media-create / linaro-android-media create.
This means that no one Boot Device configuration can boot Linaro images without some manual intervention from the user.
This hack will zero the signature (UUID) read from the card meaning that all SD cards will appear to be the same card.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ryan Harkin <ryan.harkin(a)linaro.org>
---
MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
index 4c64663..ef16396 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
@@ -155,6 +155,15 @@ PartitionInstallMbrChildHandles (
BlockSize,
Mbr
);
+
+ // RMH - hack - Linaro's development boards use SD cards, currently we have
+ // a problem where each unique SD card has a different UUID when created
+ // with linaro-media-create / linaro-android-media create.
+ // This means that no one Boot Device configuration can boot Linaro images
+ // without some manual intervention from the user.
+ // This hack will zero the signature (UUID) read from the card.
+ ZeroMem(&(Mbr->UniqueMbrSignature[0]), sizeof (Mbr->UniqueMbrSignature));
+
if (EFI_ERROR (Status)) {
Found = Status;
goto Done;
--
1.7.9.5
The attached patch will change the default config for the Arndale
board so that it boots into a Linaro SD card image.
Problem is that a bug [1] prevents the Arndale board booting from a
linaro-media-create'd image, so this patch can only sensibly applied
after that bug is fixed.
[1] https://bugs.launchpad.net/arndale/+bug/1124178
On 02/13/2013 10:44 AM, Olivier Martin wrote:
> Instead of using:
> #if !defined(MDEPKG_NDEBUG)
> (...)
> #endif
>
> It would be better to use:
> DEBUG_CODE_BEGIN();
> (...)
> DEBUG_CODE_END();
>
> The reason is you can be in debug build and disable debug code (and/or
> disable other things such as ASSERT). See definition of PcdDebugPropertyMask
> for the full list of debug properties.
These macros insert code which would place the variable definition
inside an "if" statement. This usage violates the Coding Standard on
page 30:
"The data declarations must be the first code in a module."
"Data declarations appearing anywhere but at the beginning of the
module are illegal."
> The EDK2 coding convention
> (http://sourceforge.net/projects/edk2/files/General%20Documentation/EDK%20II
> %20C%20Coding%20Standards%20Specification.pdf/download) says we should not
> write this kind of variable declaration:
> EFI_STATUS Status = EFI_INVALID_PARAMETER;
>
> See page 30: "Initializing a variable as part of its declaration is
> illegal."
This restriction is violated in almost every case in the files I
patched. I merely coded my changes to blend in with the surrounding
code, as any good maintenance programmer would do.
The coding standard's requirement is, in this case, contrary to commonly
accepted coding practice in the industry for the last decade. It really
should be removed from the DRAFT standard.
The mandatory space between the function name and the opening paren of
its argument list needs to go away too: the vast majority of the
programmers I've spoken with read that as missing a binary operator
between a variable and a parenthized expression. They have to re-read
the code several times before it becomes apparent that this is a
function call and not a coding error. The existence of documented
exceptions (macro definitions, etc.) support the argument that it's a
bad practice.
Feel free to change the patch as you see fit. I never expected to
publish these changes; they were intended only to help me figure out why
I couldn't build a standard target in my development environment. Ryan
asked for copies so I provided them.
-Reece
The attached patch changes the PandaBoardPkg/build.sh script RELEASE
or DEBUG parameter handling.
Before this patch, build.sh can be called thus:
./build.sh
./build.sh -b DEBUG
./build.sh RELEASE
This patch simplifies the way you pass the debug/release parameter
into build.sh so that build scripts can simply pass DEBUG or RELEASE,
without having to create a special case to add the "-b".
Eg.
./build.sh
./build.sh DEBUG
./build.sh RELEASE