Re: [patch 1/5] Extended crashkernel command line

From: Olaf Dabrunz
Date: Tue Sep 11 2007 - 09:14:56 EST


On 09-Sep-07, Bernhard Walle wrote:
> If there are multiple occurrences, then the last one is taken. The advantage
> is that if you have a bootloader like lilo or elilo which allows you to append
> a command line parameter but not to remove one (like in GRUB), then you can add
> another crashkernel value for testing at the boot command line and this one
> overwrites the command line in the configuration then.

AFAIK it is the other way round: the lilo configuration-parameter
"append" appends the kernel parameters in the configuration to the
parameters given by the user on the kernel command line.

So the parameters set by the user during boot appear first on the
command line.

> Signed-off-by: Bernhard Walle <bwalle@xxxxxxx>
>
> ---
> include/linux/kexec.h | 2
> kernel/kexec.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 141 insertions(+)
>
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -179,6 +179,8 @@ extern note_buf_t *crash_notes;
> extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
> extern unsigned int vmcoreinfo_size;
> extern unsigned int vmcoreinfo_max_size;
> +int parse_crashkernel(char *cmdline, unsigned long long system_ram,
> + unsigned long long *crash_size, unsigned long long *crash_base);
>
> [...]
>
> +int parse_crashkernel(char *cmdline,
> + unsigned long long system_ram,
> + unsigned long long *crash_size,
> + unsigned long long *crash_base)
> +{
> + char *p = cmdline, *ck_cmdline = NULL;
> + char *first_colon, *first_space;
> +
> + /* find crashkernel and use the last one if there are more */
> + p = strstr(p, "crashkernel=");
> + while (p) {
> + ck_cmdline = p;
> + p = strstr(p+1, "crashkernel=");
> + }
> +

So perhaps something like this instead:

+ /* find crashkernel and use the first one if there are more */
+ p = strstr(p, "crashkernel=");
+ ck_cmdline = p;

> + if (!ck_cmdline)
> + return -EINVAL;
> +
> + ck_cmdline += 12; /* strlen("crashkernel=") */
> +
> + /*
> + * if the commandline contains a ':', then that's the extended
> + * syntax -- if not, it must be the classic syntax
> + */
> + first_colon = strchr(ck_cmdline, ':');
> + first_space = strchr(ck_cmdline, ' ');
> + if (first_colon && (!first_space || first_colon < first_space))
>
> [...]

--
Olaf Dabrunz (od/odabrunz), SUSE Linux Products GmbH, NÃrnberg

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/