aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/mips
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2014-05-30 16:47:54 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2014-05-30 16:47:54 +0000
commitb589760a6fd60b780c88df186096cacc7b4c7077 (patch)
treea61aadf3a616705410993fc75fccafa340ac0b51 /sys/boot/mips
parent4be86ee126a8a10a10f9b2181bf3f35a9d44cda8 (diff)
downloadsrc-b589760a6fd60b780c88df186096cacc7b4c7077.tar.gz
src-b589760a6fd60b780c88df186096cacc7b4c7077.zip
Add optional support for USB to BERI loader. Fix the linker script so
that the garbage collection feature can be used when linking. Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/head/; revision=266893
Diffstat (limited to 'sys/boot/mips')
-rw-r--r--sys/boot/mips/beri/loader/Makefile11
-rw-r--r--sys/boot/mips/beri/loader/loader.ldscript13
-rw-r--r--sys/boot/mips/beri/loader/main.c7
3 files changed, 27 insertions, 4 deletions
diff --git a/sys/boot/mips/beri/loader/Makefile b/sys/boot/mips/beri/loader/Makefile
index fed224712ccd..3da7f7f274b3 100644
--- a/sys/boot/mips/beri/loader/Makefile
+++ b/sys/boot/mips/beri/loader/Makefile
@@ -136,6 +136,17 @@ FILES+= loader.rc
FILES+= menu.rc
.endif
+.if defined(LOADER_USB_SUPPORT)
+# Do garbage collection
+CFLAGS+= -ffunction-sections -fdata-sections
+CFLAGS+= -Wl,--gc-sections
+# Link USB BOOT library
+LDADD+= ${.OBJDIR}/../../../usb/libusbboot.a
+CFLAGS+= -I${.CURDIR}/../../../usb
+# Define USB SUPPORT
+CFLAGS+= -DLOADER_USB_SUPPORT
+.endif
+
all: loader
.include <bsd.prog.mk>
diff --git a/sys/boot/mips/beri/loader/loader.ldscript b/sys/boot/mips/beri/loader/loader.ldscript
index 769bbbe15bcc..4d1c82ddd4fb 100644
--- a/sys/boot/mips/beri/loader/loader.ldscript
+++ b/sys/boot/mips/beri/loader/loader.ldscript
@@ -58,11 +58,16 @@ SECTIONS
. += SIZEOF_HEADERS;
.text ALIGN(0x8): {
- start.o(.text)
- *(EXCLUDE_FILE (start.o) .text)
+ start.o(.text*)
+ *(EXCLUDE_FILE (start.o) .text*)
+ *(.rodata*)
+
+ __start_set_Xcommand_set = .;
+ KEEP(*(set_Xcommand_set))
+ __stop_set_Xcommand_set = .;
}
- .data ALIGN(0x8): { *(.data)}
- .bss ALIGN(0x8): { *(.bss) }
+ .data ALIGN(0x8): { *(.data*)}
+ .bss ALIGN(0x8): { *(.bss*) }
__heap = ALIGN(0x8); /* 64-bit aligned heap pointer */
__data_end = .;
diff --git a/sys/boot/mips/beri/loader/main.c b/sys/boot/mips/beri/loader/main.c
index 2354614176db..a8e3424aa8ce 100644
--- a/sys/boot/mips/beri/loader/main.c
+++ b/sys/boot/mips/beri/loader/main.c
@@ -43,12 +43,19 @@ __FBSDID("$FreeBSD$");
#include <loader.h>
#include <mips.h>
+#ifdef LOADER_USB_SUPPORT
+#include <storage/umass_common.h>
+#endif
+
static int __elfN(exec)(struct preloaded_file *);
static void extract_currdev(struct bootinfo *);
struct devsw *devsw[] = {
&beri_cfi_disk,
&beri_sdcard_disk,
+#ifdef LOADER_USB_SUPPORT
+ &umass_disk,
+#endif
NULL
};