From patchwork Wed Sep 5 08:55:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 11186 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 677D223F9F for ; Wed, 5 Sep 2012 08:56:05 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4EFB3A195B8 for ; Wed, 5 Sep 2012 08:55:12 +0000 (UTC) Received: by iafj25 with SMTP id j25so405012iaf.11 for ; Wed, 05 Sep 2012 01:56:04 -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=wsirCEnkFuoWrKrdXagKO9CfmCd5u9iBcGyB9wdobnw=; b=LiNUeZaCEW4yI2kPL38M+vVT+371DdTTfHJ94xA4uvqIF2NVefPwT5/OVyn0Qgh1Ax t8fkxjdv2ity5aReZG/zKYyh3Tpyd/VEspfA9TbbN1OBqTOtYe2lTiMxt2PuEZJNC/XM X9YvDJFhmJLRgHc9R9jtcU44pxzwURZo4TCzZttvM/ZYaa1+WcKvrhLBPXIbx3vvvPpN vjoFRZF4fmB3ALitUrkAvfK5JTmjyBm4G074X2a/l6P3DyflJ9TYfF58F/LHVMDehH1g 1iQjpOgE3Oh9fbVDO/EI7j/0YXZnptILVb+SZinL6JxZ/qEFCMN524MBxg34dw/huA2L G8jg== Received: by 10.50.217.227 with SMTP id pb3mr17126493igc.28.1346835364398; Wed, 05 Sep 2012 01:56:04 -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 ex8csp241021igc; Wed, 5 Sep 2012 01:56:04 -0700 (PDT) Received: by 10.68.203.67 with SMTP id ko3mr53185715pbc.126.1346835363760; Wed, 05 Sep 2012 01:56:03 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id pb4si1638127pbc.90.2012.09.05.01.56.03 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Sep 2012 01:56:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.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 mail-pb0-f50.google.com with SMTP id md12so661641pbc.37 for ; Wed, 05 Sep 2012 01:56:03 -0700 (PDT) Received: by 10.66.73.7 with SMTP id h7mr47356137pav.34.1346835363297; Wed, 05 Sep 2012 01:56:03 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id gf7sm967764pbc.65.2012.09.05.01.56.00 (version=SSLv3 cipher=OTHER); Wed, 05 Sep 2012 01:56:02 -0700 (PDT) From: Chander Kashyap To: u-boot@lists.denx.de Cc: patches@linaro.org, jason.hobbs@calxeda.com, Chander Kashyap Subject: [RFC] [PATCH] PXE: FDT: Add support for fdt in PXE Date: Wed, 5 Sep 2012 14:25:01 +0530 Message-Id: <1346835301-15021-1-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkkIxRrp0dk5eZNcXLdRplY0X3isdEIl97NXimKJ0R2LrSZ+iD5Njmd8ZZPI67VNGFGD8OA 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 --- common/cmd_pxe.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index 6b31dea..11cde21 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,21 @@ 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; + } + } + + /* + * fdt usage is optional. If there is an fdt_addr specified, we will + * pass it along to bootm, and adjust argc appropriately. + */ + bootm_argv[3] = getenv("fdt_addr"); + if (bootm_argv[3]) bootm_argc = 4; @@ -658,6 +680,7 @@ enum token_type { T_DEFAULT, T_PROMPT, T_INCLUDE, + T_FDT, T_INVALID }; @@ -685,6 +708,7 @@ static const struct token keywords[] = { {"append", T_APPEND}, {"initrd", T_INITRD}, {"include", T_INCLUDE}, + {"fdt", T_FDT}, {NULL, T_INVALID} }; @@ -1074,6 +1098,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;