Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 May 2012 14:56:21 +0000
From:      emc2@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r236816 - in soc2012/emc2: experimental head/sys/boot/i386/efi
Message-ID:  <20120531145621.0A286106566B@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emc2
Date: Thu May 31 14:56:20 2012
New Revision: 236816
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236816

Log:
  Added directory for experiments

Added:
  soc2012/emc2/experimental/
  soc2012/emc2/experimental/Makefile
  soc2012/emc2/experimental/helloworld.c
  soc2012/emc2/experimental/ldscript.i386
Modified:
  soc2012/emc2/head/sys/boot/i386/efi/Makefile

Added: soc2012/emc2/experimental/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2012/emc2/experimental/Makefile	Thu May 31 14:56:20 2012	(r236816)
@@ -0,0 +1,18 @@
+CC=clang
+CFLAGS=-O2 -m32 -I../head/sys/boot/efi/include/ -I../head/sys/boot/efi/include/i386
+OBJCOPY=objcopy
+EFIFORMAT=efi-app-ia32
+LDSCRIPT=ldscript.i386
+
+all: helloworld.efi
+
+helloworld.o: helloworld.c
+	${CC} -c ${CFLAGS} helloworld.c
+
+helloworld: helloworld.o
+	${LD} -T ${LDSCRIPT} -shared -symbolic -o helloworld helloworld.o
+
+helloworld.efi: helloworld
+	${OBJCOPY} -j .data -j .dynamic -j .dynstr -j .dynsym -j .hash \
+	    -j .rel.dyn -j .reloc -j .sdata -j .text -j set_Xcommand_set \
+	    --target=${EFIFORMAT} ${.ALLSRC} helloworld.efi
\ No newline at end of file

Added: soc2012/emc2/experimental/helloworld.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2012/emc2/experimental/helloworld.c	Thu May 31 14:56:20 2012	(r236816)
@@ -0,0 +1,12 @@
+#include <efi.h>
+
+unsigned short str[] =
+  { 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '\n', '\r', 0 };
+
+EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systab)
+{
+
+  systab->ConOut->OutputString(systab->ConOut, str);
+
+  return EFI_SUCCESS;
+}

Added: soc2012/emc2/experimental/ldscript.i386
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2012/emc2/experimental/ldscript.i386	Thu May 31 14:56:20 2012	(r236816)
@@ -0,0 +1,72 @@
+/* $FreeBSD: soc2012/emc2/head/sys/boot/i386/efi/ldscript.i386 206419 2010-04-07 18:16:05Z rpaulo $ */
+OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = 0;
+  ImageBase = .;
+  . = SIZEOF_HEADERS;
+  . = ALIGN(4096);
+  .text		: {
+    *(.text .stub .text.* .gnu.linkonce.t.*)
+    /* .gnu.warning sections are handled specially by elf32.em. */
+    *(.gnu.warning)
+    *(.plt)
+  } =0x00300000010070000002000001000400
+  . = ALIGN(4096);
+  .data		: {
+    *(.rodata .rodata.* .gnu.linkonce.r.*)
+    *(.rodata1)
+    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
+    *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
+    *(.opd)
+    *(.data .data.* .gnu.linkonce.d.*)
+    *(.data1)
+    *(.plabel)
+    *(.dynbss)
+    *(.bss .bss.* .gnu.linkonce.b.*)
+    *(COMMON)
+  }
+  . = ALIGN(4096);
+  set_Xcommand_set	: {
+    __start_set_Xcommand_set = .;
+    *(set_Xcommand_set)
+    __stop_set_Xcommand_set = .;
+  }
+  . = ALIGN(4096);
+  __gp = .;
+  .sdata	: {
+    *(.got.plt .got)
+    *(.sdata .sdata.* .gnu.linkonce.s.*)
+    *(dynsbss)
+    *(.sbss .sbss.* .gnu.linkonce.sb.*)
+    *(.scommon)
+  }
+  . = ALIGN(4096);
+  .dynamic	: { *(.dynamic) }
+  . = ALIGN(4096);
+  .rel.dyn	: {
+    *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
+    *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
+    *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
+    *(.rel.got)
+    *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
+    *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
+    *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
+    *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
+    *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
+    *(.rel.plt)
+    *(.relset_*)
+    *(.rel.dyn .rel.dyn.*)
+  }
+  . = ALIGN(4096);
+  .reloc	: { *(.reloc) }
+  . = ALIGN(4096);
+  .hash		: { *(.hash) }
+  . = ALIGN(4096);
+  .dynsym	: { *(.dynsym) }
+  . = ALIGN(4096);
+  .dynstr	: { *(.dynstr) }
+}

Modified: soc2012/emc2/head/sys/boot/i386/efi/Makefile
==============================================================================
--- soc2012/emc2/head/sys/boot/i386/efi/Makefile	Thu May 31 14:51:21 2012	(r236815)
+++ soc2012/emc2/head/sys/boot/i386/efi/Makefile	Thu May 31 14:56:20 2012	(r236816)
@@ -22,14 +22,15 @@
 CFLAGS+=	-I.
 LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${TARGET_ARCH} == "amd64"
 SRCS+= elf64_freebsd.c
 EFIFORMAT=	efi-app-x86_64
-.elif ${MACHINE_CPUARCH} == "i386"
+.error Compiling for amd64!
+.elif ${TARGET_ARCH} == "i386"
 SRCS+=	elf32_freebsd.c
 EFIFORMAT=	efi-app-ia32
 .else
-.error "MACHINE_CPUARCH is ${MACHINE_CPUARCH} (not amd64 or i386)"
+.error "TARGET_ARCH is ${MACHINE_CPUARCH} (not amd64 or i386)"
 .endif
 # Include bcache code.
 HAVE_BCACHE=    yes



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