Index: boot/arch/ia64/loader/Makefile
===================================================================
--- boot/arch/ia64/loader/Makefile	(revision 95b730c2989ef950189f5439eebbd7fcc3dc2dc8)
+++ boot/arch/ia64/loader/Makefile	(revision 59e4864a51a79cbe1c491a3c86539b884e9005e6)
@@ -89,4 +89,6 @@
 
 COMPONENTS = \
+	$(KERNELDIR)/kernel.bin 
+NOCOMPONENTS = \
 	$(KERNELDIR)/kernel.bin \
 	$(USPACEDIR)/srv/ns/ns \
Index: boot/arch/ia64/loader/asm.S
===================================================================
--- boot/arch/ia64/loader/asm.S	(revision 95b730c2989ef950189f5439eebbd7fcc3dc2dc8)
+++ boot/arch/ia64/loader/asm.S	(revision 59e4864a51a79cbe1c491a3c86539b884e9005e6)
@@ -38,6 +38,4 @@
     movl r8 = 0x4404000;;
     mov b1 = r8 ;;
-    mov r1 = in0;
+    mov r1 = in0;               #Save bootinfo prt
     br.call.sptk.many b0 = b1;;
-.global ofw
-ofw:
Index: boot/arch/ia64/loader/boot.S
===================================================================
--- boot/arch/ia64/loader/boot.S	(revision 95b730c2989ef950189f5439eebbd7fcc3dc2dc8)
+++ boot/arch/ia64/loader/boot.S	(revision 59e4864a51a79cbe1c491a3c86539b884e9005e6)
@@ -35,4 +35,5 @@
 start:
 
+
 	mov ar.rsc = r0
 #	movl r8 = (VRN_KERNEL << VRN_SHIFT) ;;
@@ -58,4 +59,20 @@
 	br.call.sptk.many b0 = b1
 
+.align 512
+ap_start:
+
+
+ap_loop:
+	movl r18=0x4405000;;
+	mov b1 = r18 ;;
+	br.call.sptk.many b0 = b1;;
+
+.align 1024
+
+.align 4096
+.global binfo
+binfo:
+
+
 .bss #on this line is ".bss", it cannot be seen in my mcedit :-(
 
Index: boot/arch/ia64/loader/gefi/HelenOS/Makefile
===================================================================
--- boot/arch/ia64/loader/gefi/HelenOS/Makefile	(revision 95b730c2989ef950189f5439eebbd7fcc3dc2dc8)
+++ boot/arch/ia64/loader/gefi/HelenOS/Makefile	(revision 59e4864a51a79cbe1c491a3c86539b884e9005e6)
@@ -29,5 +29,5 @@
 LDSCRIPT	= ../gnuefi/elf_$(ARCH)_efi.lds
 LDFLAGS		+= -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
-LOADLIBES	= -lefi -lgnuefi
+LOADLIBES	= -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
 FORMAT		= efi-app-$(ARCH)
 
@@ -46,13 +46,21 @@
 	$(OBJDUMP) -d hello.efi > hello.disass  
 
-hello.so: hello.o image.o
-	$(LD) $(LDFLAGS) -Map hello.map hello.o -o hello.so $(LOADLIBES)
+#When selected first lines or second lines, select if image is linked into hello or not - usefull for network boot
+#hello.so: hello.o image.o 
+hello.so: hello.o
+#	$(LD) $(LDFLAGS) -Map hello.map hello.o image.o -o hello.so $(LOADLIBES) #link image inside hello
+	$(LD) $(LDFLAGS) -Map hello.map hello.o -o hello.so $(LOADLIBES) #dont link image inside hello
 
 hello.o: hello.c
 	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c hello.c -o hello.o
 
-image.o: ../../image.boot
+image.o: ../../image.boot mkimage
 	$(OBJCOPY) -O binary ../../image.boot image.bin
-	$(OBJCOPY) -I binary -O elf64-ia64-little -B ia64 image.bin image.o
+	./mkimage
+	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c image.c -o image.o
+#	$(OBJCOPY) -I binary -O elf64-ia64-little -B ia64  image.bin image.o
+
+mkimage: mkimage.c
+	gcc -o mkimage mkimage.c
 
 
Index: boot/arch/ia64/loader/gefi/HelenOS/hello.c
===================================================================
--- boot/arch/ia64/loader/gefi/HelenOS/hello.c	(revision 95b730c2989ef950189f5439eebbd7fcc3dc2dc8)
+++ boot/arch/ia64/loader/gefi/HelenOS/hello.c	(revision 59e4864a51a79cbe1c491a3c86539b884e9005e6)
@@ -2,5 +2,19 @@
 #include <efilib.h>
 
