All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
@ 2008-05-02 16:36 Alon Bar-Lev
  2008-05-02 16:50 ` Vesa Jääskeläinen
  0 siblings, 1 reply; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 16:36 UTC (permalink / raw)
  To: grub-devel


Hello,

Continue from bug#13606 [1]

cmd_line_ptr should not be truncated to 256.

A draft patch is provided. I could not test it as grub-2 does not work in my VMWare (ATA) configuration.
It enters rescue prompt and when I set root (hd0, 1) I get "error: unknown device".
I tried adding many modules (lspci for example) but not see any command when typing help.

Please review this patch or apply something better.
For EFI I did not understand what the lh.cl_offset = 0 is for, but as only recent boot protocols are
supported I am not sure it is required.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

[1] https://savannah.gnu.org/bugs/?13606

---

diff -urNp grub-1.96.org/include/grub/i386/linux.h grub-1.96/include/grub/i386/linux.h
--- grub-1.96.org/include/grub/i386/linux.h	2007-07-21 21:22:34.000000000 +0300
+++ grub-1.96/include/grub/i386/linux.h	2008-05-02 19:18:15.000000000 +0300
@@ -41,7 +41,9 @@
 
 #define GRUB_LINUX_CL_OFFSET		0x9000
 #define GRUB_LINUX_CL_END_OFFSET	0x90FF
-#define GRUB_LINUX_SETUP_MOVE_SIZE	0x9100
+#define GRUB_LINUX_CL_0202_OFFSET	0x9100
+#define GRUB_LINUX_CL_0202_END_OFFSET	0x9FFF
+#define GRUB_LINUX_SETUP_MOVE_SIZE	0xA000
 #define GRUB_LINUX_CL_MAGIC		0xA33F
 
 #define GRUB_LINUX_EFI_SIGNATURE	\
diff -urNp grub-1.96.org/loader/i386/efi/linux.c grub-1.96/loader/i386/efi/linux.c
--- grub-1.96.org/loader/i386/efi/linux.c	2007-07-22 00:09:47.000000000 +0300
+++ grub-1.96/loader/i386/efi/linux.c	2008-05-02 19:19:12.000000000 +0300
@@ -391,8 +391,8 @@ grub_rescue_cmd_linux (int argc, char *a
   lh.type_of_loader = 0x50;
 
   lh.cl_magic = GRUB_LINUX_CL_MAGIC;
-  lh.cl_offset = GRUB_LINUX_CL_END_OFFSET;
-  lh.cmd_line_ptr = (char *) real_mode_mem + GRUB_LINUX_CL_OFFSET;
+  lh.cl_offset = 0;
+  lh.cmd_line_ptr = (char *) real_mode_mem + GRUB_LINUX_CL_0202_OFFSET;
   lh.ramdisk_image = 0;
   lh.ramdisk_size = 0;
 
@@ -531,7 +531,7 @@ grub_rescue_cmd_linux (int argc, char *a
       }
 
   /* Specify the boot file.  */
-  dest = grub_stpcpy ((char *) real_mode_mem + GRUB_LINUX_CL_OFFSET,
+  dest = grub_stpcpy ((char *) real_mode_mem + GRUB_LINUX_CL_0202_OFFSET,
 		      "BOOT_IMAGE=");
   dest = grub_stpcpy (dest, argv[0]);
   
@@ -539,7 +539,7 @@ grub_rescue_cmd_linux (int argc, char *a
   for (i = 1;
        i < argc
 	 && dest + grub_strlen (argv[i]) + 1 < ((char *) real_mode_mem
-						+ GRUB_LINUX_CL_END_OFFSET);
+						+ GRUB_LINUX_CL_0202_END_OFFSET);
        i++)
     {
       *dest++ = ' ';
diff -urNp grub-1.96.org/loader/i386/pc/linux.c grub-1.96/loader/i386/pc/linux.c
--- grub-1.96.org/loader/i386/pc/linux.c	2008-01-12 02:31:55.000000000 +0200
+++ grub-1.96/loader/i386/pc/linux.c	2008-05-02 19:20:35.000000000 +0300
@@ -117,7 +117,7 @@ grub_rescue_cmd_linux (int argc, char *a
 	}
       
       if (grub_le_to_cpu16 (lh.version) >= 0x0202)
-	lh.cmd_line_ptr = grub_linux_real_addr + GRUB_LINUX_CL_OFFSET;
+	lh.cmd_line_ptr = grub_linux_real_addr + GRUB_LINUX_CL_OFFSET;
       else
 	{
 	  lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC);
@@ -244,7 +244,7 @@ grub_rescue_cmd_linux (int argc, char *a
 		  << GRUB_DISK_SECTOR_BITS));
 
   /* Specify the boot file.  */
-  dest = grub_stpcpy (grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET,
+  dest = grub_stpcpy (grub_linux_tmp_addr + GRUB_LINUX_CL_0202_OFFSET,
 		      "BOOT_IMAGE=");
   dest = grub_stpcpy (dest, argv[0]);
   
@@ -252,13 +252,18 @@ grub_rescue_cmd_linux (int argc, char *a
   for (i = 1;
        i < argc
 	 && dest + grub_strlen (argv[i]) + 1 < (grub_linux_tmp_addr
-						+ GRUB_LINUX_CL_END_OFFSET);
+						+ GRUB_LINUX_CL_0202_END_OFFSET);
        i++)
     {
       *dest++ = ' ';
       dest = grub_stpcpy (dest, argv[i]);
     }
 
+  grub_strncpy (grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET,
+                grub_linux_tmp_addr + GRUB_LINUX_CL_0202_OFFSET,
+		GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET - 1);
+  *(grub_linux_tmp_addr + GRUB_LINUX_CL_END_OFFSET) = '\0';
+
   len = prot_size;
   if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
     grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 16:36 [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines Alon Bar-Lev
@ 2008-05-02 16:50 ` Vesa Jääskeläinen
  2008-05-02 16:59   ` Alon Bar-Lev
  0 siblings, 1 reply; 15+ messages in thread
From: Vesa Jääskeläinen @ 2008-05-02 16:50 UTC (permalink / raw)
  To: The development of GRUB 2

Alon Bar-Lev wrote:
> A draft patch is provided. I could not test it as grub-2 does not work in my VMWare (ATA) configuration.
> It enters rescue prompt and when I set root (hd0, 1) I get "error: unknown device".
> I tried adding many modules (lspci for example) but not see any command when typing help.

Hi Alon,

So when did vmware stop working? Can you tell me what you did try to do 
to get it working? I have one vmware here handy so I could try it out.

Thanks,
Vesa Jääskeläinen



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 16:50 ` Vesa Jääskeläinen
@ 2008-05-02 16:59   ` Alon Bar-Lev
  2008-05-02 17:07     ` Vesa Jääskeläinen
  0 siblings, 1 reply; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 16:59 UTC (permalink / raw)
  To: The development of GRUB 2

