From patchwork Fri Oct 14 04:01:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Mackerras X-Patchwork-Id: 119689 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id A7F83B70C2 for ; Fri, 14 Oct 2011 15:01:39 +1100 (EST) Received: by ozlabs.org (Postfix, from userid 1003) id 15DC3B6FA5; Fri, 14 Oct 2011 15:01:39 +1100 (EST) Date: Fri, 14 Oct 2011 15:01:12 +1100 From: Paul Mackerras To: yaboot-devel@lists.ozlabs.org Subject: [PATCH] Save arguments as well as image name for CAS reboot Message-ID: <20111014040112.GA11118@bloggs.ozlabs.ibm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: baude@us.ibm.com X-BeenThere: yaboot-devel@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org We were saving the image name that the user had typed (or had been selected by default) in the "boot-last-label" property, but we were losing any extra arguments that the user had typed after the image name. On a pSeries machine, if the firmware decides to do a reboot at the client-architecture-support call, we were then rebooting to the right image but without any extra arguments that the user typed. This fixes the problem by saving the arguments in boot-last-label, separated from the image name by a space. When we use the value of boot-last-label, we now call word_split to separate it into the image name and arguments again. Signed-off-by: Paul Mackerras --- second/yaboot.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/second/yaboot.c b/second/yaboot.c index b7b9280..1f3f151 100644 --- a/second/yaboot.c +++ b/second/yaboot.c @@ -709,9 +709,10 @@ int get_params(struct boot_param_t* params) if (!imagename) { if (bootoncelabel[0] != 0) imagename = bootoncelabel; - else if (bootlastlabel[0] != 0) - imagename = bootlastlabel; - else + else if (bootlastlabel[0] != 0) { + imagename = bootlastlabel; + word_split(&imagename, ¶ms->args); + } else imagename = cfg_get_default(); } if (imagename) @@ -773,7 +774,13 @@ int get_params(struct boot_param_t* params) imagename = cfg_get_default(); /* write the imagename out so it can be reused on reboot if necessary */ - prom_set_options("boot-last-label", imagename, strlen(imagename)); + strcpy(bootlastlabel, imagename); + if (params->args && params->args[0]) { + strcat(bootlastlabel, " "); + strcat(bootlastlabel, params->args); + } + prom_set_options("boot-last-label", bootlastlabel, + strlen(bootlastlabel) + 1); label = 0; defdevice = boot.dev;