Skip to contentSkip to conversation

efi_loader: PXE boot support

PATCH Superseded Alexander Graf 3 participants 12 messages May 4, 2016 – May 6, 2016

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover efi_loader: PXE boot support

One of the most common boot cases with EFI on arm64 is to boot from the network using PXE boot. While TianoCore implements that just fine, we were lacking support for it in U-Boot so far.

But no longer! Here is a patch set, enabling PXE booting of EFI payloads. With this patch set, I was successfully able to automatically boot our normal (usually used with TianoCore based systems) environment to boot and run grub2 and a kernel from there with U-Boot.

Alexander Graf (4):
efi_loader: Add network access support
bootp: Move vendor class identifier set to function
net: Move the VCI and client arch values to Kconfig
distro: Add efi pxe boot code

 cmd/bootefi.c                          |   7 +
 configs/ls2080a_emu_defconfig          |   1 +
 configs/ls2080a_simu_defconfig         |   1 +
 configs/thunderx_88xx_defconfig        |   1 +
 configs/vexpress_aemv8a_dram_defconfig |   1 +
 configs/vexpress_aemv8a_juno_defconfig |   1 +
 configs/vexpress_aemv8a_semi_defconfig |   1 +
 configs/vexpress_ca15_tc2_defconfig    |   1 +
 configs/vexpress_ca5x2_defconfig       |   1 +
 configs/vexpress_ca9x4_defconfig       |   1 +
 include/config_distro_bootcmd.h        |  37 ++++-
 include/config_distro_defaults.h       |  21 ---
 include/configs/ls2080a_emu.h          |   1 -
 include/configs/ls2080a_simu.h         |   1 -
 include/configs/thunderx_88xx.h        |   2 -
 include/configs/vexpress_aemv8a.h      |   2 -
 include/configs/vexpress_ca15_tc2.h    |   1 -
 include/configs/vexpress_ca5x2.h       |   1 -
 include/configs/vexpress_ca9x4.h       |   1 -
 include/efi_api.h                      | 119 ++++++++++++++
 include/efi_loader.h                   |   7 +
 include/net.h                          |   2 +-
 lib/efi_loader/Makefile                |   1 +
 lib/efi_loader/efi_net.c               | 291 +++++++++++++++++++++++++++++++++
 net/Kconfig                            |  12 ++
 net/bootp.c                            |  37 +++--
 net/net.c                              |   4 +-
 net/tftp.c                             |   2 +
 28 files changed, 511 insertions(+), 47 deletions(-)
 create mode 100644 lib/efi_loader/efi_net.c
Signature · 1 line
1.8.5.6
#1 lore raw

PATCH 1/4 efi_loader: Add network access support

We can now successfully boot EFI applications from disk, but users may want to also run them from a PXE setup.

This patch implements rudimentary network support, allowing a payload to send and receive network packets.

With this patch, I was able to successfully run grub2 with network access inside of QEMU's -M xlnx-ep108.

---
 cmd/bootefi.c            |   7 ++
 include/efi_api.h        | 119 +++++++++++++++++++
 include/efi_loader.h     |   7 ++
 include/net.h            |   2 +-
 lib/efi_loader/Makefile  |   1 +
 lib/efi_loader/efi_net.c | 291 +++++++++++++++++++++++++++++++++++++++++++++++
 net/bootp.c              |   2 +
 net/net.c                |   4 +-
 net/tftp.c               |   2 +
 9 files changed, 432 insertions(+), 3 deletions(-)
 create mode 100644 lib/efi_loader/efi_net.c
cmd/bootefi.c +7 -0
index 7f552fc..d3a2331 100644
@@ -197,6 +197,13 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
 #ifdef CONFIG_LCD
 	efi_gop_register();
 #endif
+#ifdef CONFIG_NET
+	void *nethandle = loaded_image_info.device_handle;
+	efi_net_register(&nethandle);
+
+	if (!memcmp(bootefi_device_path[0].str, "N\0e\0t", 6))
+		loaded_image_info.device_handle = nethandle;
+#endif
 
 	/* Call our payload! */
 #ifdef DEBUG_EFI
