--- old/usr/src/Makefile.master	2015-01-25 13:29:10.254051080 -0500
+++ new/usr/src/Makefile.master	2015-01-25 13:29:10.261803779 -0500
@@ -858,7 +858,7 @@
 arm_CCC=		$(ONBLD_TOOLS)/bin/$(NATIVE_MACH)/cw.arm -_g++
 arm_CPP=		/usr/ccs/lib/cpp
 arm_AS=			$(ONBLD_TOOLS)/bin/$(NATIVE_MACH)/aw.arm
-arm_LD=			/usr/ccs/bin/ld
+arm_LD=			/opt/armtc/usr/bin/ld
 arm_LINT=		/bin/false
 arm_CTFCONVERT=	$(ONBLD_TOOLS)/bin/$(NATIVE_MACH)/ctfconvert.arm
 arm_CTFMERGE=		$(ONBLD_TOOLS)/bin/$(NATIVE_MACH)/ctfmerge.arm
--- old/usr/src/uts/arm/sys/bootconf.h	2015-01-25 13:29:10.497721436 -0500
+++ new/usr/src/uts/arm/sys/bootconf.h	2015-01-25 13:29:10.505086854 -0500
@@ -11,6 +11,7 @@
 
 /*
  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
+ * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  */
 
 
@@ -37,10 +38,15 @@
 #define	BO_NO_ALIGN	0x00001000
 #define	BO_ALIGN_DONTCARE	-1
 
