From patchwork Thu Sep 6 05:40:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 11204 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D678623E02 for ; Thu, 6 Sep 2012 05:40:21 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2A8ACA1946B for ; Thu, 6 Sep 2012 05:39:26 +0000 (UTC) Received: by ieak11 with SMTP id k11so2228310iea.11 for ; Wed, 05 Sep 2012 22:40:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=jwwY7ZV3/wxp5MIiu4LcKDIf5QjSwvfGLJr2rK/RAgo=; b=nsh68PQxDu8rUjLuhvkeKjMtnB0Rd/IIteeg+KFpnlHoojHg2IaF//J8yLSC2w+oDw KmOtyXk3NmafSEQT8vrkyfO8HgBklWOgKos8CrkdYALr+bwvkLAy6LQTFBi/kRyJNYjx Tce6SqnUz5LH4YidS1C9jJu4zO14r5SFjBiGLZrtl6et3wDB77QDCoJ8sDgRBOc/j5iV Pd0d8qFixW1syGabwmXmhh+G55Blc3bsoUdPRu85grDs5+SsayUu3uRIjtim81HWgF72 cty5a0Zpi4pxFH3j/PSN0ZqeRor4FwGx6rKdUOdCxz9q/glfzJpFFQSBPsHgANizaBp1 sPqg== Received: by 10.42.109.194 with SMTP id m2mr690505icp.48.1346910020722; Wed, 05 Sep 2012 22:40:20 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp297148igc; Wed, 5 Sep 2012 22:40:20 -0700 (PDT) Received: by 10.66.88.198 with SMTP id bi6mr2155490pab.23.1346910019471; Wed, 05 Sep 2012 22:40:19 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id px5si1910194pbb.352.2012.09.05.22.40.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Sep 2012 22:40:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) smtp.mail=chander.kashyap@linaro.org Received: by dade7 with SMTP id e7so952059dad.37 for ; Wed, 05 Sep 2012 22:40:18 -0700 (PDT) Received: by 10.68.225.233 with SMTP id rn9mr3112354pbc.135.1346910018286; Wed, 05 Sep 2012 22:40:18 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id rr10sm766022pbc.71.2012.09.05.22.40.15 (version=SSLv3 cipher=OTHER); Wed, 05 Sep 2012 22:40:17 -0700 (PDT) From: Chander Kashyap To: u-boot@lists.denx.de Cc: jason.hobbs@calxeda.com, patches@linaro.org, Chander Kashyap Subject: [PATCH v3] PXE: FDT: Add support for fdt in PXE Date: Thu, 6 Sep 2012 11:10:04 +0530 Message-Id: <1346910005-19356-1-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlP93+/LMbw98XDC541oQ5js37hdoGFTuanVzN1qSRcFfpuFg6lY2poKPv1mpKaw1e1PEiv Now DT support is becomming common for all new SoC's. Hence it is better to have option for getting specific FDT from the remote server. This patch adds support for new lable i.e. fdt. If fdt_addr is specified then load fdt blob from the remote server to fdt_address. Signed-off-by: Chander Kashyap --- Changes in v2: - Removed the duplicate code. changes in v3: - Added documentation for "fdt" lable in doc/README.pxe common/cmd_pxe.c | 23 +++++++++++++++++++++++ doc/README.pxe | 10 ++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index 6b31dea..0c81e08 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -450,6 +450,7 @@ struct pxe_label { char *kernel; char *append; char *initrd; + char *fdt; int attempted; int localboot; struct list_head list; @@ -517,6 +518,9 @@ static void label_destroy(struct pxe_label *label) if (label->initrd) free(label->initrd); + if (label->fdt) + free(label->fdt); + free(label); } @@ -541,6 +545,9 @@ static void label_print(void *data) if (label->initrd) printf("\t\tinitrd: %s\n", label->initrd); + + if (label->fdt) + printf("\tfdt: %s\n", label->fdt); } /* @@ -633,6 +640,15 @@ static void label_boot(struct pxe_label *label) */ bootm_argv[3] = getenv("fdt_addr"); + /* if fdt label is defined then get fdt from server */ + if (bootm_argv[3] && label->fdt) { + if (get_relfile_envaddr(label->fdt, "fdt_addr") < 0) { + printf("Skipping %s for failure retrieving fdt\n", + label->name); + return; + } + } + if (bootm_argv[3]) bootm_argc = 4; @@ -658,6 +674,7 @@ enum token_type { T_DEFAULT, T_PROMPT, T_INCLUDE, + T_FDT, T_INVALID }; @@ -685,6 +702,7 @@ static const struct token keywords[] = { {"append", T_APPEND}, {"initrd", T_INITRD}, {"include", T_INCLUDE}, + {"fdt", T_FDT}, {NULL, T_INVALID} }; @@ -1074,6 +1092,11 @@ static int parse_label(char **c, struct pxe_menu *cfg) err = parse_sliteral(c, &label->initrd); break; + case T_FDT: + if (!label->fdt) + err = parse_sliteral(c, &label->fdt); + break; + case T_LOCALBOOT: err = parse_integer(c, &label->localboot); break; diff --git a/doc/README.pxe b/doc/README.pxe index 2bbf53d..835ca5a 100644 --- a/doc/README.pxe +++ b/doc/README.pxe @@ -93,8 +93,9 @@ pxe boot be passed to the bootm command to boot the kernel. These environment variables are required to be set. - fdt_addr - the location of a fdt blob. If this is set, it will be passed - to bootm when booting a kernel. + fdt_addr - locations in RAM at which 'pxe boot' will store the fdt blob + it retrieves from tftp, if "fdt" lable is defined in pxe file. If this is + set, it will be passed to bootm when booting a kernel. pxe file format =============== @@ -156,6 +157,11 @@ initrd - if this label is chosen, use tftp to retrieve the initrd the initrd_addr_r environment variable, and that address will be passed to bootm. +fdt - if this label is chosen, use tftp to retrieve the fdt blob + at . it will be stored at the address indicated in + the fdt_addr environment variable, and that address will + be passed to bootm. + localboot - Run the command defined by "localcmd" in the environment. is ignored and is only here to match the syntax of PXELINUX config files.