On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>  Hi Alon,
>
>  So when did vmware stop working? Can you tell me what you did try to do to
> get it working? I have one vmware here handy so I could try it out.
>
>  Thanks,
>  Vesa Jääskeläinen

Hi!

Stopped working when I installed grub-2 :)
Working fine with grub-1.

I am using vmware-server-1.0.5.80187, with ide configuration also for disks.

But anyway... Why don't I get lspci command available if I added this
to grub-install and see it loaded in lsmod output?

Alon.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 16:59   ` Alon Bar-Lev
@ 2008-05-02 17:07     ` Vesa Jääskeläinen
  2008-05-02 17:17       ` Alon Bar-Lev
  0 siblings, 1 reply; 15+ messages in thread
From: Vesa Jääskeläinen @ 2008-05-02 17:07 UTC (permalink / raw)
  To: The development of GRUB 2

Alon Bar-Lev wrote:
> On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>>  Hi Alon,
>>
>>  So when did vmware stop working? Can you tell me what you did try to do to
>> get it working? I have one vmware here handy so I could try it out.
>>
>>  Thanks,
>>  Vesa Jääskeläinen
> 
> Hi!
> 
> Stopped working when I installed grub-2 :)
> Working fine with grub-1.
> 
> I am using vmware-server-1.0.5.80187, with ide configuration also for disks.
> 
> But anyway... Why don't I get lspci command available if I added this
> to grub-install and see it loaded in lsmod output?

Hi Alon,

Actually I meant that I have used it before in vmware desktop and it 
worked fine. So I was wondering when it got broken and how did exactly 
you try it out to reproduce the issue here. Because grub 2 "has to" work 
in vmware too :)

Eg. tell that you ran this and this. And then did that.

I think lspci might also need some device database. So if it cannot load 
it may fail. But lets first tackle this vmware problem :)

Thanks,
Vesa Jääskeläinen



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 17:07     ` Vesa Jääskeläinen
@ 2008-05-02 17:17       ` Alon Bar-Lev
  2008-05-02 18:04         ` Vesa Jääskeläinen
  0 siblings, 1 reply; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 17:17 UTC (permalink / raw)
  To: The development of GRUB 2

