From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LWxIg-00071X-8C for mharc-grub-devel@gnu.org; Tue, 10 Feb 2009 13:25:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LWxId-00070F-3y for grub-devel@gnu.org; Tue, 10 Feb 2009 13:25:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LWxIb-0006zE-7F for Grub-devel@gnu.org; Tue, 10 Feb 2009 13:25:34 -0500 Received: from [199.232.76.173] (port=41331 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LWxIb-0006z6-29 for Grub-devel@gnu.org; Tue, 10 Feb 2009 13:25:33 -0500 Received: from xsmtp0.ethz.ch ([82.130.70.14]:56783) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LWxIZ-00051Y-KK for Grub-devel@gnu.org; Tue, 10 Feb 2009 13:25:31 -0500 Received: from xfe2.d.ethz.ch ([82.130.124.42]) by XSMTP0.ethz.ch with Microsoft SMTPSVC(6.0.3790.3959); Tue, 10 Feb 2009 19:03:18 +0100 Received: from [82.130.79.187] ([82.130.79.187]) by xfe2.d.ethz.ch over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 10 Feb 2009 19:03:18 +0100 Message-ID: <4991C150.3090504@student.ethz.ch> Date: Tue, 10 Feb 2009 19:02:56 +0100 From: Jan Alsenz User-Agent: Thunderbird 2.0.0.19 (X11/20090201) MIME-Version: 1.0 To: Grub-devel@gnu.org X-Enigmail-Version: 0.95.7 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig151DA434F2D0081FDE141B06" X-OriginalArrivalTime: 10 Feb 2009 18:03:18.0837 (UTC) FILETIME=[DA80AE50:01C98BA9] X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-Greylist: delayed 1326 seconds by postgrey-1.27 at monty-python; Tue, 10 Feb 2009 13:25:25 EST Cc: Subject: [PATCH] Long linux kernel 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: Tue, 10 Feb 2009 18:25:36 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig151DA434F2D0081FDE141B06 Content-Type: multipart/mixed; boundary="------------010704080508090400070609" This is a multi-part message in MIME format. --------------010704080508090400070609 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Hello! I just noticed, that the pc linux loader (loader/i386/pc/linux.c) always truncates the kernel command line to less than 256 characters. Well since I needed a longer command line, I fixed this problem. I found a patch on this list from last year ( http://lists.gnu.org/archive/html/grub-devel/2008-05/msg00005.html ), which apparently was lost in some other discussion. I didn't use it, because I think my version works better with older kerne= ls. I tested this on my machine and it worked without a problem with a 2.6.27 kernel. It would be great if you could add this (or something like it), so I can switch to the official version again. Thanks and Regards, Jan --------------010704080508090400070609 Content-Type: text/plain; name="pc_linux_loader.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="pc_linux_loader.patch" --- loader/i386/pc/linux.c.orig 2009-02-10 17:45:05.000000000 +0100 +++ loader/i386/pc/linux.c 2009-02-10 17:25:22.000000000 +0100 @@ -30,6 +30,7 @@ #include #include #include +#include =20 #define GRUB_LINUX_CL_OFFSET 0x9000 #define GRUB_LINUX_CL_END_OFFSET 0x90FF @@ -38,11 +39,15 @@ =20 static grub_size_t linux_mem_size; static int loaded; +static char* kernel_cl_space =3D NULL; +#define GRUB_LINUX_CL_MAX_SIZE 0x1000 /* maximum defined for linux kern= els */ =20 static grub_err_t grub_linux_unload (void) { grub_dl_unref (my_mod); + grub_free(kernel_cl_space); + kernel_cl_space =3D NULL; loaded =3D 0; return GRUB_ERR_NONE; } @@ -119,9 +124,10 @@ lh.loadflags |=3D GRUB_LINUX_FLAG_CAN_USE_HEAP; } =20 - if (grub_le_to_cpu16 (lh.version) >=3D 0x0202) - lh.cmd_line_ptr =3D grub_linux_real_addr + GRUB_LINUX_CL_OFFSET; - else + if (grub_le_to_cpu16 (lh.version) >=3D 0x0202) { + kernel_cl_space =3D grub_malloc(GRUB_LINUX_CL_MAX_SIZE); + lh.cmd_line_ptr =3D kernel_cl_space; + } else { lh.cl_magic =3D grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC); lh.cl_offset =3D grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET); @@ -245,16 +251,25 @@ ((GRUB_LINUX_MAX_SETUP_SECTS - setup_sects - 1) << GRUB_DISK_SECTOR_BITS)); =20 + /* Choose the command line area */ + char* cl_end; + if (kernel_cl_space) { + dest =3D kernel_cl_space; + cl_end =3D dest + GRUB_LINUX_CL_MAX_SIZE - 1; + } else { + dest =3D grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET; + cl_end =3D grub_linux_tmp_addr + GRUB_LINUX_CL_END_OFFSET; + } + =20 /* Specify the boot file. */ - dest =3D grub_stpcpy (grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET, + dest =3D grub_stpcpy (dest, "BOOT_IMAGE=3D"); dest =3D grub_stpcpy (dest, argv[0]); =20 /* Copy kernel parameters. */ for (i =3D 1; i < argc - && dest + grub_strlen (argv[i]) + 1 < (grub_linux_tmp_addr - + GRUB_LINUX_CL_END_OFFSET); + && dest + grub_strlen (argv[i]) + 1 < cl_end; i++) { *dest++ =3D ' '; --------------010704080508090400070609-- --------------enig151DA434F2D0081FDE141B06 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmRwV0ACgkQfZylhtn4XvegOQCfUrA/FJtlslLfHzk6qJHVJsac N8oAnRDYQoinUijtGJt0jGc65qXSGtRm =Jqk6 -----END PGP SIGNATURE----- --------------enig151DA434F2D0081FDE141B06--