diff options
author | Haojian Zhuang <haojian.zhuang@linaro.org> | 2018-03-07 22:06:18 +0800 |
---|---|---|
committer | Haojian Zhuang <haojian.zhuang@linaro.org> | 2018-03-07 22:07:51 +0800 |
commit | d3cd62f1dc9d7bb9db41d04fa604992843fc0839 (patch) | |
tree | 2eb053e13d66c1851008f20b04fa6600cdf96aef | |
parent | 43e836468cf761cbc7cf0d0d24cef20c3871243b (diff) | |
download | OpenPlatformPkg-d3cd62f1dc9d7bb9db41d04fa604992843fc0839.tar.gz |
Platforms/HiKey960: set specified serialno
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
-rw-r--r-- | Platforms/Hisilicon/HiKey960/HiKey960FastbootDxe/HiKey960FastbootDxe.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Platforms/Hisilicon/HiKey960/HiKey960FastbootDxe/HiKey960FastbootDxe.c b/Platforms/Hisilicon/HiKey960/HiKey960FastbootDxe/HiKey960FastbootDxe.c index c87040d..355119c 100644 --- a/Platforms/Hisilicon/HiKey960/HiKey960FastbootDxe/HiKey960FastbootDxe.c +++ b/Platforms/Hisilicon/HiKey960/HiKey960FastbootDxe/HiKey960FastbootDxe.c @@ -612,15 +612,32 @@ HiKey960FastbootPlatformOemCommand ( {
EFI_STATUS Status;
CHAR16 UnicodeSN[SERIAL_NUMBER_SIZE];
+ UINTN Size;
+ Size = AsciiStrLen ("serialno");
if (AsciiStrCmp (Command, "Demonstrate") == 0) {
DEBUG ((DEBUG_ERROR, "ARM OEM Fastboot command 'Demonstrate' received.\n"));
return EFI_SUCCESS;
- } else if (AsciiStrCmp (Command, "serialno") == 0) {
- Status = GenerateUsbSN (UnicodeSN);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "Failed to generate USB Serial Number.\n"));
- return Status;
+ } else if (AsciiStrnCmp (Command, "serialno", Size) == 0) {
+ while (*(Command + Size) == ' ') {
+ Size++;
+ }
+ if (AsciiStrnCmp (Command + Size, "set", AsciiStrLen ("set")) == 0) {
+ Size += AsciiStrLen ("set");
+ while (*(Command + Size) == ' ') {
+ Size++;
+ }
+ Status = AssignUsbSN (Command + Size, UnicodeSN);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Failed to set USB Serial Number.\n"));
+ return Status;
+ }
+ } else {
+ Status = GenerateUsbSN (UnicodeSN);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Failed to generate USB Serial Number.\n"));
+ return Status;
+ }
}
Status = StoreSNToBlock (mFlashHandle, SERIAL_NUMBER_LBA, UnicodeSN);
return Status;
|