Thanks for the patch, it was merged.
The format is reasonable, it made the patch easy to understand...

-Ning 



-----Original Message-----
From: Ahmed, Safayet (GE Global Research, US) [mailto:safayet.ah...@ge.com] 
Sent: Thursday, June 01, 2017 9:52 AM
To: TBoot Dev List (tboot-devel@lists.sourceforge.net) 
<tboot-devel@lists.sourceforge.net>
Subject: [tboot-devel] Check for initrd image before moving

Currently, TBoot attempts to move the initrd image without checking if an 
initrd image is present. If no initrd image is present, Linux expects the base 
address of the initrd image to be set to zero in the Linux header.

The following patch modifies the Linux loading code such that the initrd image 
is only moved if the size is greater than zero. I apologize for the poor 
formatting, but I left the block without the additional indentation to make the 
change clear.

Signed-off-by: Safayet Ahmed <safayet.ah...@ge.com>

--- a/tboot/common/linux.c    Mon May 29 20:11:40 2017 -0700
+++ b/tboot/common/linux.c    Thu Jun 01 12:21:45 2017 -0400
@@ -161,6 +161,7 @@
     hdr->loadflags |= FLAG_CAN_USE_HEAP;         /* can use heap */
     hdr->heap_end_ptr = KERNEL_CMDLINE_OFFSET - BOOT_SECTOR_OFFSET;
 
+    if( initrd_size > 0 ){
     /* load initrd and set ramdisk_image and ramdisk_size */
     /* The initrd should typically be located as high in memory as
        possible, as it may otherwise get overwritten by the early @@ -221,6 
+222,8 @@
     printk(TBOOT_DETA"Initrd from 0x%lx to 0x%lx\n",
            (unsigned long)initrd_base,
            (unsigned long)(initrd_base + initrd_size));
+    }else
+        initrd_base = (uint32_t)initrd_image;
 
     hdr->ramdisk_image = initrd_base;
     hdr->ramdisk_size = initrd_size;


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech 
sites, Slashdot.org! http://sdm.link/slashdot 
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to