From patchwork Wed Jul 8 00:12:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 29571 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 31056B7085 for ; Wed, 8 Jul 2009 10:25:10 +1000 (EST) Received: by ozlabs.org (Postfix) id E3617DE20C; Wed, 8 Jul 2009 10:21:35 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id DFECEDF235 for ; Wed, 8 Jul 2009 10:21:35 +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 6D619DDDE1; Wed, 8 Jul 2009 10:18:31 +1000 (EST) Received: from hera.kernel.org (IDENT:U2FsdGVkX191zhvFGkgHMNPK4l3N+YhGFeMsBP8UZX4@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n680IP74026834 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Jul 2009 00:18:25 GMT Received: (from geoff@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n680IPYR026833; Wed, 8 Jul 2009 00:18:25 GMT Message-Id: <20090708001136.833325213@am.sony.com> User-Agent: quilt/0.47-1 Date: Tue, 07 Jul 2009 17:12:02 -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=yaboot-use-global-boot.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:25 +0000 (UTC) Cc: cbe-oss-dev@ozlabs.org Subject: [Cbe-oss-dev] [patch 28/31] petitboot: Use yaboot global boot option 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 Use any yaboot global boot option in preference to the yaboot.conf device path. Signed-off-by: Geoff Levand --- discover/yaboot-parser.c | 51 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) --- a/discover/yaboot-parser.c +++ b/discover/yaboot-parser.c @@ -85,6 +85,8 @@ static void yaboot_process_pair(struct c /* image */ if (streq(name, "image")) { + const char *g_boot = conf_get_global_option(conf, "boot"); + const char *g_part = conf_get_global_option(conf, "partition"); /* First finish any previous image. */ @@ -93,9 +95,25 @@ static void yaboot_process_pair(struct c /* Then start the new image. */ - state->opt->boot_image_file = resolve_path(state->opt, value, - conf->dc->device_path); - state->desc_image = talloc_strdup(state->opt, value); + if (g_boot && g_part) { + char* dev = talloc_asprintf(NULL, "%s%s", g_boot, + g_part); + + state->opt->boot_image_file = resolve_path(state->opt, + value, dev); + state->desc_image = talloc_asprintf(state->opt, + "%s%s", dev, value); + talloc_free(dev); + } else if (g_boot) { + state->opt->boot_image_file = resolve_path(state->opt, + value, g_boot); + state->desc_image = talloc_asprintf(state->opt, + "%s%s", g_boot, value); + } else { + state->opt->boot_image_file = resolve_path(state->opt, + value, conf->dc->device_path); + state->desc_image = talloc_strdup(state->opt, value); + } return; } @@ -144,10 +162,29 @@ static void yaboot_process_pair(struct c /* initrd */ if (streq(name, "initrd")) { - state->opt->initrd_file = resolve_path(state->opt, - value, conf->dc->device_path); - state->desc_initrd = talloc_asprintf(state, "initrd=%s", - value); + const char *g_boot = conf_get_global_option(conf, "boot"); + const char *g_part = conf_get_global_option(conf, "partition"); + + if (g_boot && g_part) { + char* dev = talloc_asprintf(NULL, "%s%s", g_boot, + g_part); + + state->opt->initrd_file = resolve_path(state->opt, + value, dev); + state->desc_initrd = talloc_asprintf(state, + "initrd=%s%s", dev, value); + talloc_free(dev); + } else if (g_boot) { + state->opt->initrd_file = resolve_path(state->opt, + value, g_boot); + state->desc_initrd = talloc_asprintf(state, + "initrd=%s%s", g_boot, value); + } else { + state->opt->initrd_file = resolve_path(state->opt, + value, conf->dc->device_path); + state->desc_initrd = talloc_asprintf(state, "initrd=%s", + value); + } return; }