Re: Re. [SPARC32]: Fix bogus ramdisk image location check.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mark@xxxxxxxxxxxxxxxxxx wrote:

Hi Robert,

Can you put some prom_printf's or printk's in to find out where your initrd ramdisk is ending up.
The code relies on ordering/alignment in the linker script which is not a good idear so the aim needs to be to create some code that correctly identifies the location of the ramdisk without using hard coded offsets based on '&end' and 2*4096 :). I will have another look at the code later on this week and see if I can work out somthing that does the same thing but with more flexibility in what can be done to the linker script (i.e. does not rely on specific alignments and ordering in the linker script).

The information about where the ramdisk is may present a simple solution.

Regards
   Mark Fortescue.


The following patch gives these numbers:

sparc_ramdisk_image = 3000000, &_end = f028bde0, phys_base = 0, sparc_ramdisk_size = 3064303
initrd_start = 3000000, initrd_end = 32ec1ef


--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init.c
@@ -206,9 +206,13 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
 #ifdef CONFIG_BLK_DEV_INITRD
 	/* Now have to check initial ramdisk, so that bootmap does not overwrite it */
 	if (sparc_ramdisk_image) {
-		sparc_ramdisk_image -= KERNBASE;
+printk("sparc_ramdisk_image = %x, &_end = %p, phys_base = %lx, sparc_ramdisk_size = %u\n", 
+sparc_ramdisk_image, &_end, phys_base, sparc_ramdisk_size);
+		if (sparc_ramdisk_image >= (unsigned long)&_end - 2 * PAGE_SIZE)
+			sparc_ramdisk_image -= KERNBASE;
 		initrd_start = sparc_ramdisk_image + phys_base;
 		initrd_end = initrd_start + sparc_ramdisk_size;
+printk("initrd_start = %lx, initrd_end = %lx\n", initrd_start, initrd_end);
 		if (initrd_end > end_of_phys_memory) {
 			printk(KERN_CRIT "initrd extends beyond end of memory "
 		                 	 "(0x%016lx > 0x%016lx)\ndisabling initrd\n",

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux