summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorTom Cosgrove <tom@cvs.openbsd.org>2007-07-27 17:48:02 +0000
committerTom Cosgrove <tom@cvs.openbsd.org>2007-07-27 17:48:02 +0000
commit1fb587ee8bee3d7edfc065af8ee2796fc2d9962c (patch)
tree873a6e33902128d5942be68fd4673e67acc3e4fe /sys/arch/amd64
parent30515f6f19fa739a4b0f706aa4baa76c87996f5d (diff)
As on i386:
We don't want to pass the PXE MAC address to the kernel when booting from a local disk, since the MAC address causes the kernel to look for root on NFS. Do this by remembering (not adding to boot arguments) the MAC address when opening the PXE device, and clearing this if we happen to load a file off a non-network disk. "works as advertised for me" todd@; "stop sitting on this/no objections" deraadt@; amd64 code mainly written by patch(1).
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/stand/libsa/exec_i386.c7
-rw-r--r--sys/arch/amd64/stand/libsa/pxe.c6
-rw-r--r--sys/arch/amd64/stand/pxeboot/conf.c4
-rw-r--r--sys/arch/amd64/stand/pxeboot/devopen.c14
4 files changed, 25 insertions, 6 deletions
diff --git a/sys/arch/amd64/stand/libsa/exec_i386.c b/sys/arch/amd64/stand/libsa/exec_i386.c
index f5559048a01..d05fb66b3db 100644
--- a/sys/arch/amd64/stand/libsa/exec_i386.c
+++ b/sys/arch/amd64/stand/libsa/exec_i386.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_i386.c,v 1.4 2004/03/21 21:37:41 tom Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.5 2007/07/27 17:48:01 tom Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
@@ -40,6 +40,8 @@
typedef void (*startfuncp)(int, int, int, int, int, int, int, int)
__attribute__ ((noreturn));
+char *bootmac = NULL;
+
void
run_loadfile(u_long *marks, int howto)
{
@@ -60,6 +62,9 @@ run_loadfile(u_long *marks, int howto)
cd.conspeed = com_speed;
addbootarg(BOOTARG_CONSDEV, sizeof(cd), &cd);
+ if (bootmac != NULL)
+ addbootarg(BOOTARG_BOOTMAC, sizeof(bios_bootmac_t), bootmac);
+
/* Pass memory map to the kernel */
mem_pass();
diff --git a/sys/arch/amd64/stand/libsa/pxe.c b/sys/arch/amd64/stand/libsa/pxe.c
index 58de9a8d305..a71e37f1b95 100644
--- a/sys/arch/amd64/stand/libsa/pxe.c
+++ b/sys/arch/amd64/stand/libsa/pxe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxe.c,v 1.4 2006/05/20 22:37:43 deraadt Exp $ */
+/* $OpenBSD: pxe.c,v 1.5 2007/07/27 17:48:01 tom Exp $ */
/* $NetBSD: pxe.c,v 1.5 2003/03/11 18:29:00 drochner Exp $ */
/*
@@ -115,6 +115,8 @@ BOOTPLAYER bootplayer;
struct in_addr servip; /* for tftp */ /* XXX init this */
+extern char *bootmac; /* To pass to kernel */
+
/* static struct btinfo_netif bi_netif; */
/*****************************************************************************
@@ -230,7 +232,7 @@ pxe_netif_open()
}
bcopy(bootplayer.CAddr, desc.myea, ETHER_ADDR_LEN);
- addbootarg(BOOTARG_BOOTMAC, sizeof(bios_bootmac_t), bootplayer.CAddr);
+ bootmac = bootplayer.CAddr;
/*
* Since the PXE BIOS has already done DHCP, make sure we
diff --git a/sys/arch/amd64/stand/pxeboot/conf.c b/sys/arch/amd64/stand/pxeboot/conf.c
index 78f17a4ef37..8c90c92c7d1 100644
--- a/sys/arch/amd64/stand/pxeboot/conf.c
+++ b/sys/arch/amd64/stand/pxeboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.15 2007/05/30 01:25:43 tom Exp $ */
+/* $OpenBSD: conf.c,v 1.16 2007/07/27 17:48:01 tom Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -44,7 +44,7 @@
#include "pxeboot.h"
#include "pxe_net.h"
-const char version[] = "2.00";
+const char version[] = "2.01";
int debug = 0;
#undef _TEST
diff --git a/sys/arch/amd64/stand/pxeboot/devopen.c b/sys/arch/amd64/stand/pxeboot/devopen.c
index ac30c953c30..f6ba14639ac 100644
--- a/sys/arch/amd64/stand/pxeboot/devopen.c
+++ b/sys/arch/amd64/stand/pxeboot/devopen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: devopen.c,v 1.3 2007/06/27 20:29:37 mk Exp $ */
+/* $OpenBSD: devopen.c,v 1.4 2007/07/27 17:48:01 tom Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -38,6 +38,8 @@ extern char *fs_name[];
extern int nfsname;
extern struct devsw netsw[];
+extern char *bootmac; /* Gets passed to kernel for network boot */
+
/* XXX use slot for 'rd' for 'hd' pseudo-device */
const char bdevs[][4] = {
"wd", "", "fd", "", "sd", "st", "cd", "mcd",
@@ -96,6 +98,16 @@ devopen(struct open_file *f, const char *fname, char **file)
}
}
+ /*
+ * Assume that any network filesystems would be caught by the
+ * code above, so that the next phase of devopen() is only for
+ * local devices.
+ *
+ * Clear bootmac, to signal that we loaded this file from a
+ * non-network device.
+ */
+ bootmac = NULL;
+
for (i = 0; i < ndevs && rc != 0; dp++, i++) {
#ifdef DEBUG
if (debug)