+#include <../../../../../../kernel/arch/ia64/include/bootinfo.h>
+
 #define KERNEL_LOAD_ADDRESS 0x4400000
+
+//Link image as a data array into hello - usefull with network boot
+//#define IMAGE_LINKED
+
+bootinfo_t *bootinfo=(bootinfo_t *)BOOTINFO_ADDRESS;
+
+
+#ifdef IMAGE_LINKED
+extern char HOSimage[];
+extern int HOSimagesize;
+#endif
+
 
 
@@ -16,21 +30,4 @@
 	return mem;
 }
-char HEX[256];
-
-char hexs[]="0123456789ABCDEF";
-/*
-void to_hex(unsigned long long num)
-{
-    int a;
-    for(a=15;a>=0;a--)    
-    {
-	char c=num - (num & 0xfffffffffffffff0LL);
-	num/=16;
-	c=hexs[c];
-	HEX[a]=c;
-    }
-
-}
-*/
 
 EFI_STATUS
@@ -73,9 +70,10 @@
 
 	BS->HandleProtocol(LoadedImage->DeviceHandle, &FileSystemProtocol, &Vol);
-	Vol->OpenVolume (Vol, &CurDir);
 
 	char FileName[1024];
 	char *OsKernelBuffer;
 	int i;
+	int defaultLoad;
+	int imageLoad;
 	UINTN Size;
 
@@ -98,6 +96,8 @@
 	while(LoadOptions[i]==L' ') if(LoadOptions[i++]==0) break;
 	
-	if(LoadOptions[i++]==0)
+	if(LoadOptions[i++]==0){
 		StrCat(FileName,L"\\image.bin");
+		defaultLoad=1;
+	}	
 	else{
 		CHAR16 buf[1024];
@@ -109,24 +109,67 @@
 		buf[j+1]=0;
 		StrCat(FileName,buf);
-	}
-	
-	//Print(L"%s\n",FileName);
-
-	EFI_STATUS stat;
-	stat=CurDir->Open(CurDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
-	if(EFI_ERROR(stat)){
-		Print(L"Error Opening Image %s\n",FileName);
-		return 0;
+		defaultLoad=0;
+	}
+
+	imageLoad=1;
+#ifdef IMAGE_LINKED
+	if(defaultLoad) {
+	    Print(L"Using Linked Image\n");
+	    imageLoad=0;
 	}    
-	Size = 0x00400000;
-	BS->AllocatePool(EfiLoaderData, Size, &OsKernelBuffer);
-	FileHandle->Read(FileHandle, &Size, OsKernelBuffer);
-	FileHandle->Close(FileHandle);
-
-	if(Size<1) return 0;
-
-
-	char *  HOS = OsKernelBuffer;  
+#endif	
+	
+
+	char *  HOS;
+	if(imageLoad)
+	{
+		Size = 0x00400000;
+
+    		Vol->OpenVolume (Vol, &CurDir);
+
+		EFI_STATUS stat;
+		stat=CurDir->Open(CurDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
+		if(EFI_ERROR(stat)){
+			Print(L"Error Opening Image %s\n",FileName);
+			return 0;
+		}
+	        BS->AllocatePool(EfiLoaderData, Size, &OsKernelBuffer);
+		FileHandle->Read(FileHandle, &Size, OsKernelBuffer);
+		FileHandle->Close(FileHandle);
+		HOS = OsKernelBuffer;  
+	    	if(Size<1) return 0;
+
+	}	    
+#ifdef IMAGE_LINKED
+	else {
+	    HOS = HOSimage;  
+	    Size = HOSimagesize;
+	    Print(L"Image start %llX\n",(long long)HOS);
+	    Print(L"Image size %llX\n",(long long)Size);
+	    Print(L"Image &size %llX\n",(long long)&Size);
+	}
+#endif	
 	int HOSSize = Size;  
+
+
+	rArg rSAL;
+	//Setup AP's wake up address
+
+	LibSalProc(0x01000000,2,0x4400200,0,0,0,0,0,&rSAL);
+
+
+        UINT64 sapic;
+        LibGetSalIpiBlock(&sapic);
+        Print (L"SAPIC:%X\n", sapic);
+	bootinfo->sapic=sapic;
+
+
+        int wakeup_intno;
+        wakeup_intno=0xf0;
+        Print (L"WAKEUP INTNO:%X\n", wakeup_intno);
+	bootinfo->wakeup_intno=wakeup_intno;
+
+
+
 
 
@@ -168,4 +211,6 @@
 	    ((char *)(0x4400000))[a]=HOS[a];
 	}
+	bootinfo->sapic=(unsigned long *)sapic;
+	bootinfo->wakeup_intno=wakeup_intno;
 	
 	//Run Kernel
@@ -178,7 +223,5 @@
 	   
 	
-	while(1){
-	    ((volatile int *)(0x80000000000b8000))[0]++;
-	}
+	//Not reached	   
 	return EFI_SUCCESS;
 }