On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>
>  Hi Alon,
>
>  Actually I meant that I have used it before in vmware desktop and it worked
> fine. So I was wondering when it got broken and how did exactly you try it
> out to reproduce the issue here. Because grub 2 "has to" work in vmware too
> :)
>
>  Eg. tell that you ran this and this. And then did that.

I run:
grub-install /dev/hda

Nothing special... on boot I grub starts and goes into rescue prompt.
There is no proper documentation... So I don't know what else I can do.
I think I have a proper grub.cfg but I don't think I got to the stage
it actually can be read. As ls command command shows empty output.

>  I think lspci might also need some device database. So if it cannot load it
> may fail. But lets first tackle this vmware problem :)

But this is basic... the module is loaded... I understand that the
disk may not be detected, but I expect command to be available.

Alon.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 17:17       ` Alon Bar-Lev
@ 2008-05-02 18:04         ` Vesa Jääskeläinen
  2008-05-02 18:10           ` Alon Bar-Lev
  0 siblings, 1 reply; 15+ messages in thread
From: Vesa Jääskeläinen @ 2008-05-02 18:04 UTC (permalink / raw)
  To: The development of GRUB 2

Alon Bar-Lev wrote:
> On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>>  Hi Alon,
>>
>>  Actually I meant that I have used it before in vmware desktop and it worked
>> fine. So I was wondering when it got broken and how did exactly you try it
>> out to reproduce the issue here. Because grub 2 "has to" work in vmware too
>> :)
>>
>>  Eg. tell that you ran this and this. And then did that.
> 
> I run:
> grub-install /dev/hda
> 
> Nothing special... on boot I grub starts and goes into rescue prompt.
> There is no proper documentation... So I don't know what else I can do.
> I think I have a proper grub.cfg but I don't think I got to the stage
> it actually can be read. As ls command command shows empty output.

I just built current CVS and tried it with my old scripts. Didn't 
install it to /dev/hda as cannot test it without reinstall ;)... but 
made core.img with modules: chain fat biosdisk. Installed it to floppy 
and then booted that floppy in vmware desktop 5.5.4.

Even graphics mode seem to work.

I can provide this test floppy if you want to test it out?

>>  I think lspci might also need some device database. So if it cannot load it
>> may fail. But lets first tackle this vmware problem :)
> 
> But this is basic... the module is loaded... I understand that the
> disk may not be detected, but I expect command to be available.

insmod pci
insmod lspci
lspci




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 18:04         ` Vesa Jääskeläinen
@ 2008-05-02 18:10           ` Alon Bar-Lev
  2008-05-02 18:27             ` Vesa Jääskeläinen
  0 siblings, 1 reply; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 18:10 UTC (permalink / raw)
  To: The development of GRUB 2

On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>  I just built current CVS and tried it with my old scripts. Didn't install
> it to /dev/hda as cannot test it without reinstall ;)... but made core.img
> with modules: chain fat biosdisk. Installed it to floppy and then booted
> that floppy in vmware desktop 5.5.4.

I use grub-1.96, should I use CVS.
Anyway, I need ext2 to make it work...

>  I can provide this test floppy if you want to test it out?

Sure. But pleas add ext2 so it will be usable.

>  insmod pci
>  insmod lspci
>  lspci
>

I added this to the --modules at grub-install, I can see it is loaded
using lsmod, but no command.

Alon.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 18:10           ` Alon Bar-Lev
@ 2008-05-02 18:27             ` Vesa Jääskeläinen
  2008-05-02 19:03               ` Alon Bar-Lev
  0 siblings, 1 reply; 15+ messages in thread
From: Vesa Jääskeläinen @ 2008-05-02 18:27 UTC (permalink / raw)
  To: The development of GRUB 2

Alon Bar-Lev wrote:
> On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>>  I just built current CVS and tried it with my old scripts. Didn't install
>> it to /dev/hda as cannot test it without reinstall ;)... but made core.img
>> with modules: chain fat biosdisk. Installed it to floppy and then booted
>> that floppy in vmware desktop 5.5.4.
> 
> I use grub-1.96, should I use CVS.
> Anyway, I need ext2 to make it work...
> 
>>  I can provide this test floppy if you want to test it out?
> 
> Sure. But pleas add ext2 so it will be usable.
> 
>>  insmod pci
>>  insmod lspci
>>  lspci
>>
> 
> I added this to the --modules at grub-install, I can see it is loaded
> using lsmod, but no command.

Did you load lspci module :)

Anyway... new list of modules:
chain fat biosdisk ext2 pci lspci

And I formatted floppy as ext2...

http://nokkau.net/~chaac/files/grub2/grub2_ext2_floppy.zip



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 18:27             ` Vesa Jääskeläinen
@ 2008-05-02 19:03               ` Alon Bar-Lev
  2008-05-02 19:44                 ` Vesa Jääskeläinen
  0 siblings, 1 reply; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 19:03 UTC (permalink / raw)
  To: The development of GRUB 2

