svn commit: r304677 - in head/sys/boot: common efi/libefi efi/loader

Baptiste Daroussin bapt at FreeBSD.org
Tue Aug 23 13:35:50 UTC 2016


Author: bapt
Date: Tue Aug 23 13:35:48 2016
New Revision: 304677
URL: https://svnweb.freebsd.org/changeset/base/304677

Log:
  Add tftpfs support for the EFI loader
  
  Allow netbooting on efi without having to setup any NFS server by rebuilding the
  loader with LOADER_TFTP_SUPPORT like for the i386 pxeloader
  
  Sponsored by:	Gandi.net

Modified:
  head/sys/boot/common/dev_net.c
  head/sys/boot/efi/libefi/Makefile
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/efi/loader/conf.c

Modified: head/sys/boot/common/dev_net.c
==============================================================================
--- head/sys/boot/common/dev_net.c	Tue Aug 23 13:19:42 2016	(r304676)
+++ head/sys/boot/common/dev_net.c	Tue Aug 23 13:35:48 2016	(r304677)
@@ -167,8 +167,13 @@ net_open(struct open_file *f, ...)
 		setenv("boot.netif.ip", inet_ntoa(myip), 1);
 		setenv("boot.netif.netmask", intoa(netmask), 1);
 		setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
+#ifdef LOADER_TFTP_SUPPORT
+		setenv("boot.tftproot.server", inet_ntoa(rootip), 1);
+		setenv("boot.tftproot.path", rootpath, 1);
+#else
 		setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
 		setenv("boot.nfsroot.path", rootpath, 1);
+#endif
 		if (intf_mtu != 0) {
 			char mtu[16];
 			sprintf(mtu, "%u", intf_mtu);

Modified: head/sys/boot/efi/libefi/Makefile
==============================================================================
--- head/sys/boot/efi/libefi/Makefile	Tue Aug 23 13:19:42 2016	(r304676)
+++ head/sys/boot/efi/libefi/Makefile	Tue Aug 23 13:35:48 2016	(r304677)
@@ -13,6 +13,10 @@ SRCS+=	time.c
 SRCS+=	time_event.c
 .endif
 
+.if defined(LOADER_TFTP_SUPPORT)
+CFLAGS+=	-DLOADER_TFTP_SUPPORT
+.endif
+
 # We implement a slightly non-standard %S in that it always takes a
 # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
 # seems to matter on arm64 where wchar_t defaults to an int instead

Modified: head/sys/boot/efi/loader/Makefile
==============================================================================
--- head/sys/boot/efi/loader/Makefile	Tue Aug 23 13:19:42 2016	(r304676)
+++ head/sys/boot/efi/loader/Makefile	Tue Aug 23 13:35:48 2016	(r304677)
@@ -21,6 +21,10 @@ SRCS=	autoload.c \
 	smbios.c \
 	vers.c
 
+.if defined(LOADER_TFTP_SUPPORT)
+CFLAGS+=	-DLOADER_TFTP_SUPPORT
+.endif
+
 .if ${MK_ZFS} != "no"
 SRCS+=		zfs.c
 .PATH:		${.CURDIR}/../../zfs

Modified: head/sys/boot/efi/loader/conf.c
==============================================================================
--- head/sys/boot/efi/loader/conf.c	Tue Aug 23 13:19:42 2016	(r304676)
+++ head/sys/boot/efi/loader/conf.c	Tue Aug 23 13:35:48 2016	(r304677)
@@ -51,7 +51,11 @@ struct fs_ops *file_system[] = {
 	&dosfs_fsops,
 	&ufs_fsops,
 	&cd9660_fsops,
+#ifdef LOADER_TFTP_SUPPORT
+	&tftp_fsops,
+#else
 	&nfs_fsops,
+#endif
 	&gzipfs_fsops,
 	&bzipfs_fsops,
 	NULL


More information about the svn-src-all mailing list