include/efi_api.h +119 -0

123 lines not on this page · raw message

include/efi_loader.h +7 -0
index 88b8149..8005454 100644
@@ -91,6 +91,12 @@ extern struct list_head efi_obj_list;
 int efi_disk_register(void);
 /* Called by bootefi to make GOP (graphical) interface available */
 int efi_gop_register(void);
+/* Called by bootefi to make the network interface available */
+int efi_net_register(void **handle);
+
+/* Called by networking code to memorize the dhcp ack package */
+void efi_net_set_dhcp_ack(void *pkt, int len);
+
 /*
  * Stub implementation for a protocol opener that just returns the handle as
  * interface
@@ -157,5 +163,6 @@ static inline void ascii2unicode(u16 *unicode, char *ascii)
 static inline void efi_restore_gd(void) { }
 static inline void efi_set_bootdev(const char *dev, const char *devnr,
 				   const char *path) { }
+static inline void efi_net_set_dhcp_ack(void *pkt, int len) { }
 
 #endif
include/net.h +1 -1
index 1fb4194..f8826ca 100644
@@ -269,7 +269,7 @@ int eth_getenv_enetaddr_by_index(const char *base_name, int index,
 int eth_init(void);			/* Initialize the device */
 int eth_send(void *packet, int length);	   /* Send a packet */
 
-#ifdef CONFIG_API
+#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
 int eth_receive(void *packet, int length); /* Receive a packet*/
 extern void (*push_packet)(void *packet, int length);
 #endif
lib/efi_loader/Makefile +1 -0
index 83e31f6..2a3849e 100644
@@ -11,3 +11,4 @@ obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
 obj-y += efi_memory.o
 obj-$(CONFIG_LCD) += efi_gop.o
 obj-$(CONFIG_PARTITIONS) += efi_disk.o
+obj-$(CONFIG_NET) += efi_net.o
lib/efi_loader/efi_net.c new file +291 -0

291 lines not on this page · raw message

net/bootp.c +2 -0
index d7852db..d91b307 100644
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <efi_loader.h>
 #include <net.h>
 #include <net/tftp.h>
 #include "bootp.h"
@@ -1025,6 +1026,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			    strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0) {
 #endif	/* CONFIG_SYS_BOOTFILE_PREFIX */
 			dhcp_packet_process_options(bp);
+			efi_net_set_dhcp_ack(pkt, len);
 
 			debug("TRANSITIONING TO REQUESTING STATE\n");
 			dhcp_state = REQUESTING;
net/net.c +2 -2
index fba111e..1e1d23d 100644
@@ -146,7 +146,7 @@ static unsigned	net_ip_id;
 /* Ethernet bcast address */
 const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 const u8 net_null_ethaddr[6];
-#ifdef CONFIG_API
+#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
 void (*push_packet)(void *, int len) = 0;
 #endif
 /* Network loop state */
@@ -1054,7 +1054,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 	if (len < ETHER_HDR_SIZE)
 		return;
 
-#ifdef CONFIG_API
+#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
 	if (push_packet) {
 		(*push_packet)(in_packet, len);
 		return;
net/tftp.c +2 -0
index f2889fe..ced45ec 100644
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <efi_loader.h>
 #include <mapmem.h>
 #include <net.h>
 #include <net/tftp.h>
@@ -804,6 +805,7 @@ void tftp_start(enum proto_t protocol)
 		printf("Load address: 0x%lx\n", load_addr);
 		puts("Loading: *\b");
 		tftp_state = STATE_SEND_RRQ;
+		efi_set_bootdev("Net", "", tftp_filename);
 	}
 
 	time_start = get_timer(0);
Signature · 1 line
1.8.5.6
#2 lore raw

PATCH 2/4 bootp: Move vendor class identifier set to function

In reply to Alexander Graf

Both the dhcp as well as the bootp case add vendor class identifier parameters into their packets. Let's move that into a separate function to make overlaying easier.

---
 net/bootp.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
net/bootp.c +13 -13
index d91b307..d718e35 100644
@@ -411,6 +411,17 @@ static void bootp_timeout_handler(void)
 		e += vci_strlen;				\
 	} while (0)
 
