summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2018-08-14 14:27:06 +0800
committerGitHub <noreply@github.com>2018-08-14 14:27:06 +0800
commit2794e3f41122a085d2379881466c2088bb72e169 (patch)
treeaf7a40a54ed8b4add4aa834423a6129829430a0d
parent146cf2401837e104e55fff9b1862b3948c13a1ab (diff)
parentce3fe5ea2186566f2a5b8f255a7bb7ea7820cf3e (diff)
downloadedk2-2794e3f41122a085d2379881466c2088bb72e169.tar.gz
Merge pull request #75 from hzhuang1/initrd_2
Initrd 2
-rwxr-xr-xBaseTools/Conf/tools_def.template2
-rw-r--r--EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c36
2 files changed, 20 insertions, 18 deletions
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 79d19e9d8..7736cfb5c 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4344,7 +4344,7 @@ DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-ad
DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie
DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
-DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-pic -fno-pie -ffixed-x18
+DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18
DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
diff --git a/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c b/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c
index a8db3ac1a..7b81d079c 100644
--- a/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c
+++ b/EmbeddedPkg/Library/AbootimgLib/AbootimgLib.c
@@ -268,23 +268,25 @@ AllocateRamdisk (
ASSERT (IS_POWER_OF_2 (Header->PageSize));
- Address = (EFI_PHYSICAL_ADDRESS)(UINTN)Header->RamdiskAddress;
- Status = gBS->AllocatePages (
- AllocateAddress, EfiBootServicesData,
- EFI_SIZE_TO_PAGES (Header->RamdiskSize), &Address);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Source = (VOID *) (BootImgBytePtr + Header->PageSize +
- ALIGN_VALUE (Header->KernelSize, Header->PageSize));
- CopyMem ((VOID *)(UINTN)Address, Source, Header->RamdiskSize);
- // Set the ramdisk in command line arguments
- if (KernelArgs != NULL) {
- UnicodeSPrint (
- (CHAR16 *)KernelArgs + StrLen (KernelArgs), BOOTIMG_KERNEL_ARGS_SIZE,
- L" initrd=0x%x,0x%x",
- (UINTN)Address, Header->RamdiskSize
- );
+ if (Header->RamdiskAddress && Header->RamdiskSize) {
+ Address = (EFI_PHYSICAL_ADDRESS)(UINTN)Header->RamdiskAddress;
+ Status = gBS->AllocatePages (
+ AllocateAddress, EfiBootServicesData,
+ EFI_SIZE_TO_PAGES (Header->RamdiskSize), &Address);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ Source = (VOID *) (BootImgBytePtr + Header->PageSize +
+ ALIGN_VALUE (Header->KernelSize, Header->PageSize));
+ CopyMem ((VOID *)(UINTN)Address, Source, Header->RamdiskSize);
+ // Set the ramdisk in command line arguments
+ if (KernelArgs != NULL) {
+ UnicodeSPrint (
+ (CHAR16 *)KernelArgs + StrLen (KernelArgs), BOOTIMG_KERNEL_ARGS_SIZE,
+ L" initrd=0x%x,0x%x",
+ (UINTN)Address, Header->RamdiskSize
+ );
+ }
}
return Status;
}