+struct bsys_mem {
+	struct memlist	physinstalled;
+};
+
 #define	BO_VERSION	1	/* bootops interface revision */
 
 typedef struct bootops {
 	uint_t	bsys_version;
+	struct bsys_mem	boot_mem;
 	caddr_t	(*bsys_alloc)(struct bootops *, caddr_t, size_t, int);
 	void	(*bsys_free)(struct bootops *, caddr_t, size_t);
 	int	(*bsys_getproplen)(struct bootops *, const char *);
--- old/usr/src/uts/armv6/bcm2835/Makefile	2015-01-25 13:29:10.723086404 -0500
+++ new/usr/src/uts/armv6/bcm2835/Makefile	2015-01-25 13:29:10.730932352 -0500
@@ -11,6 +11,7 @@
 
 #
 # Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+# Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 #
 
 UTSBASE = ../..
@@ -37,10 +38,11 @@
 #
 .KEEP_STATE:
 
-def all clean clobber clean.lint: unix .WAIT \
+def all clean clobber clean.lint: unix loader .WAIT \
 		$(BCM2835_CPU_KMODS) $(BCM2835_KMODS)
 
 modlist:	unix \
+		loader \
 		$(BCM2835_CPU_KMODS) $(BCM2835_KMODS)
 
 IMPLEMENTED_PLATFORM = Raspberry,Pi
@@ -51,9 +53,9 @@
 	$(USR_BCM2835_LIB_DIR) \
 	$(BCM2835_CRYPTO_LINKS) \
 	unix .WAIT $(BCM2835_CPU_KMODS) \
-	$(BCM2835_KMODS)
+	$(BCM2835_KMODS) loader
 
-unix $(BCM2835_KMODS) $(BCM2835_CPU_KMODS): FRC
+unix loader $(BCM2835_KMODS) $(BCM2835_CPU_KMODS): FRC
 	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
 
 install_h check:	FRC
--- old/usr/src/uts/armv6/bcm2835/Makefile.files	2015-01-25 13:29:10.920939271 -0500
+++ new/usr/src/uts/armv6/bcm2835/Makefile.files	2015-01-25 13:29:10.928364201 -0500
@@ -11,6 +11,7 @@
 
 #
 # Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+# Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 #
 
 BCM2835_OBJS =			\
@@ -18,3 +19,6 @@
 	boot_console.o		\
 	locore.o		\
 	miniuart.o
+
+BCM2835_LOADER_OBJS = \
+	bcm2835_ldep.o	
--- old/usr/src/uts/armv6/bcm2835/Makefile.rules	2015-01-25 13:29:11.120632609 -0500
+++ new/usr/src/uts/armv6/bcm2835/Makefile.rules	2015-01-25 13:29:11.128688476 -0500
@@ -11,8 +11,12 @@
 
 #
 # Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+# Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 #
 
+$(OBJS_DIR)/%.o:		$(UTSBASE)/$(PLATFORM)/bcm2835/loader/%.c
+	$(COMPILE.c) -o $@ $<
+
 $(OBJS_DIR)/%.o:		$(UTSBASE)/$(PLATFORM)/bcm2835/os/%.c
 	$(COMPILE.c) -o $@ $<
 
--- old/usr/src/uts/armv6/bcm2835/conf/Mapfile	2015-01-25 13:29:11.319572081 -0500
+++ new/usr/src/uts/armv6/bcm2835/conf/Mapfile	2015-01-25 13:29:11.326606556 -0500
@@ -16,11 +16,12 @@
 $mapfile_version 2
 
 # NB: Order matters for name-based entry!
+
 LOAD_SEGMENT exception_vector {
 	FLAGS = READ EXECUTE;
 	NOHDR;
-	PADDR = 0xFFFF0000;
 	VADDR = 0xFFFF0000;
+	ALIGN = 0x1000;
 	OS_ORDER = .exception_vector;
 	ASSIGN_SECTION { IS_NAME = .exception_vector };
 };
@@ -28,10 +29,7 @@
 LOAD_SEGMENT text {
 	FLAGS = READ EXECUTE;
 	NOHDR;
-#	PADDR = 0x8080;
-#	VADDR = 0x8080;
-	PADDR = 0x0c100000;
-	VADDR = 0x0c100000;
+	VADDR = 0xFE800000;
 	OS_ORDER = .text;
 	ASSIGN_SECTION {
 		TYPE = PROGBITS;
@@ -39,13 +37,13 @@
 	};
 };
 
+#
+# start the data segment on a new 4MB page boundary
+#
 LOAD_SEGMENT data {
 	FLAGS = READ WRITE EXECUTE;
 	NOHDR;
-#	PADDR = 0x80000;
-#	VADDR = 0x80000;
-	PADDR = 0x0c200000;
-	VADDR = 0x0c200000;
+	VADDR = 0xFEC00000;
 	OS_ORDER = .data;
 	ASSIGN_SECTION {
 		TYPE = PROGBITS;
--- /dev/null	2015-01-25 13:29:11.000000000 -0500
+++ new/usr/src/uts/armv6/bcm2835/conf/Mapfile.loader	2015-01-25 13:29:11.521042222 -0500
@@ -0,0 +1,44 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+# Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+#
+
+$mapfile_version 2
+
+# NB: Order matters for name-based entry!
+LOAD_SEGMENT text {
+	FLAGS = READ EXECUTE;
+	NOHDR;
+	PADDR = 0x8000;
+	VADDR = 0x8000;
+	MAX_SIZE = 0x2000;
+	OS_ORDER = .text.init .text;
+	ASSIGN_SECTION {
+		IS_NAME = .text.init;
+	};
+	ASSIGN_SECTION {
+		TYPE = PROGBITS;
+		FLAGS = ALLOC !WRITE;
+	};
+};
+
+LOAD_SEGMENT data {
+	FLAGS = READ WRITE;
+	NOHDR;
+	OS_ORDER = .data;
+	ASSIGN_SECTION {
+		TYPE = PROGBITS;
+		FLAGS = ALLOC WRITE;
+	};
+};
--- /dev/null	2015-01-25 13:29:11.000000000 -0500
+++ new/usr/src/uts/armv6/bcm2835/loader/Makefile	2015-01-25 13:29:11.617242506 -0500
@@ -0,0 +1,93 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+# Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+#
+
+#
+#	Path to the base of the uts directory tree (usually /usr/src/uts).
+#
+UTSBASE	= ../../..
+
+#
+#	Define the module and object file sets.
+#
+LOADER		= loader
+LOADER_BIN	= $(OBJS_DIR)/$(LOADER)
+LOADER_ELF	= $(LOADER).elf
+LOADER_ELF_BIN	= $(OBJS_DIR)/$(LOADER_ELF)
+ROOTMODULE	= $(ROOT_BCM2835_KERN_DIR)/$(LOADER)
+OBJECTS		= $(ARM_LOADER_OBJS:%=$(OBJS_DIR)/%) \
+		  $(BCM2835_LOADER_OBJS:%=$(OBJS_DIR)/%)
+
+#
+#	Include common rules.
+#
+include $(UTSBASE)/armv6/bcm2835/Makefile.bcm2835
+
+#
+#	Define targets
+#
+ALL_TARGET	= $(LOADER_BIN)
+INSTALL_TARGET	= $(LOADER_BIN) $(ROOTMODULE)
+
+#
+#	Overrides
+#
+CLEANFILES	+= $(OBJECTS)
+
+CLOBBERFILES	= $(CLEANFILES) $(LOADER_BIN)
+
+CFLAGS 		+= $(CCVERBOSE) \
+		-DELF_TARGET_ARM
+
+CERRWARN	+= -_gcc=-Wno-parentheses
+CERRWARN	+= -_gcc=-Wno-uninitialized
+CERRWARN	+= -_gcc=-Wno-unused-label
+CERRWARN	+= -_gcc=-Wno-unused-function
+CERRWARN	+= -_gcc=-Wno-unused-variable
+CERRWARN	+= -_gcc=-Wno-unused-but-set-variable
+
+# The mapfile used to link unix
+MAPFILE		= $(UTSBASE)/armv6/bcm2835/conf/Mapfile.loader
+
+#
+#	Default build targets.
+#
+.KEEP_STATE:
+
+def:		$(DEF_DEPS)
+
+all:		$(ALL_DEPS)
+
+clean:		$(CLEAN_DEPS)
+
+clobber:	$(CLOBBER_DEPS)
+
+install:  	$(INSTALL_DEPS)
+
+symcheck:       $(SYM_DEPS)
+
+$(LOADER_ELF_BIN): $(OBJECTS)
+	$(LD) -dy -b -znointerp -o $@ -e _start -M $(MAPFILE) \
+	$(OBJECTS)
+	$(CTFMERGE) $(CTFMRGFLAGS) -L VERSION -o $(LOADER_ELF_BIN) $(OBJECTS)
+
+$(LOADER_BIN): $(LOADER_ELF_BIN)
+	/opt/armtc/usr/gnu/bin/gobjcopy $(LOADER_ELF_BIN) -O binary $(LOADER_BIN)
+
+
+#
+#	Include common targets.
+#
+include $(UTSBASE)/armv6/bcm2835/Makefile.targ
--- /dev/null	2015-01-25 13:29:11.000000000 -0500
+++ new/usr/src/uts/armv6/bcm2835/loader/bcm2835_ldep.c	2015-01-25 13:29:11.712181256 -0500
@@ -0,0 +1,184 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
+ * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ */
+
+#include <sys/elf.h>
+#include <sys/atag.h>
+
+/*
+ * The primary serial console that we end up using is not in fact a normal UART,
+ * but is instead actually a mini-uart that shares interrupts and registers with
+ * the SPI masters as well. While the RPi also supports another more traditional
+ * UART, that isn't what we are actually hooking up to generally with the
+ * adafruit cable. We already wasted our time having to figure that out. -_-
+ */
+
+#define	AUX_BASE	0x20215000
+#define	AUX_ENABLES	0x4
+#define	AUX_MU_IO_REG	0x40
+#define	AUX_MU_IER_REG	0x44
+#define	AUX_MU_IIR_REG	0x48
+#define	AUX_MU_LCR_REG	0x4C
+#define	AUX_MU_MCR_REG	0x50
+#define	AUX_MU_LSR_REG	0x54
+#define	AUX_MU_CNTL_REG	0x60
+#define	AUX_MU_BAUD	0x68
+
+#define	AUX_MU_RX_READY	0x01
+#define	AUX_MU_TX_READY	0x20
+
+/*
+ * For the mini UART, all we care about are pins 14 and 15 for the UART.
+ * Specifically, alt5 for GPIO14 is TXD1 and GPIO15 is RXD1. Those are
+ * controlled by FSEL1.
+ */
+#define	GPIO_BASE	0x20200000
+#define	GPIO_FSEL1	0x4
+#define	GPIO_PUD	0x94
+#define	GPIO_PUDCLK0	0x98
+
+#define	GPIO_SEL_ALT5	0x2
+#define	GPIO_UART_MASK	0xfffc0fff
+#define	GPIO_UART_TX_SHIFT	12
+#define	GPIO_UART_RX_SHIFT	15
+
+#define	GPIO_PUD_DISABLE	0x0
+#define	GPIO_PUDCLK_UART	0x0000c000
+
+static __GNU_INLINE uint32_t arm_reg_read(uint32_t reg)
+{
+	volatile uint32_t *ptr = (volatile uint32_t *)reg;
+
+	return *ptr;
+}
+
+static __GNU_INLINE void arm_reg_write(uint32_t reg, uint32_t val)
+{
+	volatile uint32_t *ptr = (volatile uint32_t *)reg;
+
+	*ptr = val;
+}
+
+/*
+ * A simple nop
+ */
+static void
+bcm2835_miniuart_nop(void)
+{
+	__asm__ volatile("mov r0, r0\n" : : :);
+}
+
+void fakeload_backend_putc(int);
+
+static void
+fakeload_puts(const char *str)
+{
+	while (*str != '\0') {
+		fakeload_backend_putc(*str);
+		str++;
+	}
+}
+
+void
+fakeload_backend_init(void)
+{
+	uint32_t v;
+	int i;
+
+	/* Enable the mini UAT */
+	arm_reg_write(AUX_BASE + AUX_ENABLES, 0x1);
+
+	/* Disable interrupts */
+	arm_reg_write(AUX_BASE + AUX_MU_IER_REG, 0x0);
+
+	/* Disable the RX and TX */
+	arm_reg_write(AUX_BASE + AUX_MU_CNTL_REG, 0x0);
+
+	/*
+	 * Enable 8-bit word length. External sources tell us the PRM is buggy
+	 * here and that even though bit 1 is reserved, we need to actually set
+	 * it to get 8-bit words.
+	 */
+	arm_reg_write(AUX_BASE + AUX_MU_LCR_REG, 0x3);
+
+	/* Set RTS high */
+	arm_reg_write(AUX_BASE + AUX_MU_MCR_REG, 0x0);
+
+	/* Disable interrupts */
+	arm_reg_write(AUX_BASE + AUX_MU_IER_REG, 0x0);
+
+	/* Set baud rate */
+	arm_reg_write(AUX_BASE + AUX_MU_IIR_REG, 0xc6);
+	arm_reg_write(AUX_BASE + AUX_MU_BAUD, 0x10e);
+
+	/* TODO: Factor out the gpio bits */
+	v = arm_reg_read(GPIO_BASE + GPIO_FSEL1);
+	v &= GPIO_UART_MASK;
+	v |= GPIO_SEL_ALT5 << GPIO_UART_RX_SHIFT;
+	v |= GPIO_SEL_ALT5 << GPIO_UART_TX_SHIFT;
+	arm_reg_write(GPIO_BASE + GPIO_FSEL1, v);
+
+	arm_reg_write(GPIO_BASE + GPIO_PUD, GPIO_PUD_DISABLE);
+	for (i = 0; i < 150; i++)
+		bcm2835_miniuart_nop();
+	arm_reg_write(GPIO_BASE + GPIO_PUDCLK0, GPIO_PUDCLK_UART);
+	for (i = 0; i < 150; i++)
+		bcm2835_miniuart_nop();
+	// XXX: GPIO_PUD_DISABLE again?
+	arm_reg_write(GPIO_BASE + GPIO_PUDCLK0, 0);
+
+	/* Finally, go back and enable RX and TX */
+	arm_reg_write(AUX_BASE + AUX_MU_CNTL_REG, 0x3);
+}
+
+void
+fakeload_backend_putc(int c)
+{
+	if (c == '\n')
+		fakeload_backend_putc('\r');
+
+	for (;;) {
+		if (arm_reg_read(AUX_BASE + AUX_MU_LSR_REG) & AUX_MU_TX_READY)
+			break;
+	}
+	arm_reg_write(AUX_BASE + AUX_MU_IO_REG, c & 0x7f);
+}
+
+/*
+ * Add a map for the uart.
+ */
+void
+fakeload_backend_addmaps(atag_header_t *chain)
+{
+	atag_illumos_mapping_t aim;
+
+	aim.aim_header.ah_size = ATAG_ILLUMOS_MAPPING_SIZE;
+	aim.aim_header.ah_tag = ATAG_ILLUMOS_MAPPING;
+	aim.aim_paddr = GPIO_BASE;
+	aim.aim_vaddr = GPIO_BASE;
+	aim.aim_vlen = 0x1000;
+	aim.aim_plen = 0x1000;
+	aim.aim_mapflags = PF_R | PF_W | PF_NORELOC | PF_DEVICE;
+	atag_append(chain, &aim.aim_header);
+
+	aim.aim_header.ah_size = ATAG_ILLUMOS_MAPPING_SIZE;
+	aim.aim_header.ah_tag = ATAG_ILLUMOS_MAPPING;
+	aim.aim_paddr = AUX_BASE;
+	aim.aim_vaddr = AUX_BASE;
+	aim.aim_vlen = 0x1000;
+	aim.aim_plen = 0x1000;
+	aim.aim_mapflags = PF_R | PF_W | PF_NORELOC | PF_DEVICE;
+	atag_append(chain, &aim.aim_header);
+}
--- old/usr/src/uts/armv6/bcm2835/ml/locore.s	2015-01-25 13:29:11.808054123 -0500
+++ new/usr/src/uts/armv6/bcm2835/ml/locore.s	2015-01-25 13:29:11.815945976 -0500
@@ -11,6 +11,7 @@
 
 /*
  * Copyright 2013 (c) Joyent, Inc. All rights reserved.
+ * Copyright 2015 (c) Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  */
 
 #include <sys/asm_linkage.h>
@@ -101,13 +102,11 @@
 	bic	r3, r3, #2
 	mcr	p15, 0, r3, c1, c0, 0
 
-	/*
-	 * XXX Currently we're using u-boot to allow us to make forward progress
-	 * while the .data section is a bit tumultuous. It loads that, but we
-	 * can say for certain that it does not correctly pass in the machid and
-	 * tagstart. Since we know what it is, we manually fix it up here.
-	 */
-	mov r2,#0x100
+	/* Enable access to p10 and p11 (privileged mode only) */
+	mrc	p15, 0, r0, c1, c0, 2
+	orr	r0, #0x00500000
+	mcr	p15, 0, r0, c1, c0, 2
+
 	bl _fakebop_start
 	SET_SIZE(_start)
 
--- old/usr/src/uts/armv6/bcm2835/unix/Makefile	2015-01-25 13:29:12.010761021 -0500
+++ new/usr/src/uts/armv6/bcm2835/unix/Makefile	2015-01-25 13:29:12.019801282 -0500
@@ -22,6 +22,7 @@
 #
 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
+# Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 #
 
 #
@@ -50,6 +51,11 @@
 
 CTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
 
+ARCHIVE		= boot_archive
+
+INITRD		= initrd
+BOOT_MODULE	= $(ROOT_BCM2835_KERN_DIR)/$(INITRD)
+INITRD_BIN	= $(OBJS_DIR)/$(INITRD)
 
 #
 #	Include common rules.
@@ -60,7 +66,7 @@
 #	Define targets
 #
 ALL_TARGET	= $(UNIX_BIN)
-INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE)
+INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE) $(BOOT_MODULE)
 
 #
 #	This is UNIX_DIR. Use a short path.
@@ -87,6 +93,10 @@
 # The mapfile used to link unix
 MAPFILE		= $(UTSBASE)/armv6/bcm2835/conf/Mapfile
 
+# Tools to build the platform and loader kernel.
+MKPLATFORM	= $(UTSBASE)/$(PLATFORM)/tools/mkplatform
+MKUNI		= $(UTSBASE)/$(PLATFORM)/tools/mkuni
+
 #
 #	Default build targets.
 #
@@ -100,12 +110,7 @@
 
 clobber:	$(CLOBBER_DEPS)
 
-MKPLATFORM	= $(UTSBASE)/$(PLATFORM)/tools/mkplatform.sh
-
-install:  	$(INSTALL_DEPS)
-	pfexec $(MKPLATFORM) -u $(ROOT_BCM2835_MOD_DIR:$(ROOT)/%=/%) $(UNIX_BIN) \
-	    $(GENUNIX_DIR)/$(OBJS_DIR)/genunix
-	$(MV) boot_archive $(OBJS_DIR)/
+install:  	$(INSTALL_DEPS) $(MKPLATFORM) $(MKUNI)
 
 symcheck:       $(SYM_DEPS)
 
@@ -125,6 +130,15 @@
 $(KRTLD_O):	$(KRTLD_OBJECTS)
 	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
 
+$(MKPLATFORM) $(MKUNI):
+	cd ../../tools && pwd && dmake
+
+$(INITRD_BIN): $(MKPLATFORM) $(MKUNI) $(UNIX_BIN) $(GENUNIX_DIR)/$(OBJS_DIR)/$(GENUNIX)
+	pfexec $(MKPLATFORM) -u $(ROOT_BCM2835_MOD_DIR:$(ROOT)/%=/%) $(UNIX_BIN) \
+	    $(GENUNIX_DIR)/$(OBJS_DIR)/$(GENUNIX)
+	$(MV) $(ARCHIVE) $(OBJS_DIR)/
+	$(MKUNI) $(UNIX_BIN) $(OBJS_DIR)/$(ARCHIVE) $(OBJS_DIR)/$(INITRD)
+
 #
 #	Include common targets.
 #
--- old/usr/src/uts/armv6/loader/fakeloader.c	2015-01-25 13:29:12.216190448 -0500
+++ new/usr/src/uts/armv6/loader/fakeloader.c	2015-01-25 13:29:12.224161096 -0500
@@ -11,6 +11,7 @@
 
 /*
  * Copyright (c) 2014 Joyent, Inc.  All rights reserved.
+ * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  */
 
 #include "fakeloader.h"
@@ -707,6 +708,6 @@
 	armv6_icache_enable();
 
 	/* we should never come back */
-	fakeload_exec(unix_start);
+	fakeload_exec(ident, ident2, chain, unix_start);
 	fakeload_panic("hit the end of the world\n");
 }