+static u8 *add_vci(u8 *e)
+{
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
+	put_vci(e, CONFIG_SPL_NET_VCI_STRING);
+#elif defined(CONFIG_BOOTP_VCI_STRING)
+	put_vci(e, CONFIG_BOOTP_VCI_STRING);
+#endif
+
+	return e;
+}
+
 /*
  *	Initialize BOOTP extension fields in the request.
  */
@@ -508,11 +519,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 	}
 #endif
 
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
-	put_vci(e, CONFIG_SPL_NET_VCI_STRING);
-#elif defined(CONFIG_BOOTP_VCI_STRING)
-	put_vci(e, CONFIG_BOOTP_VCI_STRING);
-#endif
+	e = add_vci(e);
 
 #if defined(CONFIG_BOOTP_VENDOREX)
 	x = dhcp_vendorex_prep(e);
@@ -598,14 +605,7 @@ static int bootp_extended(u8 *e)
 	*e++ = (576 - 312 + OPT_FIELD_SIZE) & 0xff;
 #endif
 
-#if defined(CONFIG_BOOTP_VCI_STRING) || \
-	(defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING))
-#ifdef CONFIG_SPL_BUILD
-	put_vci(e, CONFIG_SPL_NET_VCI_STRING);
-#else
-	put_vci(e, CONFIG_BOOTP_VCI_STRING);
-#endif
-#endif
+	add_vci(e);
 
 #if defined(CONFIG_BOOTP_SUBNETMASK)
 	*e++ = 1;		/* Subnet mask request */
Signature · 1 line
1.8.5.6
#4 lore raw

PATCH 3/4 net: Move the VCI and client arch values to Kconfig

In reply to Alexander Graf

We have a bunch of boards that define their vendor class identifier and client archs in the board files or in the distro config. Move everything to the generic Kconfig options.

We're missing the distinction between i386 and x86_64, as I couldn't find any config variable that would tell us the difference. Is that really important to people? I guess not, so I left it out.

---
 configs/ls2080a_emu_defconfig          |  1 +
 configs/ls2080a_simu_defconfig         |  1 +
 configs/thunderx_88xx_defconfig        |  1 +
 configs/vexpress_aemv8a_dram_defconfig |  1 +
 configs/vexpress_aemv8a_juno_defconfig |  1 +
 configs/vexpress_aemv8a_semi_defconfig |  1 +
 configs/vexpress_ca15_tc2_defconfig    |  1 +
 configs/vexpress_ca5x2_defconfig       |  1 +
 configs/vexpress_ca9x4_defconfig       |  1 +
 include/config_distro_defaults.h       | 21 ---------------------
 include/configs/ls2080a_emu.h          |  1 -
 include/configs/ls2080a_simu.h         |  1 -
 include/configs/thunderx_88xx.h        |  2 --
 include/configs/vexpress_aemv8a.h      |  2 --
 include/configs/vexpress_ca15_tc2.h    |  1 -
 include/configs/vexpress_ca5x2.h       |  1 -
 include/configs/vexpress_ca9x4.h       |  1 -
 net/Kconfig                            | 12 ++++++++++++
 18 files changed, 21 insertions(+), 30 deletions(-)
configs/ls2080a_emu_defconfig +1 -0
index f9b4eac..30a6381 100644
@@ -25,3 +25,4 @@ CONFIG_CMD_CACHE=y
 # CONFIG_CMD_MISC is not set
 CONFIG_SYS_NS16550=y
 CONFIG_OF_LIBFDT=y
+CONFIG_BOOTP_VCI_STRING="U-Boot.LS2080A-EMU"
configs/ls2080a_simu_defconfig +1 -0
index 728fa25..a095b8a 100644
@@ -28,3 +28,4 @@ CONFIG_CMD_FAT=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SYS_NS16550=y
 CONFIG_OF_LIBFDT=y