On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>  Did you load lspci module :)

Already told you it appear in lsmod.
But from what I see this command is not available in rescue mode.
I don't understand why if module is loaded it is not provided in rescue mode.
How do you switch from rescue to normal mode?

>
>  Anyway... new list of modules:
>  chain fat biosdisk ext2 pci lspci
>
>  And I formatted floppy as ext2...
>
> http://nokkau.net/~chaac/files/grub2/grub2_ext2_floppy.zip
>

OK... Now in rescue I can see hd0, hd1 I cannot do "ls (hd0, 1)" it
writes unknown device.

I also tried the following configuration:
menuentry "linux" {
        set root=(hd0,1)
        kernel /kernel-x86-2.6.23-gentoo-r3
        initrd /initramfs-x86-2.6.23-gentoo-r3
}

It compains that initrd is not available, so I guess I needed to add
insmod linux... But then I got "You need to load the kernel first".

????

Alon.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 19:03               ` Alon Bar-Lev
@ 2008-05-02 19:44                 ` Vesa Jääskeläinen
  2008-05-02 20:28                   ` Alon Bar-Lev
  0 siblings, 1 reply; 15+ messages in thread
From: Vesa Jääskeläinen @ 2008-05-02 19:44 UTC (permalink / raw)
  To: The development of GRUB 2

Alon Bar-Lev wrote:
> On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>>  Did you load lspci module :)
> 
> Already told you it appear in lsmod.
> But from what I see this command is not available in rescue mode.
> I don't understand why if module is loaded it is not provided in rescue mode.
> How do you switch from rescue to normal mode?

You can type: normal

>>  Anyway... new list of modules:
>>  chain fat biosdisk ext2 pci lspci
>>
>>  And I formatted floppy as ext2...
>>
>> http://nokkau.net/~chaac/files/grub2/grub2_ext2_floppy.zip
>>
> 
> OK... Now in rescue I can see hd0, hd1 I cannot do "ls (hd0, 1)" it
> writes unknown device.
> 
> I also tried the following configuration:
> menuentry "linux" {
>         set root=(hd0,1)
>         kernel /kernel-x86-2.6.23-gentoo-r3
>         initrd /initramfs-x86-2.6.23-gentoo-r3
> }
> 
> It compains that initrd is not available, so I guess I needed to add
> insmod linux... But then I got "You need to load the kernel first".

Did you use that floppy?... For me it displayed the menu. Then with 'C' 
you can go to normal mode shell.

You have to use linux command to load linux kernel:
http://grub.enbug.org/grub.cfg



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 19:44                 ` Vesa Jääskeläinen
@ 2008-05-02 20:28                   ` Alon Bar-Lev
  2008-05-02 20:48                     ` Vesa Jääskeläinen
  0 siblings, 1 reply; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 20:28 UTC (permalink / raw)
  To: The development of GRUB 2

On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
> > How do you switch from rescue to normal mode?
> >
>
>  You can type: normal

Oh... It is available at your rescue, but not mine.

>  Did you use that floppy?... For me it displayed the menu. Then with 'C' you
> can go to normal mode shell.

Sure!
This I know.

>  You have to use linux command to load linux kernel:
>  http://grub.enbug.org/grub.cfg

Tried that too...

menu->c->linux (hd0,1)/bla
error: unknown device
rescue->ls
(fd0) (hd0) (hd1)

I guess the partitions are missing?

