-/* $OpenBSD: autoconf.c,v 1.8 2018/01/27 22:55:23 naddy Exp $ */
+/* $OpenBSD: autoconf.c,v 1.9 2018/02/06 20:35:21 naddy Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
*
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/reboot.h>
+#include <sys/socket.h>
#include <sys/hibernate.h>
#include <uvm/uvm.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+
#include <machine/bootconfig.h>
extern void dumpconf(void);
size_t len;
char *p;
dev_t tmpdev;
+ extern uint8_t *bootmac;
if (*boot_file != '\0')
printf("bootfile: %s\n", boot_file);
bootdv = parsedisk(boot_file, len, 0, &tmpdev);
}
+#if defined(NFSCLIENT)
+ if (bootmac) {
+ struct ifnet *ifp;
+
+ TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ if (ifp->if_type == IFT_ETHER &&
+ memcmp(bootmac, ((struct arpcom *)ifp)->ac_enaddr,
+ ETHER_ADDR_LEN) == 0)
+ break;
+ }
+ if (ifp)
+ bootdv = parsedisk(ifp->if_xname, strlen(ifp->if_xname),
+ 0, &tmpdev);
+ }
+#endif
+
if (bootdv != NULL)
printf("boot device: %s\n", bootdv->dv_xname);
else
-/* $OpenBSD: machdep.c,v 1.28 2018/01/31 23:23:16 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.29 2018/02/06 20:35:21 naddy Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
*
char *boot_args = NULL;
char *boot_file = "";
+uint8_t *bootmac = NULL;
+
extern uint64_t esym;
int stdout_node = 0;
node = fdt_find_node("/chosen");
if (node != NULL) {
- char *args, *duid, *prop;
+ char *prop;
int len;
+ static uint8_t lladdr[6];
- len = fdt_node_property(node, "bootargs", &args);
+ len = fdt_node_property(node, "bootargs", &prop);
if (len > 0)
- collect_kernel_args(args);
+ collect_kernel_args(prop);
- len = fdt_node_property(node, "openbsd,bootduid", &duid);
+ len = fdt_node_property(node, "openbsd,bootduid", &prop);
if (len == sizeof(bootduid))
- memcpy(bootduid, duid, sizeof(bootduid));
+ memcpy(bootduid, prop, sizeof(bootduid));
+
+ len = fdt_node_property(node, "openbsd,bootmac", &prop);
+ if (len == sizeof(lladdr)) {
+ memcpy(lladdr, prop, sizeof(lladdr));
+ bootmac = lladdr;
+ }
len = fdt_node_property(node, "openbsd,uefi-mmap-start", &prop);
if (len == sizeof(mmap_start))
-/* $OpenBSD: conf.c,v 1.11 2018/01/30 20:19:06 naddy Exp $ */
+/* $OpenBSD: conf.c,v 1.12 2018/02/06 20:35:21 naddy Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
#include "efidev.h"
#include "efipxe.h"
-const char version[] = "0.10";
+const char version[] = "0.11";
int debug = 0;
struct fs_ops file_system[] = {
-/* $OpenBSD: efiboot.c,v 1.14 2018/01/21 21:35:34 patrick Exp $ */
+/* $OpenBSD: efiboot.c,v 1.15 2018/02/06 20:35:21 naddy Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
"simple-framebuffer", strlen("simple-framebuffer") + 1);
}
+char *bootmac = NULL;
static EFI_GUID fdt_guid = FDT_TABLE_GUID;
#define efi_guidcmp(_a, _b) memcmp((_a), (_b), sizeof(EFI_GUID))
sizeof(bootduid));
}
+ /* Pass netboot interface address. */
+ if (bootmac)
+ fdt_node_add_property(node, "openbsd,bootmac", bootmac, 6);
+
/* Pass EFI system table. */
fdt_node_add_property(node, "openbsd,uefi-system-table",
&uefi_system_table, sizeof(uefi_system_table));
-/* $OpenBSD: efipxe.c,v 1.2 2018/01/30 20:19:06 naddy Exp $ */
+/* $OpenBSD: efipxe.c,v 1.3 2018/02/06 20:35:21 naddy Exp $ */
/*
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
*
extern EFI_BOOT_SERVICES *BS;
extern EFI_DEVICE_PATH *efi_bootdp;
+extern char *bootmac;
static UINT8 boothw[16];
static EFI_IP_ADDRESS bootip, servip;
static EFI_GUID devp_guid = DEVICE_PATH_PROTOCOL;
memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
memcpy(boothw, dhcp->BootpHwAddr, sizeof(boothw));
+ bootmac = boothw;
PXE = pxe;
break;
}