Index: boot/arch/ia64/loader/gefi/apps/Makefile
===================================================================
--- boot/arch/ia64/loader/gefi/apps/Makefile	(revision 95b730c2989ef950189f5439eebbd7fcc3dc2dc8)
+++ boot/arch/ia64/loader/gefi/apps/Makefile	(revision 59e4864a51a79cbe1c491a3c86539b884e9005e6)
@@ -29,5 +29,5 @@
 LDSCRIPT	= ../gnuefi/elf_$(ARCH)_efi.lds
 LDFLAGS		+= -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
-LOADLIBES	= -lefi -lgnuefi
+LOADLIBES	= -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
 FORMAT		= efi-app-$(ARCH)
 
Index: boot/arch/ia64/loader/main.c
===================================================================
--- boot/arch/ia64/loader/main.c	(revision 95b730c2989ef950189f5439eebbd7fcc3dc2dc8)
+++ boot/arch/ia64/loader/main.c	(revision 59e4864a51a79cbe1c491a3c86539b884e9005e6)
@@ -35,5 +35,5 @@
 #include <balloc.h>
 
-bootinfo_t bootinfo;
+extern bootinfo_t binfo;
 component_t components[COMPONENTS];
 
@@ -70,4 +70,6 @@
 	
 	
+	bootinfo_t *bootinfo=&binfo;
+	
 	//for(ii=0;ii<KERNEL_SIZE;ii++) ((char *)(0x100000))[ii] = ((char *)KERNEL_START)[ii+1];
 	
@@ -93,16 +95,15 @@
 
 
-	bootinfo.taskmap.count = 0;
+	bootinfo->taskmap.count = 0;
 	for (i = 0; i < COMPONENTS; i++) {
 
 		if (i > 0) {
-			bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = components[i].start;
-			bootinfo.taskmap.tasks[bootinfo.taskmap.count].size = components[i].size;
-			bootinfo.taskmap.count++;
+			bootinfo->taskmap.tasks[bootinfo->taskmap.count].addr = components[i].start;
+			bootinfo->taskmap.tasks[bootinfo->taskmap.count].size = components[i].size;
+			bootinfo->taskmap.count++;
 		}
 	}
 
-
-	jump_to_kernel(&bootinfo);
+	jump_to_kernel(bootinfo);
 
 
Index: boot/arch/ia64/loader/main.h
===================================================================
--- boot/arch/ia64/loader/main.h	(revision 95b730c2989ef950189f5439eebbd7fcc3dc2dc8)
+++ boot/arch/ia64/loader/main.h	(revision 59e4864a51a79cbe1c491a3c86539b884e9005e6)
@@ -30,26 +30,11 @@
 #define BOOT_ia64_MAIN_H_
 
-#include <ofw.h>
-#include <ofw_tree.h>
 #include <types.h>
+#include <../../../../kernel/arch/ia64/include/bootinfo.h> 
 
 
 #define CONFIG_INIT_TASKS	32
 
-typedef struct {
-	void *addr; 
-	size_t size;
-} init_task_t;
-	
-typedef struct {
-	count_t count;
-	init_task_t tasks[CONFIG_INIT_TASKS];
-} init_t;
 
-typedef struct {
-	init_t taskmap;
-} bootinfo_t;
-
-extern bootinfo_t bootinfo;
 
 extern void start(void);
