From patchwork Mon Dec 3 19:17:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 203419 X-Patchwork-Delegate: joe.hershberger@gmail.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 A9D102C0081 for ; Tue, 4 Dec 2012 06:17:43 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 78A514A09D; Mon, 3 Dec 2012 20:17:40 +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 IbXXuGIH3IYe; Mon, 3 Dec 2012 20:17:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D0D2C4A0A2; Mon, 3 Dec 2012 20:17:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BAF1D4A0A2 for ; Mon, 3 Dec 2012 20:17:34 +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 sEK3F8QLj-Pr for ; Mon, 3 Dec 2012 20:17:33 +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-ob0-f172.google.com (mail-ob0-f172.google.com [209.85.214.172]) by theia.denx.de (Postfix) with ESMTPS id 0DAEF4A09D for ; Mon, 3 Dec 2012 20:17:31 +0100 (CET) Received: by mail-ob0-f172.google.com with SMTP id za17so2775541obc.3 for ; Mon, 03 Dec 2012 11:17:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=+GU34iwHKlM5Nl+NkAePszszAffmslWc+4I7kDhfpVg=; b=YAmBHXUR4Pye5Pgjc72g1/Sw007ww+e9VuvbRhb6ccYC4cwCcDB4uI5koRQjPWv6fC HDbx/YL4xYIWN+sCuBGg+re731H7Y5b3zk1ybkzQybsFmKscKgZ/3Vhh/Z7/STLcQsgx Ypx2E57XRPzBfSfWuf/Euy0Sswbz8TKMl6L4OVH2PugG9pk0EqGp3muV+Yw+TRktROq1 koCpGckV+JTi2AmP2OHjca7mkMiBGm5qTH5+f/wmw99MY0YTRn8iE4PGvhVvai7oakYw aquZU+32Fc75rPxLTiliMwHY/gv5cGliQ8ghZYXvAH2qnKhQZulXoNGD62SzyqV5aOqw 5Q8A== Received: by 10.60.171.138 with SMTP id au10mr9087293oec.34.1354562249602; Mon, 03 Dec 2012 11:17:29 -0800 (PST) Received: from rob-laptop.calxeda.com ([173.226.190.126]) by mx.google.com with ESMTPS id b4sm12592286oea.10.2012.12.03.11.17.28 (version=SSLv3 cipher=OTHER); Mon, 03 Dec 2012 11:17:28 -0800 (PST) From: Rob Herring To: u-boot@lists.denx.de, Wolfgang Denk Date: Mon, 3 Dec 2012 13:17:21 -0600 Message-Id: <1354562241-18733-1-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1354503629-25621-6-git-send-email-robherring2@gmail.com> References: <1354503629-25621-6-git-send-email-robherring2@gmail.com> Cc: trini@ti.com, Rob Herring Subject: [U-Boot] [PATCH v2] pxe: try bootz if bootm fails to find a valid image 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 From: Rob Herring Standard pxelinux servers will typically use a zImage rather than u-boot image format, so fallback to bootz if bootm fails. Signed-off-by: Rob Herring --- v2: - Only fall back to bootz when bootm fails instead of being either or option. common/cmd_pxe.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index 02ed645..4bfacf3 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -579,6 +579,7 @@ static int label_localboot(struct pxe_label *label) static int label_boot(struct pxe_label *label) { char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL }; + char initrd_str[22]; int bootm_argc = 3; label_print(label); @@ -604,7 +605,10 @@ static int label_boot(struct pxe_label *label) return 1; } - bootm_argv[2] = getenv("ramdisk_addr_r"); + bootm_argv[2] = initrd_str; + strcpy(bootm_argv[2], getenv("ramdisk_addr_r")); + strcat(bootm_argv[2], ":"); + strcat(bootm_argv[2], getenv("filesize")); } else { bootm_argv[2] = "-"; } @@ -649,6 +653,11 @@ static int label_boot(struct pxe_label *label) bootm_argc = 4; do_bootm(NULL, 0, bootm_argc, bootm_argv); + +#ifdef CONFIG_CMD_BOOTZ + /* Try booting a zImage if do_bootm returns */ + do_bootz(NULL, 0, bootm_argc, bootm_argv); +#endif return 1; }