diff options
author | Alek Du <alek.du@intel.com> | 2009-10-23 09:59:37 +0800 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2014-07-21 20:22:39 -0700 |
commit | 9843d275bb1595883bf6010853ef0d86c8839c78 (patch) | |
tree | cfdfd03ddeb6718eed995a82b578fd735792fb6c | |
parent | 589633d40e1103591630d399aac0bd39ea3613c5 (diff) | |
download | bootstub-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.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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); } |