From patchwork Thu Oct 8 03:19:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 527559 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 704CF140273 for ; Thu, 8 Oct 2015 14:17:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=OJUP7HIF; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 499F54B8E7; Thu, 8 Oct 2015 05:17:38 +0200 (CEST) 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 ETFB2w0RcE50; Thu, 8 Oct 2015 05:17:38 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 91E194B8A3; Thu, 8 Oct 2015 05:17:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5CDF84B8B5 for ; Thu, 8 Oct 2015 05:16:59 +0200 (CEST) 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 VN9cNfCXxqBH for ; Thu, 8 Oct 2015 05:16:59 +0200 (CEST) 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-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by theia.denx.de (Postfix) with ESMTPS id AFB984B88B for ; Thu, 8 Oct 2015 05:16:54 +0200 (CEST) Received: by padhy16 with SMTP id hy16so40132811pad.1 for ; Wed, 07 Oct 2015 20:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=ruPjEHu21+OSJSJZcJ/55GgX2kNQfSRSVnQdHoTpKQU=; b=OJUP7HIF5QqX2tbAMefJx7UXkqjP2OZUQu0VpunQzwITrtaH5qDaGA4SdILez+dr0d TDBX0mELxq972afHXWV8X9oIgviTrHs9JtRsI8nNK13P8A5OCpJ5nylXNcAUf5LpOlfQ UaQkxxmunNBBreA2+5QCP38k3qeyN/1lLz63paTK2WiFjQDSkUb4peu1+kTkSQdAo7Dr wp5RMFrAUzIfWOweS5d46GadAtwN7YSfwbEHlUmjNQFGTpiGrviSM4hBmLfg73ofE/uN RsPCHQEE2DG2xYYn+x5iCOpCmmHnau+FwtLxndGB5dXbm/SEXjEZq5GQuxevAbOWGF3L GArg== X-Received: by 10.66.121.133 with SMTP id lk5mr5284230pab.14.1444274213436; Wed, 07 Oct 2015 20:16:53 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-157-139.windriver.com. [147.11.157.139]) by smtp.gmail.com with ESMTPSA id fb1sm42284352pab.9.2015.10.07.20.16.52 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Oct 2015 20:16:53 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List , Tom Rini , Hannes Schmelzer , Jian Luo , Miao Yan , Dean Armstrong Date: Wed, 7 Oct 2015 20:19:16 -0700 Message-Id: <1444274360-30189-9-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1444274360-30189-1-git-send-email-bmeng.cn@gmail.com> References: <1444274360-30189-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v3 08/12] cmd: bootvx: Pass netmask and gatewayip to VxWorks bootline X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" There are fields in VxWorks bootline for netmask and gatewayip. We can get these from U-Boot environment variables and pass them to VxWorks, just like ipaddr and serverip. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- Changes in v3: - Avoid calls to strlen() Changes in v2: - Fix the endian issue for netmask common/cmd_elf.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/common/cmd_elf.c b/common/cmd_elf.c index 6c95851..6a09378 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -288,13 +288,26 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) CONFIG_SYS_VXWORKS_SERVERNAME); tmp = getenv("ipaddr"); - if (tmp) - ptr += sprintf(build_buf + ptr, "e=%s ", tmp); + if (tmp) { + ptr += sprintf(build_buf + ptr, "e=%s", tmp); + tmp = getenv("netmask"); + if (tmp) { + __be32 addr = getenv_ip("netmask").s_addr; + ptr += sprintf(build_buf + ptr, ":%08x ", + ntohl(addr)); + } else { + ptr += sprintf(build_buf + ptr, " "); + } + } tmp = getenv("serverip"); if (tmp) ptr += sprintf(build_buf + ptr, "h=%s ", tmp); + tmp = getenv("gatewayip"); + if (tmp) + ptr += sprintf(build_buf + ptr, "g=%s ", tmp); + tmp = getenv("hostname"); if (tmp) ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);