From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JryF4-0004tE-40 for mharc-grub-devel@gnu.org; Fri, 02 May 2008 12:36:14 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JryF1-0004qP-8m for grub-devel@gnu.org; Fri, 02 May 2008 12:36:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JryEz-0004oZ-M6 for grub-devel@gnu.org; Fri, 02 May 2008 12:36:10 -0400 Received: from [199.232.76.173] (port=35782 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JryEz-0004oO-8s for grub-devel@gnu.org; Fri, 02 May 2008 12:36:09 -0400 Received: from ug-out-1314.google.com ([66.249.92.171]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JryEy-0000hU-OZ for grub-devel@gnu.org; Fri, 02 May 2008 12:36:09 -0400 Received: by ug-out-1314.google.com with SMTP id a2so79615ugf.48 for ; Fri, 02 May 2008 09:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:to:subject:content-disposition:from:date:mime-version:content-type:content-transfer-encoding:message-id; bh=9AiPfc5puFBYx2FA71YqCVlQpPNFm6cw0vwNim9aFJ4=; b=QnyPE+e8fvCt8y7UTw5xj6PQgTGoujmJXOTlTy+RpAUaiKcPH8hc8EqZf2Gmya5uYGrUa9g4+g1Lrhq4e9C6XAennEM86HlcTifllxHyvdDmF7Sb/qtFyrtuLPlnBiPUGbdlAPPS45NseR0k5sFCbOfzi920kz+7Zcd1YSh2bnc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:subject:content-disposition:from:date:mime-version:content-type:content-transfer-encoding:message-id; b=o8nlNjbQeFlUhqfpYO6a26Gu5HNwrLHaJVfqBlgRZn0elM4JdGAXrC9C0seryBlSNHOpIFN/z+TekaA9H9MY5Zd4kXJnTiefKMAAx2pnD49DW6EbbcQwt9QWKKZogmjLwNvMmZBfhmablulQ43c/pJzZHtlZbzIdfRT2tRsR8xs= Received: by 10.66.245.2 with SMTP id s2mr188138ugh.16.1209746166897; Fri, 02 May 2008 09:36:06 -0700 (PDT) Received: from ?192.168.0.103? ( [89.1.12.208]) by mx.google.com with ESMTPS id g11sm694446gve.8.2008.05.02.09.36.04 (version=SSLv3 cipher=OTHER); Fri, 02 May 2008 09:36:05 -0700 (PDT) To: grub-devel@gnu.org Content-Disposition: inline From: Alon Bar-Lev Date: Fri, 2 May 2008 19:36:01 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200805021936.02614.alon.barlev@gmail.com> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: [PATCH/DRAFT] Support linux boot protocol >= 2.02 long command-lines X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2008 16:36:11 -0000 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 [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");