Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 May 2014 16:47:55 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266893 - head/sys/boot/mips/beri/loader
Message-ID:  <201405301647.s4UGlt2d055490@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri May 30 16:47:54 2014
New Revision: 266893
URL: http://svnweb.freebsd.org/changeset/base/266893

Log:
  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

Modified:
  head/sys/boot/mips/beri/loader/Makefile
  head/sys/boot/mips/beri/loader/loader.ldscript
  head/sys/boot/mips/beri/loader/main.c

Modified: head/sys/boot/mips/beri/loader/Makefile
==============================================================================
--- head/sys/boot/mips/beri/loader/Makefile	Fri May 30 16:44:03 2014	(r266892)
+++ head/sys/boot/mips/beri/loader/Makefile	Fri May 30 16:47:54 2014	(r266893)
@@ -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>

Modified: head/sys/boot/mips/beri/loader/loader.ldscript
==============================================================================
--- head/sys/boot/mips/beri/loader/loader.ldscript	Fri May 30 16:44:03 2014	(r266892)
+++ head/sys/boot/mips/beri/loader/loader.ldscript	Fri May 30 16:47:54 2014	(r266893)
@@ -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 = .;

Modified: head/sys/boot/mips/beri/loader/main.c
==============================================================================
--- head/sys/boot/mips/beri/loader/main.c	Fri May 30 16:44:03 2014	(r266892)
+++ head/sys/boot/mips/beri/loader/main.c	Fri May 30 16:47:54 2014	(r266893)
@@ -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
 };
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405301647.s4UGlt2d055490>