Re: [RFC] printing the final constructed kernel command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Dec 16, 2019, at 2:32 PM, Eric DeVolder <eric.devolder@xxxxxxxxxx> wrote:
> 
> The --command-line, --append, and --reuse-cmdline options to kexec can
> be used in combination to craft a kernel command line for a kernel
> loaded via kexec. In addition, the kexec tool may also manipulate
> further the command line, eg.  elfcorehdr addition.
> 
> To aid in debugging kdump/kexec related issues, it would be helpful
> for kexec to print the final constructed kernel command line argument.
> 
> For example, the following simple change (for i386/x86_64):
> 
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index 057ee14..6dc4adc 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
> 	char *cmdline_ptr;
> 	unsigned long initrd_base, initrd_addr_max;
> 
> +    printf("Final kernel cmdline: '%s'\n", cmdline);
> +
> 	/* Say I'm a boot loader */
> 	real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
> 
> results in the following on a systemd-based system (formatted to fit
> in 70 char lines):
> 
> % systemctl status -l kdump.service
> ● kdump.service - Crash recovery kernel arming
>   Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
>    vendor preset: enabled)
>   Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
>    2min 53s ago
>  Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
>   status=0/SUCCESS)
>  Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
>   status=0/SUCCESS)
> Main PID: 14073 (code=exited, status=0/SUCCESS)
> 
> Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
> Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
> Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
> Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=
> /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8
> irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off
> udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug
> transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0
> elfcorehdr=901492K'
> Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
> Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
> Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]
> 
> and the output is also available in /var/log/messages.
> 
> There might also be an opportunity to consolidate handling of the
> kernel command line, as most arch targets have the --command-line,
> --append, and --reuse-cmdline options, though each arch independently
> codes the support for these options.
> 
> Note: Simply printing the cmdline in scripts such as kdumpctl may not
> result in the same ordering, and will omit any addition made internally
> by kexec, such as the elfcorehdr.
> 
> I propose the addition of an option to kexec, --print-kcl (to mirror
> --print-ckr), that would control such printing, as well as the needed
> per arch conditional print statements similar to the above to print the
> final constructed kernel command line.

Is this common code available in the Arm environment  too ?

If not, could you make it so ?




> 
> _______________________________________________
> kexec mailing list
> kexec@xxxxxxxxxxxxxxxxxxx
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_kexec&d=DwIGaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=t2fPg9D87F7D8jm0_3CG9yoiIKdRg4qc_thBw4bzMhc&m=ZhhaZ27OjZpnpmVNP_2CgDhpnINXnkvt9PET0xntIN8&s=P1BRdVtUzkC5WtAGPyTBQreSI-4nsTEuMJ7-D-5WzvU&e= 


_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux