From patchwork Fri Dec 6 23:26:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 298537 X-Patchwork-Delegate: trini@ti.com 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 215692C009A for ; Sat, 7 Dec 2013 10:27:13 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 31B634A9F8; Sat, 7 Dec 2013 00:27:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 BxK75QIOef6w; Sat, 7 Dec 2013 00:27:10 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A5A884AABE; Sat, 7 Dec 2013 00:27:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DFB734AA05 for ; Sat, 7 Dec 2013 00:27:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 UyUlzwGLj2gz for ; Sat, 7 Dec 2013 00:26:56 +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-oa0-f74.google.com (mail-oa0-f74.google.com [209.85.219.74]) by theia.denx.de (Postfix) with ESMTPS id 4A16A4A9D5 for ; Sat, 7 Dec 2013 00:26:48 +0100 (CET) Received: by mail-oa0-f74.google.com with SMTP id o6so264978oag.3 for ; Fri, 06 Dec 2013 15:26:47 -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; bh=MCFyIFIHR4eEPCkKXYpRDIGUOwXBQ2/kBU1d4AqJXIY=; b=RzHDz6G4byu3XmQcasKCwUahM4xLQESV+yyB1ZVoTNUXH2P53IXU1D4bv2Ky3tmVvB o3bd9WCTCBkGyRzIJqAwfZE53tPctvHQnF5FYwhuFYbd1kRg2DaMV8VXWDRBKeQQX7Nt u85HAuFtD4WY4mjXnv4k0jVtTvfR1dYndDRDqOqzrIr2TDzjyQMD+q7xGmqXbbElTqXR R5a6Qdk5RCyPswiq9rvkzJLLHmnKIHYlnZLAf4rEYDk254ETgw+/GhxN2t+GwG6zEZGf yZDTnQEJIEJsHxIW6CZs/BPMjz8TFUVGT3t9Ij4r9gvI9VSn/5xfFfUbkSNDexZu35/H v4IQ== X-Gm-Message-State: ALoCoQn95cuN4xOeMbvr2UD8zHT9DoVpWfnT+Bd/x3tG4tPjdCB/HxhrjOvIYArocwZkJM1a+sQEynDgwAyn293qQRPuyVvDPZ3322/azwJbEOiFFckXVG1NQ5dkca3uwm38+K94mwXBTo5HVc6+jYDIlcY3rLmjuvt/OkhZbKDy+jXpMQo+a1+9T2KvjqigR+qnPBPon/td X-Received: by 10.50.164.198 with SMTP id ys6mr2105219igb.5.1386372405924; Fri, 06 Dec 2013 15:26:45 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id m48si491655yho.6.2013.12.06.15.26.45 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Dec 2013 15:26:45 -0800 (PST) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id BCEA25A426E; Fri, 6 Dec 2013 15:26:45 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id E2D93224495; Fri, 6 Dec 2013 16:26:41 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Fri, 6 Dec 2013 16:26:38 -0700 Message-Id: <1386372398-3520-1-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.5.1 Cc: Tom Rini Subject: [U-Boot] [PATCH] bootm: Reinstate special case for standalone images X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 For standalone images, bootm had a special case where the OS boot function was NULL but did actually exist. It was just called manually. This was removed by commit 35fc84fa which checks for the non-existence of this function before the special case is examined. There is no obvious reason why standalone is handled with a special case. Adjust the code so that standalone has a normal OS boot function. We still need a special case for when the function returns, but at least we can avoid the main problem. This is intended to fix the reported: ERROR: booting os 'U-Boot' (17) is not supported but needs testing. Signed-off-by: Simon Glass --- common/cmd_bootm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index ba73f57..2120aa0 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -77,6 +77,9 @@ static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); static void fixup_silent_linux(void); #endif +static int do_bootm_standalone(int flag, int argc, char * const argv[], + bootm_headers_t *images); + static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], bootm_headers_t *images, ulong *os_data, ulong *os_len); @@ -131,6 +134,7 @@ static boot_os_fn do_bootm_integrity; #endif static boot_os_fn *boot_os[] = { + [IH_TYPE_STANDALONE] = do_bootm_standalone, #ifdef CONFIG_BOOTM_LINUX [IH_OS_LINUX] = do_bootm_linux, #endif @@ -487,17 +491,18 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end, return 0; } -static int bootm_start_standalone(int argc, char * const argv[]) +static int do_bootm_standalone(int flag, int argc, char * const argv[], + bootm_headers_t *images) { char *s; int (*appl)(int, char * const []); /* Don't start if "autostart" is set to "no" */ if (((s = getenv("autostart")) != NULL) && (strcmp(s, "no") == 0)) { - setenv_hex("filesize", images.os.image_len); + setenv_hex("filesize", images->os.image_len); return 0; } - appl = (int (*)(int, char * const []))(ulong)ntohl(images.ep); + appl = (int (*)(int, char * const []))(ulong)ntohl(images->ep); (*appl)(argc, argv); return 0; } @@ -523,14 +528,12 @@ static cmd_tbl_t cmd_bootm_sub[] = { static int boot_selected_os(int argc, char * const argv[], int state, bootm_headers_t *images, boot_os_fn *boot_fn) { - if (images->os.type == IH_TYPE_STANDALONE) { - /* This may return when 'autostart' is 'no' */ - bootm_start_standalone(argc, argv); - return 0; - } arch_preboot_os(); boot_fn(state, argc, argv, images); - if (state == BOOTM_STATE_OS_FAKE_GO) /* We expect to return */ + + /* Stand-alone may return when 'autostart' is 'no' */ + if (images->os.type == IH_TYPE_STANDALONE || + state == BOOTM_STATE_OS_FAKE_GO) /* We expect to return */ return 0; bootstage_error(BOOTSTAGE_ID_BOOT_OS_RETURNED); #ifdef DEBUG