+CONFIG_BOOTP_VCI_STRING="U-Boot.LS2080A-SIMU"
configs/thunderx_88xx_defconfig +1 -0
index b7078e0..cb33f60 100644
@@ -22,3 +22,4 @@ CONFIG_DEBUG_UART_BASE=0x87e024000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART_SKIP_INIT=y
 CONFIG_REGEX=y
+CONFIG_BOOTP_VCI_STRING="Diagnostics"
configs/vexpress_aemv8a_dram_defconfig +1 -0
index 989f068..c0708b2 100644
@@ -24,3 +24,4 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_FAT=y
 CONFIG_DM=y
 CONFIG_OF_LIBFDT=y
+CONFIG_BOOTP_VCI_STRING="U-Boot.armv8.vexpress_aemv8a"
configs/vexpress_aemv8a_juno_defconfig +1 -0
index c70851f..5af9f58 100644
@@ -24,3 +24,4 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_FAT=y
 CONFIG_DM=y
 CONFIG_OF_LIBFDT=y
+CONFIG_BOOTP_VCI_STRING="U-Boot.armv8.vexpress_aemv8a"
configs/vexpress_aemv8a_semi_defconfig +1 -0
index b0a2f67..379dff2 100644
@@ -24,3 +24,4 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_FAT=y
 CONFIG_DM=y
 CONFIG_OF_LIBFDT=y
+CONFIG_BOOTP_VCI_STRING="U-Boot.armv8.vexpress_aemv8a"
configs/vexpress_ca15_tc2_defconfig +1 -0
index 2f141dd..c39faaa 100644
@@ -24,3 +24,4 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_LIBFDT=y
+CONFIG_BOOTP_VCI_STRING="U-Boot.armv7.vexpress_ca15x2_tc2"
configs/vexpress_ca5x2_defconfig +1 -0
index c495ee5..e71d45e 100644
@@ -24,3 +24,4 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_LIBFDT=y
+CONFIG_BOOTP_VCI_STRING="U-Boot.armv7.vexpress_ca5x2"
configs/vexpress_ca9x4_defconfig +1 -0
index fcd6e26..20100a3 100644
@@ -24,3 +24,4 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_LIBFDT=y
+CONFIG_BOOTP_VCI_STRING="U-Boot.armv7.vexpress_ca9x4"
include/config_distro_defaults.h +0 -21
index 766a212..dfc2cbc 100644
@@ -20,27 +20,6 @@
 #define CONFIG_BOOTP_PXE
 #define CONFIG_BOOTP_SUBNETMASK
 
-#if defined(__arm__) || defined(__aarch64__)
-#define CONFIG_BOOTP_PXE_CLIENTARCH     0x100
-#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
-#if !defined(CONFIG_BOOTP_VCI_STRING)
-#define CONFIG_BOOTP_VCI_STRING         "U-Boot.armv7"
-#endif
-#elif defined(__aarch64__)
-#if !defined(CONFIG_BOOTP_VCI_STRING)
-#define CONFIG_BOOTP_VCI_STRING         "U-Boot.armv8"
-#endif
-#else
-#if !defined(CONFIG_BOOTP_VCI_STRING)
-#define CONFIG_BOOTP_VCI_STRING         "U-Boot.arm"
-#endif
-#endif
-#elif defined(__i386__)
-#define CONFIG_BOOTP_PXE_CLIENTARCH     0x0
-#elif defined(__x86_64__)
-#define CONFIG_BOOTP_PXE_CLIENTARCH     0x9
-#endif
-
 #ifdef CONFIG_ARM64
 #define CONFIG_CMD_BOOTI
 #endif
include/configs/ls2080a_emu.h +0 -1
index f4ace85..16e37bf 100644
@@ -10,7 +10,6 @@
 #include "ls2080a_common.h"
 
 #define CONFIG_IDENT_STRING		" LS2080A-EMU"
-#define CONFIG_BOOTP_VCI_STRING		"U-Boot.LS2080A-EMU"
 
 #define CONFIG_SYS_CLK_FREQ	100000000
 #define CONFIG_DDR_CLK_FREQ	133333333
