From owner-svn-src-all@freebsd.org Tue Aug 23 13:35:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71D3EBC3815; Tue, 23 Aug 2016 13:35:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 356781A5F; Tue, 23 Aug 2016 13:35:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7NDZnP3088250; Tue, 23 Aug 2016 13:35:49 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7NDZnI1088246; Tue, 23 Aug 2016 13:35:49 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201608231335.u7NDZnI1088246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 23 Aug 2016 13:35:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304677 - in head/sys/boot: common efi/libefi efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 13:35:50 -0000 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