Alon.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 20:28                   ` Alon Bar-Lev
@ 2008-05-02 20:48                     ` Vesa Jääskeläinen
  2008-05-02 21:04                       ` Alon Bar-Lev
  0 siblings, 1 reply; 15+ messages in thread
From: Vesa Jääskeläinen @ 2008-05-02 20:48 UTC (permalink / raw)
  To: The development of GRUB 2

Alon Bar-Lev wrote:
> On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>>> How do you switch from rescue to normal mode?
>>>
>>  You can type: normal
> 
> Oh... It is available at your rescue, but not mine.

you can try : insmod normal

>>  Did you use that floppy?... For me it displayed the menu. Then with 'C' you
>> can go to normal mode shell.
> 
> Sure!
> This I know.
> 
>>  You have to use linux command to load linux kernel:
>>  http://grub.enbug.org/grub.cfg
> 
> Tried that too...
> 
> menu->c->linux (hd0,1)/bla
> error: unknown device
> rescue->ls
> (fd0) (hd0) (hd1)
> 
> I guess the partitions are missing?

Now that you said it... there wasn't pc partition table module there ;)

added "pc" to module list and updated that image:

http://nokkau.net/~chaac/files/grub2/grub2_ext2_floppy.zip



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 20:48                     ` Vesa Jääskeläinen
@ 2008-05-02 21:04                       ` Alon Bar-Lev
  2008-05-02 21:17                         ` Alon Bar-Lev
  0 siblings, 1 reply; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 21:04 UTC (permalink / raw)
  To: The development of GRUB 2

On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>
>  Now that you said it... there wasn't pc partition table module there ;)
>
>  added "pc" to module list and updated that image:
>
> http://nokkau.net/~chaac/files/grub2/grub2_ext2_floppy.zip

Success!!!
I had to insmod linux, boot

So I will try CVS now and see if I can build it my self, as pc module
was loaded at my side.

Alon.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 21:04                       ` Alon Bar-Lev
@ 2008-05-02 21:17                         ` Alon Bar-Lev
  2008-05-02 21:39                           ` [PATCH] " Alon Bar-Lev
  0 siblings, 1 reply; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 21:17 UTC (permalink / raw)
  To: The development of GRUB 2

On 5/3/08, Alon Bar-Lev <alon.barlev@gmail.com> wrote:
> On 5/2/08, Vesa Jääskeläinen <chaac@nic.fi> wrote:
>  >
>
> >  Now that you said it... there wasn't pc partition table module there ;)
>  >
>  >  added "pc" to module list and updated that image:
>  >
>  > http://nokkau.net/~chaac/files/grub2/grub2_ext2_floppy.zip
>
>
> Success!!!
>  I had to insmod linux, boot
>
>  So I will try CVS now and see if I can build it my self, as pc module
>  was loaded at my side.

OK. CVS works.

Alon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] Support linux boot protocol >= 2.02 long command-lines
  2008-05-02 21:17                         ` Alon Bar-Lev
