pp2.1.0#4 bugfix for mem= option and init_rd

Heiko Eissfeldt (heiko@colossus.escape.de)
Mon, 30 Sep 1996 02:41:33 +0200 (MEST)


Hi Linus and other bleeding edge people,

When you try to boot the pre-patch 2.1.0 #4 i386 kernel with
the mem=... option, it reboots.

The tested fix follows.

While looking at the code, I found a suspiscious spot in the
sizing of the init_rd. This patch is untested, please have a look.

Heiko

--- arch/i386/kernel/setup.c.or Fri Sep 27 03:58:57 1996
+++ arch/i386/kernel/setup.c Mon Sep 30 02:29:19 1996
@@ -139,7 +139,6 @@
if (!MOUNT_ROOT_RDONLY)
root_mountflags &= ~MS_RDONLY;
memory_start = (unsigned long) &_end;
- memory_end += PAGE_OFFSET;
init_task.mm->start_code = PAGE_OFFSET;
init_task.mm->end_code = (unsigned long) &_etext;
init_task.mm->end_data = (unsigned long) &_edata;
@@ -180,13 +179,14 @@
}
*to = '\0';
*cmdline_p = command_line;
+ memory_end += PAGE_OFFSET;
*memory_start_p = memory_start;
*memory_end_p = memory_end;

#ifdef CONFIG_BLK_DEV_INITRD
if (LOADER_TYPE) {
initrd_start = INITRD_START + PAGE_OFFSET;
- initrd_end = INITRD_START+INITRD_SIZE;
+ initrd_end = initrd_start+INITRD_SIZE;
if (initrd_end > memory_end) {
printk("initrd extends beyond end of memory "
"(0x%08lx > 0x%08lx)\ndisabling initrd\n",