--- old/usr/src/uts/armv6/loader/fakeloader.h	2015-01-25 13:29:12.439919874 -0500
+++ new/usr/src/uts/armv6/loader/fakeloader.h	2015-01-25 13:29:12.447749466 -0500
@@ -11,6 +11,7 @@
 
 /*
  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
+ * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  */
 
 #ifndef _FAKELOADER_H
@@ -53,7 +54,7 @@
 extern void fakeload_unaligned_enable(void);
 extern void fakeload_mmu_enable(void);
 extern void fakeload_pt_setup(uintptr_t);
-extern void fakeload_exec(uintptr_t);
+extern void fakeload_exec(void *, void *, atag_header_t *, uintptr_t);
 
 extern void armv6_dcache_disable(void);
 extern void armv6_dcache_enable(void);
--- old/usr/src/uts/armv6/loader/fakeloader_core.s	2015-01-25 13:29:12.640640689 -0500
+++ new/usr/src/uts/armv6/loader/fakeloader_core.s	2015-01-25 13:29:12.648741668 -0500
@@ -11,6 +11,7 @@
 
 /*
  * Copyright 2013 (c) Joyent, Inc. All rights reserved.
+ * Copyright 2015 (c) Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  */
 
 /*
@@ -19,7 +20,15 @@
 
 #include <sys/asm_linkage.h>
 
-	ENTRY(_start)
+/*
+ * We put _start into the .text.init section so we can more easily shove it
+ * at the front of the .text.
+ */
+	.section .text.init
+	.align	4
+	.globl	_start
+	.type	_start, %function
+_start:
 	mov	sp, #0x8000
 	/*
 	 * XXX manually fix up the tag start
@@ -102,9 +111,7 @@
 
 
 	ENTRY(fakeload_exec)
-	mov	r4, r0
-	mov	r2, #0x100
-	blx	r4
+	blx	r3
 	/* We should never execute this. If we do we'll go back to a panic */
 	bx	lr
 	SET_SIZE(fakeload_exec)
--- old/usr/src/uts/armv6/os/fakebop.c	2015-01-25 13:29:12.843808341 -0500
+++ new/usr/src/uts/armv6/os/fakebop.c	2015-01-25 13:29:12.851386067 -0500
@@ -88,8 +88,6 @@
  */
 typedef struct bootinfo {
 	uint_t		bi_flags;
-	uint32_t	bi_memsize;
-	uint32_t	bi_memstart;
 	char 		*bi_cmdline;
 	uint32_t	bi_ramdisk;
 	uint32_t	bi_ramsize;
@@ -375,8 +373,10 @@
 				break;
 			}
 
-			bp->bi_memsize = amp->am_size;
-			bp->bi_memstart = amp->am_start;
+			bootop.boot_mem.physinstalled.ml_address = amp->am_start;
+			bootop.boot_mem.physinstalled.ml_size = amp->am_size;
+			bootop.boot_mem.physinstalled.ml_prev = NULL;
+			bootop.boot_mem.physinstalled.ml_next = NULL;
 			got_mem = B_TRUE;
 			break;
 		case ATAG_CMDLINE:
