changeset 8:d390aa667e3c

program test.
author taiki
date Wed, 26 Dec 2012 14:40:17 +0900
parents c778c27450cc
children e6715e03b87a
files boot/Makefile boot/bootx64.c boot/bootx64.efi
diffstat 3 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/boot/Makefile	Wed Dec 19 01:10:08 2012 +0900
+++ b/boot/Makefile	Wed Dec 26 14:40:17 2012 +0900
@@ -1,3 +1,8 @@
+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
@@ -7,7 +12,7 @@
 EFI_CRT_OBJS    = $(EFI_PATH)/crt0-efi-$(ARCH).o
 EFI_LDS         = $(EFI_PATH)/elf_$(ARCH)_efi.lds
 
-CFLAGS          = -fno-stack-protector -fpic -fshort-wchar -mno-red-zone $(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
@@ -25,7 +30,7 @@
 	$(LD) -o $@ $(LDFLAGS) $^ $(EFI_LIBS)
 
 %.efi: %.so
-	objcopy -j .text -j .sdata -j .data \
+	$(OBJCOPY) -j .text -j .sdata -j .data \
                 -j .dynamic -j .dynsym  -j .rel \
                 -j .rela -j .reloc -j .eh_frame \
                 --target=efi-app-$(ARCH) $^ $@
--- a/boot/bootx64.c	Wed Dec 19 01:10:08 2012 +0900
+++ b/boot/bootx64.c	Wed Dec 26 14:40:17 2012 +0900
@@ -1,12 +1,31 @@
 #include <efi.h>
 #include <efilib.h>
 
-
 EFI_STATUS
 efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *system_table)
 {
     InitializeLib(image, system_table);
-    Print(L"Hello, World\n\r");
-    EFI_STATUS ret = EFI_SUCCESS;
-    return ret;
+    /*
+    EFI_LOADED_IMAGE *loaded_image = NULL;
+    EFI_GUID loaded_image_protocol = LOADED_IMAGE_PROTOCOL;
+    EFI_STATUS status;
+
+    uefi_call_wrapper(BS->SetWatchdogTimer, 4, 0, 0x0, 0, NULL);
+
+    status = uefi_call_wrapper(
+        system_table->BootServices->HandleProtocol,
+        3,
+        image,
+        &loaded_image_protocol,
+        (void **) &loaded_image);
+
+    if (EFI_ERROR(status)) {
+        Print(L"handleprotocol: %r\n", status);
+    }
+
+    Print(L"Image base: %lx\n", loaded_image->ImageBase);
+    Print(L"Image size: %lx\n", loaded_image->ImageSize);
+    Print(L"Image file: %s\n", DevicePathToStr(loaded_image->FilePath));
+*/
+    return EFI_SUCCESS;
 }
Binary file boot/bootx64.efi has changed