Hello.

We found linux-2.4.0-test1-ac1 can't boot with GNU GRUB + User
'mem=' parameter on iX86 architecture

1. The problem of Linux kernel memory region setting code
(arch/i386/kernel/setup.c in Linux kernel tree)

On linux-2.2.XX, only one memory region is prepared at boot time.

For example, the following command line is passed to kernel,

mem=66550K mem=128M

a 'mem=128M' parameter overwrite 'mem=66550K' parameter  as
 the following. There is no problem.

start           end
0x100000        0x8000000

But, on linux-2.4.0-test1-ac[1-4](also 2.3.99preX), several
memory region is prepared at boot time.
For example, following command line as above is passed to kernel.

mem=66550K mem=128M

Three memory regions are set as the following.

start           end
0x00000000      0x0009f000
0x00100000      0x04000000
0x00100000      0x08000000

Two memory region have the same start address.
A 'request_resource' call conflicts with these regions.


2. The problem of GNU GRUB
(Version 0.94 or later)
(About grub, see http://www.gnu.org/software/grub/)

The GRUB adds 'mem=XXXK' parameter to kernel command
line.(In function 'load_image' in stage2/boot.c)
This parameter is inconsistent with 'mem=<size>' parameter
specified by an user.

For example, when GRUB detects 65550K bytes memory size, 
and an user specifies the following command.

kernel (hd0,0)/vmlinuz mem=128M

The command line passed to kernel is the following which has
two 'mem=<size>' parameters.

mem=66550K mem=128M


3. To avoid this problem

There is two way.

(1) GRUB Configuration
Command 'uppermem' make GRUB to generate 'mem=<size>'
parameter which an user want to specify as the following.
(128 * 1024 - 1024 = 130048)

uppermem 130048
kernel (hd0,0)/vmlinuz

In this case, the command line passed to kernel is the following.

mem=131072K

(2) Fix kernel code

Fix kernel code as the last 'mem=<size>' parameter
overwrites former 'mem=<size>' parameter.

--- linux-2.4.0.test1.ac4/arch/i386/kernel/setup-old.c      Mon May 29 14:06:04 2000
+++ linux-2.4.0.test1.ac4/arch/i386/kernel/setup.c  Tue May 30 19:26:22 2000
@@ -532,6 +532,7 @@
                                else {
                                        start_at = HIGH_MEMORY;
                                        mem_size -= HIGH_MEMORY;
+                                       usermem = 0;
                                }
                                add_memory_region(start_at, mem_size, E820_RAM);
                        }

Reply via email to