summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlek Du <alek.du@intel.com>2009-10-23 09:59:37 +0800
committerPatrick Tjin <pattjin@google.com>2014-07-21 20:22:39 -0700
commit9843d275bb1595883bf6010853ef0d86c8839c78 (patch)
treecfdfd03ddeb6718eed995a82b578fd735792fb6c
parent589633d40e1103591630d399aac0bd39ea3613c5 (diff)
downloadbootstub-9843d275bb1595883bf6010853ef0d86c8839c78.tar.gz
initrd: do not copy initrd image to DDR location if no initrd exists
Signed-off-by: Alek Du <alek.du@intel.com>
-rw-r--r--bootstub.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/bootstub.c b/bootstub.c
index 03e623e..60868d0 100644
--- a/bootstub.c
+++ b/bootstub.c
@@ -98,6 +98,8 @@ static size_t strnlen(const char *s, size_t maxlen)
static void setup_boot_params(struct boot_params *bp, struct setup_header *sh)
{
+ u8 *initramfs;
+
memset(bp, 0, sizeof (struct boot_params));
bp->screen_info.orig_video_mode = 0;
bp->screen_info.orig_video_lines = 0;
@@ -110,8 +112,13 @@ static void setup_boot_params(struct boot_params *bp, struct setup_header *sh)
bp->hdr.ramdisk_size = *(u32 *)INITRD_SIZE_OFFSET;
bp->hdr.ramdisk_image = (bp->alt_mem_k*1024 - bp->hdr.ramdisk_size) & 0xFFFFF000;
bp->hdr.hardware_subarch = X86_SUBARCH_MRST;
- memcpy((u8*)bp->hdr.ramdisk_image, (u8 *)BZIMAGE_OFFSET + *(u32 *)BZIMAGE_SIZE_OFFSET, bp->hdr.ramdisk_size);
-
+ initramfs = (u8 *)BZIMAGE_OFFSET + *(u32 *)BZIMAGE_SIZE_OFFSET;
+ if (*initramfs) {
+ bs_printk("Relocating initramfs to high memory ...\n");
+ memcpy((u8*)bp->hdr.ramdisk_image, initramfs, bp->hdr.ramdisk_size);
+ } else {
+ bs_printk("Won't relocate initramfs, are you in SLE?\n");
+ }
sfi_setup_e820(bp);
}