Author: juhliarik Date: Mon Apr 7 11:26:42 2008 New Revision: 46172 URL: http://svn.opensuse.org/viewcvs/yast?rev=46172&view=rev Log: added calling kexec on the end of instllation (the 1st stage) fate #303395 Use kexec to avoid booting between first and second stage Modified: trunk/installation/src/clients/inst_finish.ycp Modified: trunk/installation/src/clients/inst_finish.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_finish.ycp?rev=46172&r1=46171&r2=46172&view=diff ============================================================================== --- trunk/installation/src/clients/inst_finish.ycp (original) +++ trunk/installation/src/clients/inst_finish.ycp Mon Apr 7 11:26:42 2008 @@ -29,6 +29,9 @@ import "Report"; import "Wizard"; + // added for fate# 303395 + import "Directory"; + // Help text for last dialog of base installation @@ -279,6 +282,116 @@ Misc::boot_msg = ""; } + +// fate #303395: Use kexec to avoid booting between first and second stage +// run new kernel via kexec instead of reboot + +// command for reading kernel_params +string cmd = sformat("ls %1 | grep kernel_params |tr -d '\n'", Directory::vardir); +y2milestone("Checking existing file kernel_params via command %1", cmd); + +map out = (map)WFM::Execute(.local.bash_output, cmd); +// check output +if (out["stdout"]:"" != "kernel_params") +{ + y2milestone ("File kernel_params was not found, output: %1", out); + return `next; +} + +// command for reading kernel_params +cmd = sformat("cat %1/kernel_params |tr -d '\n'", Directory::vardir); +y2milestone("Reading kernel arguments via command %1", cmd); +// read data from /var/lib/YaST2/kernel_params +out = (map)WFM::Execute(.local.bash_output, cmd); +// check output +if (out["exit"]:nil != 0) +{ + y2error ("Reading kernel arguments failed, output: %1", out); + return `next; +} + +string kernel_args = out["stdout"]:""; +// check if kernel_params contains any data +if (size(kernel_args) <2) +{ + y2error ("%1/kernel_params is empty, kernel_params=%2 ", Directory::vardir, kernel_args); + return `next; +} + +// command for finding initrd file +cmd = sformat ("ls %1 |grep initrd- |tr -d '\n'", Directory::vardir); +y2milestone("Finding initrd file via command: %1", cmd); +// find inird file +out = (map)WFM::Execute(.local.bash_output, cmd); +// check output +if (out["exit"]:nil != 0) +{ + y2error ("Finding initrd file failed, output: %1", out); + return `next; +} + +string initrd = out["stdout"]:""; +// check if initrd (string) contains any data +if (size(initrd) <2) +{ + y2error ("initrd was not found: %1", initrd); + return `next; +} + +// command for finding vmlinuz file +cmd = sformat ("ls %1 |grep vmlinuz- |tr -d '\n'", Directory::vardir); +y2milestone("Finding vmlinuz file via command: %1", cmd); +// find inird file +out = (map)WFM::Execute(.local.bash_output, cmd); +// check output +if (out["exit"]:nil != 0) +{ + y2error ("Finding vmlinuz file failed, output: %1", out); + return `next; +} + +string vmlinuz = out["stdout"]:""; +// check if initrd (string) contains any data +if (size(vmlinuz) <2) +{ + y2error ("vmlinuz was not found: %1", vmlinuz); + return `next; +} + +// hack for using kexec switch to console 2 +cmd = sformat ("chvt 2"); +y2milestone("Switch to console 2 via command: %1", cmd); +// switch to console 2 +out = (map)WFM::Execute(.local.bash_output, cmd); +// check output +if (out["exit"]:nil != 0) +{ + y2error ("Switching failed, output: %1", out); + return `next; +} + +// waiting 2s for switching... +sleep(2000); + +// command for calling kexec +cmd = sformat("kexec -l --command-line=\"%1\" --initrd=%2/%3 %2/%4", + kernel_args, Directory::vardir, initrd, vmlinuz); +y2milestone("Calling kexec via command: %1", cmd); + +// call kexec +out = (map)WFM::Execute(.local.bash_output, cmd); +// check output +if (out["exit"]:nil != 0) +{ + y2error ("Calling kexec failed, output: %1", out); + return `next; +} +// command for loading kernel +cmd = sformat("kexec -e"); +y2milestone("Loading new kernel via command: %1", cmd); +// call loading kernel via kexec +out = (map) WFM::Execute(.local.bash_output, cmd); + return `next; } // EOF -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org