changeset 9:e6715e03b87a

can use efi 64 bit.
author taiki
date Wed, 16 Jan 2013 01:33:09 +0900
parents d390aa667e3c
children 6c0c504fddae 19d073459374
files boot/Makefile boot/bootx64.c boot/bootx64.efi
diffstat 3 files changed, 20 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/boot/Makefile	Wed Dec 26 14:40:17 2012 +0900
+++ b/boot/Makefile	Wed Jan 16 01:33:09 2013 +0900
@@ -1,39 +1,32 @@
-LD	= /home/taiki/local/bin/ld
-OBJCOPY	= /home/taiki/local/bin/objcopy
-
-
-
-ARCH	=$(shell uname -m |sed s,i[3456789]86,ia32,)
-LIB_PATH	= /usr/lib64
-EFI_INCLUDE	= /usr/include/efi
-EFI_INCLUDES	= -nostdinc -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol
-
-EFI_PATH        = /usr/lib64/gnuefi
+ARCH            = $(shell uname -m | sed s,i[3456789]86,ia32,)
+EFI_INCLUDE     = /usr/local/include/efi
+EFI_INCLUDES    = -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol
+EFI_PATH        = /usr/local/lib
+LIB_GCC         = $(shell $(CC) -print-libgcc-file-name)
+EFI_LIBS        = -lefi -lgnuefi $(LIB_GCC)
 EFI_CRT_OBJS    = $(EFI_PATH)/crt0-efi-$(ARCH).o
 EFI_LDS         = $(EFI_PATH)/elf_$(ARCH)_efi.lds
+CFLAGS          = -O2 -fno-stack-protector -fno-strict-aliasing -fpic -fshort-wchar -Wall -Werror $(EFI_INCLUDES)
 
-CFLAGS          = -O2 -Wall -fno-stack-protector -fpic -fshort-wchar -mno-red-zone $(EFI_INCLUDES)
 ifeq ($(ARCH),x86_64)
 	CFLAGS  += -DEFI_FUNCTION_WRAPPER
 endif
 
-LDFLAGS         = -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L$(EFI_PATH) -L$(LIB_PATH) \
-                  $(EFI_CRT_OBJS) -lefi -lgnuefi
-
-TARGET  = bootx64.efi
-OBJS    = bootx64.o
-SOURCES = bootx64.c
+LDFLAGS         = -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L$(EFI_PATH) $(EFI_CRT_OBJS)
+TARGET          = bootx64.efi
+OBJS            = bootx64.o
 
 all: $(TARGET)
 
-bootx64.so: $(OBJS)
-	$(LD) -o $@ $(LDFLAGS) $^ $(EFI_LIBS)
+bootx64.efi: $(OBJS)
 
-%.efi: %.so
-	$(OBJCOPY) -j .text -j .sdata -j .data \
-                -j .dynamic -j .dynsym  -j .rel \
-                -j .rela -j .reloc -j .eh_frame \
-                --target=efi-app-$(ARCH) $^ $@
+%.efi: %.o 
+	$(LD) $(LDFLAGS) $^ -o $@ $(EFI_LIBS)
+	objcopy -j .text -j .sdata -j .data \
+	-j .dynamic -j .dynsym  -j .rel \
+	-j .rela -j .reloc \
+	--target=efi-app-$(ARCH) $@ 
+	strip $@
 
 clean:
-	rm -rf $(TARGET) *.o *.so
+	rm -f $(TARGET) $(OBJS)
--- a/boot/bootx64.c	Wed Dec 26 14:40:17 2012 +0900
+++ b/boot/bootx64.c	Wed Jan 16 01:33:09 2013 +0900
@@ -27,5 +27,6 @@
     Print(L"Image size: %lx\n", loaded_image->ImageSize);
     Print(L"Image file: %s\n", DevicePathToStr(loaded_image->FilePath));
 */
+    Print(L"Hello, World\n");
     return EFI_SUCCESS;
 }
Binary file boot/bootx64.efi has changed