From patchwork Tue Jan 20 03:21:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 430834 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 345C714010F for ; Tue, 20 Jan 2015 14:22:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA2584B74D; Tue, 20 Jan 2015 04:22:32 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23LNOfLxAo1u; Tue, 20 Jan 2015 04:22:32 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 47BC44B725; Tue, 20 Jan 2015 04:22:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C37904B71E for ; Tue, 20 Jan 2015 04:22:30 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LMK9wyHpl53M for ; Tue, 20 Jan 2015 04:22:30 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yk0-f201.google.com (mail-yk0-f201.google.com [209.85.160.201]) by theia.denx.de (Postfix) with ESMTPS id 68DE94B725 for ; Tue, 20 Jan 2015 04:22:27 +0100 (CET) Received: by mail-yk0-f201.google.com with SMTP id q200so405236ykb.0 for ; Mon, 19 Jan 2015 19:22:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UpbM8Ockj6twPMbvaMAvVYOOgJ6n4c7UhDw6p1bZfWk=; b=QlNood+UPmIWglFlGN62soaZaj75NUJrQlooC1OhYLdzjv10xpCvvzpwx8JbiyagA7 iI+Fp62gDPM6hu0YH6rBncvU+0kYHSTKTdDKWzwertoA5921Am+Q8axiN3xQ7qx1Sbuy rqVu26i0YXI5MkB/yjBu+3zLdh2EDiesjmyYz5gF5LdikdySeh5GuIVgNIby9d9L6jqb f6WnrjYaMhZliH43r+saSk2VCiS2kd+ZpQC61LDp4yPjWFWH5+2PO3a08YG3n7eInuPk VBcsQIXbYtnygoo32JaRPToHkyMD8VTGTDhD8wWxQnaqT/w63hIofU8hcbC92OSkfxtf Cp2A== X-Gm-Message-State: ALoCoQlF29SkCLB4ctb5RqyWVh9oY79gIxGZWJwDdc0HtrSduF4zTpD+Qz1GnMHH4qNFRAR3g27X X-Received: by 10.52.26.145 with SMTP id l17mr25562305vdg.2.1421724146794; Mon, 19 Jan 2015 19:22:26 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id is7si1947047qcb.2.2015.01.19.19.22.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jan 2015 19:22:26 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id NgfMvAai.1; Mon, 19 Jan 2015 19:22:26 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 12CC0220112; Mon, 19 Jan 2015 20:22:26 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 19 Jan 2015 20:21:34 -0700 Message-Id: <1421724094-5818-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1421724094-5818-1-git-send-email-sjg@chromium.org> References: <1421724094-5818-1-git-send-email-sjg@chromium.org> Cc: Pavel Machek Subject: [U-Boot] [PATCH 2/2] sandbox: Add a -D option to use a default device tree X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de It is painful to specify the full path to the device tree with the -d option. It is normally kept in the same directory as U-Boot, so provide an option to use this by default. Signed-off-by: Simon Glass --- arch/sandbox/cpu/start.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 42353d8..097f29a 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -102,6 +103,25 @@ static int sandbox_cmdline_cb_fdt(struct sandbox_state *state, const char *arg) } SANDBOX_CMDLINE_OPT_SHORT(fdt, 'd', 1, "Specify U-Boot's control FDT"); +static int sandbox_cmdline_cb_default_fdt(struct sandbox_state *state, + const char *arg) +{ + const char *fmt = "%s.dtb"; + char *fname; + int len; + + len = strlen(state->argv[0]) + strlen(fmt) + 1; + fname = os_malloc(len); + if (!fname) + return -ENOMEM; + snprintf(fname, len, fmt, state->argv[0]); + state->fdt_fname = fname; + + return 0; +} +SANDBOX_CMDLINE_OPT_SHORT(default_fdt, 'D', 0, + "Use the default u-boot.dtb control FDT in U-Boot directory"); + static int sandbox_cmdline_cb_interactive(struct sandbox_state *state, const char *arg) {