include/configs/ls2080a_simu.h +0 -1
index bc0d678..7563aaf 100644
@@ -10,7 +10,6 @@
 #include "ls2080a_common.h"
 
 #define CONFIG_IDENT_STRING		" LS2080A-SIMU"
-#define CONFIG_BOOTP_VCI_STRING		"U-Boot.LS2080A-SIMU"
 
 #define CONFIG_SYS_CLK_FREQ	100000000
 #define CONFIG_DDR_CLK_FREQ	133333333
include/configs/thunderx_88xx.h +0 -2
index 7c35d8c..e43a7fd 100644
@@ -17,7 +17,6 @@
 
 #define CONFIG_IDENT_STRING	\
 	" for Cavium Thunder CN88XX ARM v8 Multi-Core"
-#define CONFIG_BOOTP_VCI_STRING		"Diagnostics"
 
 #define MEM_BASE			0x00500000
 
@@ -62,7 +61,6 @@
 #define CONFIG_BOOTP_GATEWAY
 #define CONFIG_BOOTP_HOSTNAME
 #define CONFIG_BOOTP_PXE
-#define CONFIG_BOOTP_PXE_CLIENTARCH	0x100
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LOAD_ADDR		(MEM_BASE)
include/configs/vexpress_aemv8a.h +0 -2
index 1b5fc2e..6a37582 100644
@@ -23,7 +23,6 @@
 #define CONFIG_SYS_CACHELINE_SIZE	64
 
 #define CONFIG_IDENT_STRING		" vexpress_aemv8a"
-#define CONFIG_BOOTP_VCI_STRING		"U-Boot.armv8.vexpress_aemv8a"
 
 /* Link Definitions */
 #if defined(CONFIG_TARGET_VEXPRESS64_BASE_FVP) || \
@@ -146,7 +145,6 @@
 #define CONFIG_BOOTP_GATEWAY
 #define CONFIG_BOOTP_HOSTNAME
 #define CONFIG_BOOTP_PXE
-#define CONFIG_BOOTP_PXE_CLIENTARCH	0x100
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LOAD_ADDR		(V2M_BASE + 0x10000000)
include/configs/vexpress_ca15_tc2.h +0 -1
index 883e58e..b509a9c 100644
@@ -12,7 +12,6 @@
 #define __VEXPRESS_CA15X2_TC2_h
 
 #define CONFIG_VEXPRESS_EXTENDED_MEMORY_MAP
-#define CONFIG_BOOTP_VCI_STRING     "U-Boot.armv7.vexpress_ca15x2_tc2"
 #include "vexpress_common.h"
 
 #define CONFIG_SYSFLAGS_ADDR	0x1c010030
include/configs/vexpress_ca5x2.h +0 -1
index 4385027..20b92dc 100644
@@ -12,7 +12,6 @@
 #define __VEXPRESS_CA5X2_h
 
 #define CONFIG_VEXPRESS_EXTENDED_MEMORY_MAP
-#define CONFIG_BOOTP_VCI_STRING     "U-Boot.armv7.vexpress_ca5x2"
 #include "vexpress_common.h"
 
 #endif /* __VEXPRESS_CA5X2_h */
include/configs/vexpress_ca9x4.h +0 -1
index 99be50a..993398c 100644
@@ -12,7 +12,6 @@
 #define __VEXPRESS_CA9X4_H
 
 #define CONFIG_VEXPRESS_ORIGINAL_MEMORY_MAP
-#define CONFIG_BOOTP_VCI_STRING     "U-Boot.armv7.vexpress_ca9x4"
 #include "vexpress_common.h"
 
 #endif /* VEXPRESS_CA9X4_H */
net/Kconfig +12 -0
index a44a783..b3bd376 100644
@@ -32,4 +32,16 @@ config NET_TFTP_VARS
 	  If unset, timeout and maximum are hard-defined as 1 second
 	  and 10 timouts per TFTP transfer.
 
