From patchwork Wed Jul 8 00:11:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 29549 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id B0FB5B709A for ; Wed, 8 Jul 2009 10:19:26 +1000 (EST) Received: by ozlabs.org (Postfix) id B137DDE278; Wed, 8 Jul 2009 10:19:03 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id AE82EDE077 for ; Wed, 8 Jul 2009 10:19:03 +1000 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from hera.kernel.org (hera.kernel.org [140.211.167.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 89B8BDDE09; Wed, 8 Jul 2009 10:18:10 +1000 (EST) Received: from hera.kernel.org (IDENT:U2FsdGVkX19qME7CjD0RBSIChWjzvT6h8ws4VM49eF0@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n680I4mp026386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Jul 2009 00:18:04 GMT Received: (from geoff@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n680I3fY026384; Wed, 8 Jul 2009 00:18:03 GMT Message-Id: <20090708001135.423474087@am.sony.com> User-Agent: quilt/0.47-1 Date: Tue, 07 Jul 2009 17:11:41 -0700 From: Geoff Levand To: Jeremy Kerr In-Reply-To: <20090708001134.934244536@am.sony.com> References: <20090708001134.934244536@am.sony.com> Content-Disposition: inline; filename=system-fix-kexec.diff X-Virus-Scanned: ClamAV 0.93.3/9541/Tue Jul 7 17:31:53 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Wed, 08 Jul 2009 00:18:04 +0000 (UTC) Cc: cbe-oss-dev@ozlabs.org Subject: [Cbe-oss-dev] [patch 07/31] petitboot: Fix kexec call X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Fix the preparation of kexec call args. kexec wants the param and value in the same arg. Signed-off-by: Geoff Levand --- ui/common/ui-system.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) --- a/ui/common/ui-system.c +++ b/ui/common/ui-system.c @@ -43,20 +43,24 @@ static int run_kexec_local(const char *l const char *args) { int result; - const char *argv[8]; + const char *argv[6]; const char **p; + char *s_initrd = NULL; + char *s_args = NULL; p = argv; *p++ = pb_system_apps.kexec; /* 1 */ if (l_initrd) { - *p++ = "--initrd"; /* 2 */ - *p++ = l_initrd; /* 3 */ + s_initrd = talloc_asprintf(NULL, "--initrd=%s", l_initrd); + assert(s_initrd); + *p++ = s_initrd; /* 2 */ } if (args) { - *p++ = "--append"; /* 4 */ - *p++ = args; /* 5 */ + s_args = talloc_asprintf(NULL, "--append=%s", args); + assert(s_args); + *p++ = s_args; /* 3 */ } /* First try by telling kexec to run shutdown */ @@ -70,9 +74,9 @@ static int run_kexec_local(const char *l /* On error, force a kexec with the -f option */ if (result) { - *(p + 0) = "-f"; /* 6 */ - *(p + 1) = l_image; /* 7 */ - *(p + 2) = NULL; /* 8 */ + *(p + 0) = "-f"; /* 4 */ + *(p + 1) = l_image; /* 5 */ + *(p + 2) = NULL; /* 6 */ result = pb_run_cmd(argv); } @@ -80,6 +84,9 @@ static int run_kexec_local(const char *l if (result) pb_log("%s: failed: (%d)\n", __func__, result); + talloc_free(s_initrd); + talloc_free(s_args); + return result; }