From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Js2yt-00024U-J0 for mharc-grub-devel@gnu.org; Fri, 02 May 2008 17:39:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Js2yq-00020i-If for grub-devel@gnu.org; Fri, 02 May 2008 17:39:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Js2yo-0001y5-R1 for grub-devel@gnu.org; Fri, 02 May 2008 17:39:48 -0400 Received: from [199.232.76.173] (port=43855 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Js2yo-0001xj-JE for grub-devel@gnu.org; Fri, 02 May 2008 17:39:46 -0400 Received: from ug-out-1314.google.com ([66.249.92.168]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Js2yo-0005yq-2n for grub-devel@gnu.org; Fri, 02 May 2008 17:39:46 -0400 Received: by ug-out-1314.google.com with SMTP id a2so145492ugf.48 for ; Fri, 02 May 2008 14:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; bh=kGveyz6QsWypmnywELySoVgHgNQlPWghvrEgD+smanA=; b=ZJ57YnXHdIWiavvwadN5SNtSt1jka3ykP+IzweTqVQgAHUSn7Qu2OZI/jp1/BIe6e0OwVHfmsz4CTzNJbMRDT9UbFDVbtMHjwMuQx0jW62e3bCZTkUiGFsiAVD05DXwpX9dxG1FTjC9sJ80DNTLIQ3UOXjiSZq2AHIcHrDoOnzI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=QTbC34lBDqNjkiELcHd9PaPRdH3XrN29Y5AsqaRTlgzbJWxkuGLoWUd6gsNNpwsUbKiZXbdTvQo6J0aET/Y2Sa5mrX/Wv+tOC2Jp8Evf+O4/8t+nL1P3bfXaXY2T3jUaysVX0Q9D3cRLyyGOQ+oJaR7cUxeiOq33X5kifoYF4sU= Received: by 10.67.89.17 with SMTP id r17mr521159ugl.4.1209764382649; Fri, 02 May 2008 14:39:42 -0700 (PDT) Received: from ?192.168.0.103? ( [89.1.12.208]) by mx.google.com with ESMTPS id q9sm4170447gve.5.2008.05.02.14.39.35 (version=SSLv3 cipher=OTHER); Fri, 02 May 2008 14:39:41 -0700 (PDT) From: Alon Bar-Lev To: "The development of GRUB 2" Date: Sat, 3 May 2008 00:39:31 +0300 User-Agent: KMail/1.9.9 References: <200805021936.02614.alon.barlev@gmail.com> <9e0cf0bf0805021404k552e6825o738137e7684266f6@mail.gmail.com> <9e0cf0bf0805021417r3fe53095n7090c07926ea704d@mail.gmail.com> In-Reply-To: <9e0cf0bf0805021417r3fe53095n7090c07926ea704d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200805030039.32967.alon.barlev@gmail.com> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: [PATCH] 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 21:39:48 -0000 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 --- 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");