+config BOOTP_PXE_CLIENTARCH
+	hex
+        default 0x100 if ARM
+        default 0
+
+config BOOTP_VCI_STRING
+	string
+	default "U-Boot.armv7" if CPU_V7 || CPU_V7M
+	default "U-Boot.armv8" if ARM64
+	default "U-Boot.arm" if ARM
+	default "U-Boot"
+
 endif   # if NET
Signature · 1 line
1.8.5.6
#11 lore raw

PATCH 4/4 distro: Add efi pxe boot code

In reply to Alexander Graf

Now that we can expose network functionality to EFI applications, the logical next step is to load them via pxe to execute them as well.

This patch adds the necessary bits to the distro script to automatically load and execute EFI payloads. It identifies the dhcp client as a uEFI capable PXE client, hoping the server returns a tftp path to a workable EFI binary that we can then execute.

To enable boards that don't come with a working device tree preloaded, this patch also adds support to load a device tree from the /dtb directory on the remote tftp server.

---
 include/config_distro_bootcmd.h | 37 ++++++++++++++++++++++++++++++++++++-
 net/bootp.c                     | 13 +++++++++++--
 2 files changed, 47 insertions(+), 3 deletions(-)
include/config_distro_bootcmd.h +36 -1
index 7f67344..c18731e 100644
@@ -230,13 +230,48 @@
 #endif
 
 #if defined(CONFIG_CMD_DHCP)
+#if defined(CONFIG_EFI_LOADER)
+#if defined(CONFIG_ARM64)
+#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00011:UNDI:003000"
+#elif defined(CONFIG_ARM)
+#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00010:UNDI:003000"
+#else
+#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00000:UNDI:003000"
+#endif
+
+/*
+ * Ask the dhcp server for an EFI binary. If we get one, check for a
+ * device tree in the same folder. Then boot everything. If the file was
+ * not an EFI binary, we just return from the bootefi command and continue.
+ */
+#define BOOTENV_EFI_RUN_DHCP \
+	"setenv efi_fdtfile ${fdtfile}; "                                 \
+	BOOTENV_EFI_SET_FDTFILE_FALLBACK                                  \
+	"setenv efi_old_vci ${bootp_vci};"                                \
+	"setenv bootp_vci " BOOTENV_EFI_PXE_VCI ";"                       \
+	"if dhcp ${kernel_addr_r}; then "                                 \
+		"tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};"              \
+		"if fdt addr ${fdt_addr_r}; then "                        \
+			"bootefi ${kernel_addr_r} ${fdt_addr_r}; "        \
+		"else "                                                   \
+			"bootefi ${kernel_addr_r} ${fdtcontroladdr};"     \
+		"fi;"                                                     \
+	"fi;"                                                             \
+	"setenv bootp_vci ${efi_old_vci};"                                \
+	"setenv efi_fdtfile;"                                             \
+	"setenv efi_old_vci;"
+#else
+#define BOOTENV_EFI_RUN_DHCP
+#endif
 #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
 	"bootcmd_dhcp=" \
 		BOOTENV_RUN_NET_USB_START \
 		BOOTENV_RUN_NET_PCI_ENUM \
 		"if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
 			"source ${scriptaddr}; " \
-		"fi\0"
+		"fi;" \
+		BOOTENV_EFI_RUN_DHCP \
+		"\0"
 #define BOOTENV_DEV_NAME_DHCP(devtypeu, devtypel, instance) \
 	"dhcp "
 #else
net/bootp.c +11 -2
index d718e35..85dc524 100644
@@ -413,12 +413,21 @@ static void bootp_timeout_handler(void)
 
 static u8 *add_vci(u8 *e)
 {
+	char *vci = NULL;
+	char *env_vci = getenv("bootp_vci");
+
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
-	put_vci(e, CONFIG_SPL_NET_VCI_STRING);
+	vci = CONFIG_SPL_NET_VCI_STRING;
 #elif defined(CONFIG_BOOTP_VCI_STRING)
-	put_vci(e, CONFIG_BOOTP_VCI_STRING);
+	vci = CONFIG_BOOTP_VCI_STRING;
 #endif
 
+	if (env_vci)
+		vci = env_vci;
+
+	if (vci)
+		put_vci(e, vci);
+
 	return e;
 }
 
