summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-10-19 12:29:10 -0200
committerRenato Botelho <renato@netgate.com>2016-10-19 12:29:10 -0200
commit02fa2d6083daaf327638f8e0fb9aa0be9bff743a (patch)
tree0552dcf115d54bfc7426ba7339d13bf975963cb9 /sys/boot
parentcb642130dfc50717bb970a104c44aa7690930a38 (diff)
parent3311d8689070efe9e08ded9ba391646ed81fe884 (diff)
downloadFreeBSD-src-02fa2d6083daaf327638f8e0fb9aa0be9bff743a.zip
FreeBSD-src-02fa2d6083daaf327638f8e0fb9aa0be9bff743a.tar.gz
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/common/dev_net.c18
-rw-r--r--sys/boot/efi/loader/conf.c1
-rw-r--r--sys/boot/fdt/fdt_loader_cmd.c2
-rw-r--r--sys/boot/i386/libi386/pxe.c35
-rw-r--r--sys/boot/i386/loader/conf.c4
-rw-r--r--sys/boot/i386/pxeldr/pxeboot.88
-rw-r--r--sys/boot/pc98/loader/conf.c4
-rw-r--r--sys/boot/uboot/lib/elf_freebsd.c2
-rw-r--r--sys/boot/uboot/lib/glue.c2
9 files changed, 47 insertions, 29 deletions
diff --git a/sys/boot/common/dev_net.c b/sys/boot/common/dev_net.c
index ed07a2c..09583d0 100644
--- a/sys/boot/common/dev_net.c
+++ b/sys/boot/common/dev_net.c
@@ -167,8 +167,14 @@ 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);
- setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
- setenv("boot.nfsroot.path", rootpath, 1);
+ setenv("boot.netif.server", inet_ntoa(rootip), 1);
+ if (netproto == NET_TFTP) {
+ setenv("boot.tftproot.server", inet_ntoa(rootip), 1);
+ setenv("boot.tftproot.path", rootpath, 1);
+ } else if (netproto == NET_NFS) {
+ setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
+ setenv("boot.nfsroot.path", rootpath, 1);
+ }
if (intf_mtu != 0) {
char mtu[16];
sprintf(mtu, "%u", intf_mtu);
@@ -365,6 +371,13 @@ net_parse_rootpath()
int i;
n_long addr = INADDR_NONE;
+ netproto = NET_NFS;
+
+ if (tftpip.s_addr != 0) {
+ netproto = NET_TFTP;
+ addr = tftpip.s_addr;
+ }
+
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
if (rootpath[i] == ':')
break;
@@ -373,5 +386,6 @@ net_parse_rootpath()
addr = inet_addr(&rootpath[0]);
bcopy(&rootpath[i], rootpath, strlen(&rootpath[i])+1);
}
+
return (addr);
}
diff --git a/sys/boot/efi/loader/conf.c b/sys/boot/efi/loader/conf.c
index ecbf8b0..3596a63 100644
--- a/sys/boot/efi/loader/conf.c
+++ b/sys/boot/efi/loader/conf.c
@@ -51,6 +51,7 @@ struct fs_ops *file_system[] = {
&dosfs_fsops,
&ufs_fsops,
&cd9660_fsops,
+ &tftp_fsops,
&nfs_fsops,
&gzipfs_fsops,
&bzipfs_fsops,
diff --git a/sys/boot/fdt/fdt_loader_cmd.c b/sys/boot/fdt/fdt_loader_cmd.c
index 5f77757..fb65a8d 100644
--- a/sys/boot/fdt/fdt_loader_cmd.c
+++ b/sys/boot/fdt/fdt_loader_cmd.c
@@ -421,7 +421,7 @@ fdt_setup_fdtp()
/* If we were given the address of a valid blob in memory, use it. */
if (fdt_to_load != NULL) {
if (fdt_load_dtb_addr(fdt_to_load) == 0) {
- printf("Using DTB from memory address 0x%p.\n",
+ printf("Using DTB from memory address %p.\n",
fdt_to_load);
return (0);
}
diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c
index 096ebc4..28046f3 100644
--- a/sys/boot/i386/libi386/pxe.c
+++ b/sys/boot/i386/libi386/pxe.c
@@ -288,10 +288,15 @@ pxe_open(struct open_file *f, ...)
bootp(pxe_sock, BOOTP_PXE);
if (rootip.s_addr == 0)
rootip.s_addr = bootplayer.sip;
-#ifdef LOADER_NFS_SUPPORT
- if (!rootpath[0])
+
+ netproto = NET_NFS;
+ if (tftpip.s_addr != 0) {
+ netproto = NET_TFTP;
+ rootip.s_addr = tftpip.s_addr;
+ }
+
+ if (netproto == NET_NFS && !rootpath[0])
strcpy(rootpath, PXENFSROOTPATH);
-#endif
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
if (rootpath[i] == ':')
@@ -315,17 +320,17 @@ pxe_open(struct open_file *f, ...)
sprintf(mtu, "%u", intf_mtu);
setenv("boot.netif.mtu", mtu, 1);
}
-#ifdef LOADER_NFS_SUPPORT
printf("pxe_open: server addr: %s\n", inet_ntoa(rootip));
printf("pxe_open: server path: %s\n", rootpath);
printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip));
- setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
- setenv("boot.nfsroot.path", rootpath, 1);
-#else
- setenv("boot.netif.server", inet_ntoa(rootip), 1);
- setenv("boot.tftproot.path", rootpath, 1);
-#endif
+ if (netproto == NET_NFS) {
+ setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
+ setenv("boot.nfsroot.path", rootpath, 1);
+ } else if (netproto == NET_TFTP) {
+ setenv("boot.netif.server", inet_ntoa(rootip), 1);
+ setenv("boot.tftproot.path", rootpath, 1);
+ }
setenv("dhcp.host-name", hostname, 1);
setenv("pxeboot.ip", inet_ntoa(myip), 1);
@@ -359,10 +364,10 @@ pxe_close(struct open_file *f)
if (pxe_opens > 0)
return(0);
-#ifdef LOADER_NFS_SUPPORT
- /* get an NFS filehandle for our root filesystem */
- pxe_setnfshandle(rootpath);
-#endif
+ if (netproto == NET_NFS) {
+ /* get an NFS filehandle for our root filesystem */
+ pxe_setnfshandle(rootpath);
+ }
if (pxe_sock >= 0) {
@@ -422,7 +427,6 @@ pxe_perror(int err)
return;
}
-#ifdef LOADER_NFS_SUPPORT
/*
* Reach inside the libstand NFS code and dig out an NFS handle
* for the root filesystem.
@@ -533,7 +537,6 @@ pxe_setnfshandle(char *rootpath)
setenv("boot.nfsroot.nfshandlelen", buf, 1);
}
#endif /* OLD_NFSV2 */
-#endif /* LOADER_NFS_SUPPORT */
void
pxenv_call(int func)
diff --git a/sys/boot/i386/loader/conf.c b/sys/boot/i386/loader/conf.c
index 38df74d..29ce1e3 100644
--- a/sys/boot/i386/loader/conf.c
+++ b/sys/boot/i386/loader/conf.c
@@ -45,10 +45,6 @@ __FBSDID("$FreeBSD$");
* XXX as libi386 and biosboot merge, some of these can become linker sets.
*/
-#if defined(LOADER_NFS_SUPPORT) && defined(LOADER_TFTP_SUPPORT)
-#error "Cannot have both tftp and nfs support yet."
-#endif
-
#if defined(LOADER_FIREWIRE_SUPPORT)
extern struct devsw fwohci;
#endif
diff --git a/sys/boot/i386/pxeldr/pxeboot.8 b/sys/boot/i386/pxeldr/pxeboot.8
index d2ca703..7f57d5a 100644
--- a/sys/boot/i386/pxeldr/pxeboot.8
+++ b/sys/boot/i386/pxeldr/pxeboot.8
@@ -85,6 +85,14 @@ expects to fetch
.Pa /boot/loader.rc
from the specified server before loading any other files.
.Pp
+.Nm
+defaults to a conservative 1024 byte NFS data packet size.
+This may be changed by setting the
+.Va nfs.read_size
+variable in
+.Pa /boot/loader.conf .
+Valid values range from 1024 to 4096 bytes.
+.Pp
In all other respects,
.Nm
acts just like
diff --git a/sys/boot/pc98/loader/conf.c b/sys/boot/pc98/loader/conf.c
index d05cd13..695c260 100644
--- a/sys/boot/pc98/loader/conf.c
+++ b/sys/boot/pc98/loader/conf.c
@@ -42,10 +42,6 @@ __FBSDID("$FreeBSD$");
* XXX as libi386 and biosboot merge, some of these can become linker sets.
*/
-#if defined(LOADER_NFS_SUPPORT) && defined(LOADER_TFTP_SUPPORT)
-#error "Cannot have both tftp and nfs support yet."
-#endif
-
/* Exported for libstand */
struct devsw *devsw[] = {
&bioscd,
diff --git a/sys/boot/uboot/lib/elf_freebsd.c b/sys/boot/uboot/lib/elf_freebsd.c
index b4fd1b3..a65fa26 100644
--- a/sys/boot/uboot/lib/elf_freebsd.c
+++ b/sys/boot/uboot/lib/elf_freebsd.c
@@ -85,7 +85,7 @@ __elfN(uboot_exec)(struct preloaded_file *fp)
return (error);
entry = (void *)e->e_entry;
- printf("Kernel entry at 0x%p...\n", entry);
+ printf("Kernel entry at %p...\n", entry);
dev_cleanup();
printf("Kernel args: %s\n", fp->f_args);
diff --git a/sys/boot/uboot/lib/glue.c b/sys/boot/uboot/lib/glue.c
index 07db23d..312075a 100644
--- a/sys/boot/uboot/lib/glue.c
+++ b/sys/boot/uboot/lib/glue.c
@@ -469,7 +469,7 @@ ub_dump_di(int handle)
int i;
printf("device info (%d):\n", handle);
- printf(" cookie\t= 0x%p\n", di->cookie);
+ printf(" cookie\t= %p\n", di->cookie);
printf(" type\t\t= 0x%08x\n", di->type);
if (di->type == DEV_TYP_NET) {
OpenPOWER on IntegriCloud