From patchwork Wed Jul 8 00:11:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 29570 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 49CCAB7085 for ; Wed, 8 Jul 2009 10:24:55 +1000 (EST) Received: by ozlabs.org (Postfix) id 76366DF19C; Wed, 8 Jul 2009 10:21:29 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 7408DDF19B for ; Wed, 8 Jul 2009 10:21:29 +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 D43D4DDF9C; Wed, 8 Jul 2009 10:18:29 +1000 (EST) Received: from hera.kernel.org (IDENT:U2FsdGVkX1/ELGNueawty4O0niLIiYXkpPrkm0b1cCE@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n680IMQ9026806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Jul 2009 00:18:22 GMT Received: (from geoff@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n680IMci026805; Wed, 8 Jul 2009 00:18:22 GMT Message-Id: <20090708001136.647565233@am.sony.com> User-Agent: quilt/0.47-1 Date: Tue, 07 Jul 2009 17:11:59 -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=default-video-arg.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=AWL,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:23 +0000 (UTC) Cc: cbe-oss-dev@ozlabs.org Subject: [Cbe-oss-dev] [patch 25/31] petitboot: Add default video arg to kernel command line 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 Add the current bootloader video mode to the kernel command line when the command line does not have a video mode specified. Signed-off-by: Geoff Levand --- ui/ncurses/ps3-cui.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) --- a/ui/ncurses/ps3-cui.c +++ b/ui/ncurses/ps3-cui.c @@ -193,23 +193,51 @@ static int ps3_svm_cb(struct pmenu_item * ps3_kexec_cb - The kexec callback. * * Writes config data to PS3 flash then calls pb_run_kexec(). + * Adds a video mode arg to the kernel command line if needed. */ static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod) { struct ps3_cui *ps3 = ps3_from_cui(cui); + int result; + int altered_args; + char *orig_args; pb_log("%s: %s\n", __func__, cod->name); assert(ps3->cui->current == &ps3->cui->main->scr); + /* Save values to flash if needed */ + if ((cod->opt_hash && cod->opt_hash != cui->default_item) || ps3->dirty_values) { ps3->values.default_item = cod->opt_hash; ps3_flash_set_values(&ps3->values); } - return pb_run_kexec(cod->kd); + /* Add a default kernel video mode. */ + + if (!cod->kd->args) { + altered_args = 1; + orig_args = NULL; + cod->kd->args = talloc_asprintf(NULL, "video=ps3fb:mode:%u", + (unsigned int)ps3->values.video_mode); + } else if (!strstr(cod->kd->args, "video=")) { + altered_args = 1; + orig_args = cod->kd->args; + cod->kd->args = talloc_asprintf(NULL, "%s video=ps3fb:mode:%u", + orig_args, (unsigned int)ps3->values.video_mode); + } else + altered_args = 0; + + result = pb_run_kexec(cod->kd); + + if (altered_args) { + talloc_free(cod->kd->args); + cod->kd->args = orig_args; + } + + return result; } /** @@ -332,7 +360,7 @@ static struct pmenu *ps3_mm_init(struct #if defined(DEBUG) m->scr.frame.title = talloc_strdup(m, - "Petitboot PS3 (ver " PACKAGE_VERSION ")"); + "Petitboot PS3 (" PACKAGE_VERSION ")"); #else m->scr.frame.title = talloc_strdup(m, "Petitboot PS3"); #endif