[PATCH] i386:kexec-bzImage: Use "\0" as command line instead of empty command line

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

 



? 2013?04?08? 09:08, Wang YanQing ??:
> On Sun, Apr 07, 2013 at 05:35:40PM +0800, Wang YanQing wrote:
>> On Sun, Apr 07, 2013 at 01:54:58PM +0800, Zhang Yanfei wrote:
>>> With no commandline, can the new kernel boot?
>>> I tried in my box and the new kernel just panicked for it cannot
>>> find a root= argument in its commandline.
>> I am sure the kernel boot, 
>> rootfs_initcall(populate_rootfs) in initramfs.c
>> well populate the root fs, and there is a /init
>> in initramfs, this /init will mount the really 
>> root device, and the system is running.
> 
> Your kernel panic, because the below line in init/main.c failed:
> 
> if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0)
> 
> kernel then run into prepare_namespace, but prepare_namespace failed too,
> then the kernel panic.
> 
> I don't know why, but if rootfs_initcall(populate_rootfs) works ok,
> kernel don't need to call prepare_namespace, because the decompressed 
> initramfs will become the root fs and sys_access will success.
> 
> Sorry for I forget to mention my test kernel is v3.8.6, 

I tried 3.8.0 kernel. Unfortunately, panicked again. For some reason, I didn't
see the panic message.

but if my memory don't lie me,
> I can boot v2.6.32 without a root= parameter, we had use v2.6.32 as product kernel
> still more than one year two years ago.

Sigh, I tried in a real box and a kvm machine. Both panicked with no root= argument
message. I don't know why.

Anyway, Just from the code, your patch didn't fix all the possible place.
do_bzImage64_load may also call setup_linux_bootloader_parameters_high with
a null commandline. So why not change the check in
setup_linux_bootloader_parameters_high.

--------------------------
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 454fad6..6eb2e6e 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -116,7 +116,8 @@ void setup_linux_bootloader_parameters_high(
        /* Fill in the command line */
        if (cmdline_len > COMMAND_LINE_SIZE) {
                cmdline_len = COMMAND_LINE_SIZE;
-       }
+       } else if (cmdline_len == 0)
+               return;
        cmdline_ptr = ((char *)real_mode) + cmdline_offset;
        memcpy(cmdline_ptr, cmdline, cmdline_len);
        cmdline_ptr[cmdline_len - 1] = '\0';

Thanks
Zhang

> 
> Thanks
> 
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> 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