@ 2008-05-02 21:39                           ` Alon Bar-Lev
  0 siblings, 0 replies; 15+ messages in thread
From: Alon Bar-Lev @ 2008-05-02 21:39 UTC (permalink / raw)
  To: The development of GRUB 2


Continue from bug#13606 [1]

cmd_line_ptr should not be truncated to 256.

Please review this patch or apply something better.
Tested for pc/linux, guess for efi/linux.
For EFI I did not understand what the lh.cl_offset = 0 is for, but as only recent boot protocols are
supported I am not sure it is required.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

---

Index: include/grub/i386/linux.h
===================================================================
RCS file: /sources/grub/grub2/include/grub/i386/linux.h,v
retrieving revision 1.4
diff -u -B -r1.4 linux.h
--- include/grub/i386/linux.h	25 Apr 2008 19:41:49 -0000	1.4
+++ include/grub/i386/linux.h	2 May 2008 21:35:56 -0000
@@ -41,7 +41,9 @@
 
 #define GRUB_LINUX_CL_OFFSET		0x9000
 #define GRUB_LINUX_CL_END_OFFSET	0x90FF
-#define GRUB_LINUX_SETUP_MOVE_SIZE	0x9100
+#define GRUB_LINUX_CL_0202_OFFSET	0x9100
+#define GRUB_LINUX_CL_0202_END_OFFSET	0x9FFF
+#define GRUB_LINUX_SETUP_MOVE_SIZE	0xA000
 #define GRUB_LINUX_CL_MAGIC		0xA33F
 
 #define GRUB_LINUX_EFI_SIGNATURE	\
Index: loader/i386/efi/linux.c
===================================================================
RCS file: /sources/grub/grub2/loader/i386/efi/linux.c,v
retrieving revision 1.2
diff -u -B -r1.2 linux.c
--- loader/i386/efi/linux.c	21 Jul 2007 23:32:28 -0000	1.2
+++ loader/i386/efi/linux.c	2 May 2008 21:35:58 -0000
@@ -391,8 +391,8 @@
   lh.type_of_loader = 0x50;
 
   lh.cl_magic = GRUB_LINUX_CL_MAGIC;
-  lh.cl_offset = GRUB_LINUX_CL_END_OFFSET;
-  lh.cmd_line_ptr = (char *) real_mode_mem + GRUB_LINUX_CL_OFFSET;
+  lh.cl_offset = 0;
+  lh.cmd_line_ptr = (char *) real_mode_mem + GRUB_LINUX_CL_0202_OFFSET;
   lh.ramdisk_image = 0;
   lh.ramdisk_size = 0;
 
@@ -531,7 +531,7 @@
       }
 
   /* Specify the boot file.  */
-  dest = grub_stpcpy ((char *) real_mode_mem + GRUB_LINUX_CL_OFFSET,
+  dest = grub_stpcpy ((char *) real_mode_mem + GRUB_LINUX_CL_0202_OFFSET,
 		      "BOOT_IMAGE=");
   dest = grub_stpcpy (dest, argv[0]);
   
@@ -539,7 +539,7 @@
   for (i = 1;
        i < argc
 	 && dest + grub_strlen (argv[i]) + 1 < ((char *) real_mode_mem
-						+ GRUB_LINUX_CL_END_OFFSET);
+						+ GRUB_LINUX_CL_0202_END_OFFSET);
        i++)
     {
       *dest++ = ' ';
Index: loader/i386/pc/linux.c
===================================================================
RCS file: /sources/grub/grub2/loader/i386/pc/linux.c,v
retrieving revision 1.18
diff -u -B -r1.18 linux.c
--- loader/i386/pc/linux.c	8 Jan 2008 11:38:18 -0000	1.18
+++ loader/i386/pc/linux.c	2 May 2008 21:35:58 -0000
@@ -117,7 +117,7 @@
 	}
       
       if (grub_le_to_cpu16 (lh.version) >= 0x0202)
-	lh.cmd_line_ptr = grub_linux_real_addr + GRUB_LINUX_CL_OFFSET;
+	lh.cmd_line_ptr = grub_linux_real_addr + GRUB_LINUX_CL_0202_OFFSET;
       else
 	{
 	  lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC);
@@ -244,7 +244,7 @@
 		  << GRUB_DISK_SECTOR_BITS));
 
   /* Specify the boot file.  */
-  dest = grub_stpcpy (grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET,
+  dest = grub_stpcpy (grub_linux_tmp_addr + GRUB_LINUX_CL_0202_OFFSET,
 		      "BOOT_IMAGE=");
   dest = grub_stpcpy (dest, argv[0]);
   
@@ -252,13 +252,18 @@
   for (i = 1;
        i < argc
 	 && dest + grub_strlen (argv[i]) + 1 < (grub_linux_tmp_addr
-						+ GRUB_LINUX_CL_END_OFFSET);
+						+ GRUB_LINUX_CL_0202_END_OFFSET);
        i++)
     {
       *dest++ = ' ';
       dest = grub_stpcpy (dest, argv[i]);
     }
 
+  grub_strncpy (grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET,
+                grub_linux_tmp_addr + GRUB_LINUX_CL_0202_OFFSET,
+		GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET - 1);
+  *(grub_linux_tmp_addr + GRUB_LINUX_CL_END_OFFSET) = '\0';
+
   len = prot_size;
   if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
     grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-05-02 21:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 16:36 [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines Alon Bar-Lev
2008-05-02 16:50 ` Vesa Jääskeläinen
2008-05-02 16:59   ` Alon Bar-Lev
2008-05-02 17:07     ` Vesa Jääskeläinen
2008-05-02 17:17       ` Alon Bar-Lev
2008-05-02 18:04         ` Vesa Jääskeläinen
2008-05-02 18:10           ` Alon Bar-Lev
2008-05-02 18:27             ` Vesa Jääskeläinen
2008-05-02 19:03               ` Alon Bar-Lev
2008-05-02 19:44                 ` Vesa Jääskeläinen
2008-05-02 20:28                   ` Alon Bar-Lev
2008-05-02 20:48                     ` Vesa Jääskeläinen
2008-05-02 21:04                       ` Alon Bar-Lev
2008-05-02 21:17                         ` Alon Bar-Lev
2008-05-02 21:39                           ` [PATCH] " Alon Bar-Lev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.