summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-12-16 17:13:09 +0000
committerbapt <bapt@FreeBSD.org>2015-12-16 17:13:09 +0000
commit15c888577ca75f34386af6f93cc29c8818044afe (patch)
treeec499553f40e2e6fcafe53afa38af59c08a2a29d /sys/boot/i386
parent2fca0caf45275f1f3821f9e7095ed671a7f5b9b5 (diff)
downloadFreeBSD-src-15c888577ca75f34386af6f93cc29c8818044afe.zip
FreeBSD-src-15c888577ca75f34386af6f93cc29c8818044afe.tar.gz
pxeboot: make the tftp loader use the option root-path directive
pxeboot in tftp loader mode (when built with LOADER_TFTP_SUPPORT) now prefix all the path to open with the path obtained via the option 'root-path' directive. This allows to be able to use the traditional content /boot out of box. Meaning it now works pretty much like all other loaders. It simplifies hosting hosting multiple version of FreeBSD on a tftp server. As a consequence, pxeboot does not look anymore for a pxeboot.4th (which was never provided) Note: that pxeboot in tftp loader mode is not built by default. Reviewed by: rpokala Relnotes: yes Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D4590
Diffstat (limited to 'sys/boot/i386')
-rw-r--r--sys/boot/i386/libi386/libi386.h1
-rw-r--r--sys/boot/i386/libi386/pxe.c26
-rw-r--r--sys/boot/i386/loader/main.c5
3 files changed, 3 insertions, 29 deletions
diff --git a/sys/boot/i386/libi386/libi386.h b/sys/boot/i386/libi386/libi386.h
index ce650dd..839745d 100644
--- a/sys/boot/i386/libi386/libi386.h
+++ b/sys/boot/i386/libi386/libi386.h
@@ -123,5 +123,4 @@ int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip,
int bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep,
vm_offset_t *kernend, int add_smap);
-char *pxe_default_rc(void);
void pxe_enable(void *pxeinfo);
diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c
index 1b255e9..0704672 100644
--- a/sys/boot/i386/libi386/pxe.c
+++ b/sys/boot/i386/libi386/pxe.c
@@ -288,8 +288,10 @@ 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])
strcpy(rootpath, PXENFSROOTPATH);
+#endif
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
if (rootpath[i] == ':')
@@ -317,6 +319,7 @@ pxe_open(struct open_file *f, ...)
setenv("boot.nfsroot.path", rootpath, 1);
#else
setenv("boot.netif.server", inet_ntoa(rootip), 1);
+ setenv("boot.tftproot.path", rootpath, 1);
#endif
setenv("dhcp.host-name", hostname, 1);
@@ -705,26 +708,3 @@ readudp(struct iodesc *h, void *pkt, size_t len, time_t timeout)
uh->uh_sport = udpread_p->s_port;
return udpread_p->buffer_size;
}
-
-char *
-pxe_default_rc(void)
-{
- char *rc;
- size_t count, rcsz;
-
- /* XXX It may not be a good idea to modify the PXE boot file. */
- rc = (char *)bootplayer.bootfile;
- rcsz = sizeof(bootplayer.bootfile);
-
- /* Ignore how we define rc and rcsz above -- it can change. */
- if (rcsz < 6)
- return (NULL);
- if (*rc == '\0') {
- strncpy(rc, "pxeboot", rcsz);
- rc[rcsz - 1] = '\0';
- }
- count = strlen(rc);
- strncat(rc, ".4th", rcsz - count - 1);
- printf("PXE: loading Forth from %s\n", rc);
- return (rc);
-}
diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c
index 82465a3..0087338 100644
--- a/sys/boot/i386/loader/main.c
+++ b/sys/boot/i386/loader/main.c
@@ -196,11 +196,6 @@ main(void)
bios_getsmap();
-#ifdef LOADER_TFTP_SUPPORT
- if (kargs->bootflags & KARGS_FLAGS_PXE)
- interact(pxe_default_rc());
- else
-#endif
interact(NULL);
/* if we ever get here, it is an error */
OpenPOWER on IntegriCloud