From: Jan Alsenz <janalsenz@student.ethz.ch>
To: Grub-devel@gnu.org
Subject: [PATCH] Long linux kernel command lines
Date: Tue, 10 Feb 2009 19:02:56 +0100 [thread overview]
Message-ID: <4991C150.3090504@student.ethz.ch> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 696 bytes --]
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 kernels.
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
[-- Attachment #1.2: pc_linux_loader.patch --]
[-- Type: text/plain, Size: 2135 bytes --]
--- 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 <grub/rescue.h>
#include <grub/dl.h>
#include <grub/cpu/linux.h>
+#include <grub/mm.h>
#define GRUB_LINUX_CL_OFFSET 0x9000
#define GRUB_LINUX_CL_END_OFFSET 0x90FF
@@ -38,11 +39,15 @@
static grub_size_t linux_mem_size;
static int loaded;
+static char* kernel_cl_space = NULL;
+#define GRUB_LINUX_CL_MAX_SIZE 0x1000 /* maximum defined for linux kernels */
static grub_err_t
grub_linux_unload (void)
{
grub_dl_unref (my_mod);
+ grub_free(kernel_cl_space);
+ kernel_cl_space = NULL;
loaded = 0;
return GRUB_ERR_NONE;
}
@@ -119,9 +124,10 @@
lh.loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP;
}
- if (grub_le_to_cpu16 (lh.version) >= 0x0202)
- lh.cmd_line_ptr = grub_linux_real_addr + GRUB_LINUX_CL_OFFSET;
- else
+ if (grub_le_to_cpu16 (lh.version) >= 0x0202) {
+ kernel_cl_space = grub_malloc(GRUB_LINUX_CL_MAX_SIZE);
+ lh.cmd_line_ptr = kernel_cl_space;
+ } else
{
lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC);
lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET);
@@ -245,16 +251,25 @@
((GRUB_LINUX_MAX_SETUP_SECTS - setup_sects - 1)
<< GRUB_DISK_SECTOR_BITS));
+ /* Choose the command line area */
+ char* cl_end;
+ if (kernel_cl_space) {
+ dest = kernel_cl_space;
+ cl_end = dest + GRUB_LINUX_CL_MAX_SIZE - 1;
+ } else {
+ dest = grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET;
+ cl_end = grub_linux_tmp_addr + GRUB_LINUX_CL_END_OFFSET;
+ }
+
/* Specify the boot file. */
- dest = grub_stpcpy (grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET,
+ dest = grub_stpcpy (dest,
"BOOT_IMAGE=");
dest = grub_stpcpy (dest, argv[0]);
/* Copy kernel parameters. */
for (i = 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++ = ' ';
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next reply other threads:[~2009-02-10 18:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-10 18:02 Jan Alsenz [this message]
2009-02-10 19:58 ` [PATCH] Long linux kernel command lines phcoder
2009-02-10 20:09 ` Jan Alsenz
2009-02-11 12:48 ` Jan Alsenz
2009-02-21 14:57 ` Robert Millan
2009-02-21 15:34 ` Jan Alsenz
2009-04-10 23:37 ` phcoder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4991C150.3090504@student.ethz.ch \
--to=janalsenz@student.ethz.ch \
--cc=Grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.