Signature · 1 line
1.8.5.6
#5 lore raw

PATCH 3/4 net: Move the VCI and client arch values to Kconfig

In reply to Alexander Graf
Quoted 3 lines · Alexander Graf

We have a bunch of boards that define their vendor class identifier and client archs in the board files or in the distro config. Move everything to the generic Kconfig options.

This part is good and fine, thanks. Can you please do a follow-up to convert CONFIG_SPL_NET_VCI_STRING as well?

Quoted 3 lines

We're missing the distinction between i386 and x86_64, as I couldn't find any config variable that would tell us the difference. Is that really important to people? I guess not, so I left it out.

This part however is is from the RFC (and ARM isn't in it, so 0x100 is special magic). See https://tools.ietf.org/html/rfc4578 section 2.1. I suppose reading that now, the right value to use here for your use case actually makes what we're doing now a little harder as "Intel x86PC" is 0x0, and "EFI IA32" is 0x6. Or we could, if I'm reading the RFC right, just drop this part of the code entirely.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160506/f3bdf394/attachment.sig>
#6 lore raw

PATCH 3/4 net: Move the VCI and client arch values to Kconfig

Quoted 13 lines · Tom Rini
Quoted 3 lines · Alexander Graf

We have a bunch of boards that define their vendor class identifier and client archs in the board files or in the distro config. Move everything to the generic Kconfig options.

This part is good and fine, thanks. Can you please do a follow-up to convert CONFIG_SPL_NET_VCI_STRING as well?

Quoted 3 lines

We're missing the distinction between i386 and x86_64, as I couldn't find any config variable that would tell us the difference. Is that really important to people? I guess not, so I left it out.

Quoted 6 lines

This part however is is from the RFC (and ARM isn't in it, so 0x100 is special magic). See https://tools.ietf.org/html/rfc4578 section 2.1. I suppose reading that now, the right value to use here for your use case actually makes what we're doing now a little harder as "Intel x86PC" is 0x0, and "EFI IA32" is 0x6. Or we could, if I'm reading the RFC right, just drop this part of the code entirely.

Which part? Just drop the ID? Definitely works for me :)

Alex

#7 lore raw

PATCH 3/4 net: Move the VCI and client arch values to Kconfig

Quoted 16 lines · Alexander Graf
Quoted 13 lines · Tom Rini
Quoted 3 lines · Alexander Graf

We have a bunch of boards that define their vendor class identifier and client archs in the board files or in the distro config. Move everything to the generic Kconfig options.

This part is good and fine, thanks. Can you please do a follow-up to convert CONFIG_SPL_NET_VCI_STRING as well?

Quoted 3 lines

We're missing the distinction between i386 and x86_64, as I couldn't find any config variable that would tell us the difference. Is that really important to people? I guess not, so I left it out.

Quoted 8 lines
Quoted 6 lines

This part however is is from the RFC (and ARM isn't in it, so 0x100 is special magic). See https://tools.ietf.org/html/rfc4578 section 2.1. I suppose reading that now, the right value to use here for your use case actually makes what we're doing now a little harder as "Intel x86PC" is 0x0, and "EFI IA32" is 0x6. Or we could, if I'm reading the RFC right, just drop this part of the code entirely.

Which part? Just drop the ID? Definitely works for me :)

Ah, oops, nope, read the section too quickly. We MUST have this present. So we should try and make it correct which in your case means nothing yet, but you could future proof things with:

	default 0x6 if EFI_LOADER && X86
	default 0x0
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160506/8b6e1215/attachment.sig>
#9 lore raw

PATCH 3/4 net: Move the VCI and client arch values to Kconfig

In reply to Tom Rini
Quoted 13 lines · Tom Rini
Quoted 3 lines · Alexander Graf

We have a bunch of boards that define their vendor class identifier and client archs in the board files or in the distro config. Move everything to the generic Kconfig options.

This part is good and fine, thanks. Can you please do a follow-up to convert CONFIG_SPL_NET_VCI_STRING as well?

Quoted 3 lines

We're missing the distinction between i386 and x86_64, as I couldn't find any config variable that would tell us the difference. Is that really important to people? I guess not, so I left it out.

Quoted 6 lines

This part however is is from the RFC (and ARM isn't in it, so 0x100 is special magic). See https://tools.ietf.org/html/rfc4578 section 2.1. I suppose reading that now, the right value to use here for your use case actually makes what we're doing now a little harder as "Intel x86PC" is 0x0, and "EFI IA32" is 0x6. Or we could, if I'm reading the RFC right, just drop this part of the code entirely.

As far as I can tell (and referenced from EDK2 codebase), the canonical list is
http://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml#processor-architecture

/
Leif

#8 lore raw

PATCH 3/4 net: Move the VCI and client arch values to Kconfig

In reply to Tom Rini
Quoted 28 lines

Am 06.05.2016 um 17:38 schrieb Tom Rini <[email protected]>:

Quoted 24 lines · Alexander Graf
Quoted 22 lines · Tom Rini
Quoted 5 lines · Alexander Graf

We have a bunch of boards that define their vendor class identifier and client archs in the board files or in the distro config. Move everything to the generic Kconfig options.

This part is good and fine, thanks. Can you please do a follow-up to convert CONFIG_SPL_NET_VCI_STRING as well?

Quoted 3 lines

We're missing the distinction between i386 and x86_64, as I couldn't find any config variable that would tell us the difference. Is that really important to people? I guess not, so I left it out.

This part however is is from the RFC (and ARM isn't in it, so 0x100 is special magic). See https://tools.ietf.org/html/rfc4578 section 2.1. I suppose reading that now, the right value to use here for your use case actually makes what we're doing now a little harder as "Intel x86PC" is 0x0, and "EFI IA32" is 0x6. Or we could, if I'm reading the RFC right, just drop this part of the code entirely.

Quoted 7 lines
Quoted 1 line

Which part? Just drop the ID? Definitely works for me :)

Ah, oops, nope, read the section too quickly. We MUST have this present. So we should try and make it correct which in your case means nothing yet, but you could future proof things with:

   default 0x6 if EFI_LOADER && X86
   default 0x0

Not really, since efi vs non-efi is a runtime decision. But similar to how I prefer a variable for vci I can do the same for the client id.

Alex

Quoted 3 lines
Signature · 2 lines
-- 
Tom
#10 lore raw

PATCH 3/4 net: Move the VCI and client arch values to Kconfig

In reply to Leif Lindholm
Quoted 21 lines · Leif Lindholm
Quoted 13 lines · Tom Rini
Quoted 3 lines · Alexander Graf

We have a bunch of boards that define their vendor class identifier and client archs in the board files or in the distro config. Move everything to the generic Kconfig options.

This part is good and fine, thanks. Can you please do a follow-up to convert CONFIG_SPL_NET_VCI_STRING as well?

Quoted 3 lines

We're missing the distinction between i386 and x86_64, as I couldn't find any config variable that would tell us the difference. Is that really important to people? I guess not, so I left it out.

Quoted 6 lines

This part however is is from the RFC (and ARM isn't in it, so 0x100 is special magic). See https://tools.ietf.org/html/rfc4578 section 2.1. I suppose reading that now, the right value to use here for your use case actually makes what we're doing now a little harder as "Intel x86PC" is 0x0, and "EFI IA32" is 0x6. Or we could, if I'm reading the RFC right, just drop this part of the code entirely.

Quoted 3 lines

As far as I can tell (and referenced from EDK2 codebase), the canonical list is
http://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml#processor-architecture

That's even better, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160506/567cd02c/attachment.sig>
#3 lore raw

PATCH 2/4 bootp: Move vendor class identifier set to function

In reply to Alexander Graf
Quoted 5 lines · Alexander Graf

Both the dhcp as well as the bootp case add vendor class identifier parameters into their packets. Let's move that into a separate function to make overlaying easier.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160506/9cf6d9fb/attachment.sig>