Subversion Repositories HelenOS

Rev

Rev 3675 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3675 Rev 4377
Line 18... Line 18...
18
#  You should have received a copy of the GNU General Public License
18
#  You should have received a copy of the GNU General Public License
19
#  along with GNU-EFI; see the file COPYING.  If not, write to the Free
19
#  along with GNU-EFI; see the file COPYING.  If not, write to the Free
20
#  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20
#  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21
#  02111-1307, USA.
21
#  02111-1307, USA.
22
#
22
#
-
 
23
 
23
prefix=$(PREFIX)
24
prefix=$(PREFIX)
24
include ../Make.defaults
25
include ../Make.defaults
25
CDIR=$(TOPDIR)/..
26
CDIR=$(TOPDIR)/..
26
LINUX_HEADERS	= /usr/src/sys/build
27
LINUX_HEADERS	= /usr/src/sys/build
27
CPPFLAGS	+= -D__KERNEL__ -I$(LINUX_HEADERS)/include
28
CPPFLAGS	+= -D__KERNEL__ -I$(LINUX_HEADERS)/include
28
CRTOBJS		= ../gnuefi/crt0-efi-$(ARCH).o
29
CRTOBJS		= ../gnuefi/crt0-efi-$(ARCH).o
29
LDSCRIPT	= ../gnuefi/elf_$(ARCH)_efi.lds
30
LDSCRIPT	= ../gnuefi/elf_$(ARCH)_efi.lds
30
LDFLAGS		+= -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
31
LDFLAGS		+= -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
31
#LOADLIBES	= -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
-
 
32
LOADLIBES	= -lefi -lgnuefi
32
LOADLIBES	= -lefi -lgnuefi
33
FORMAT		= efi-app-$(ARCH)
33
FORMAT		= efi-app-$(ARCH)
34
 
34
 
35
 
-
 
36
all:	gefi hello.efi
35
all:	gefi hello.efi
37
 
36
 
38
 
-
 
39
clean:
37
clean:
40
	rm -f *.efi *~ *.o *.so *.map *.disass *.bin
38
	rm -f *.efi *~ *.o *.so *.map *.disass *.bin
41
 
39
 
42
.PHONY: install
40
.PHONY: install
43
 
41
 
44
hello.efi: hello.so
42
hello.efi: hello.so
45
	$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
43
	$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
46
		   -j .rela -j .reloc --target=$(FORMAT) hello.so hello.efi
44
		   -j .rela -j .reloc --target=$(FORMAT) hello.so hello.efi
47
	$(OBJDUMP) -d hello.efi > hello.disass  
-
 
48
 
45
 
49
#When selected first lines or second lines, select if image is linked into hello or not - usefull for network boot
46
#When selected first lines or second lines, select if image is linked into hello or not - usefull for network boot
50
#hello.so: hello.o image.o division.o
47
#hello.so: hello.o image.o division.o
51
hello.so: hello.o image.bin
48
hello.so: hello.o image.bin division.o
52
#	$(LD) $(LDFLAGS) -Map hello.map hello.o division.o image.o -o hello.so $(LOADLIBES) #link image inside hello
49
#	$(LD) $(LDFLAGS) -Map hello.map hello.o division.o image.o -o hello.so $(LOADLIBES) #link image inside hello
53
	$(LD) $(LDFLAGS) -Map hello.map hello.o division.o -o hello.so $(LOADLIBES) #dont link image inside hello
50
	$(LD) $(LDFLAGS) -Map hello.map hello.o division.o -o hello.so $(LOADLIBES) #dont link image inside hello
54
 
51
 
55
hello.o: hello.c
52
hello.o: hello.c
56
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c hello.c -o hello.o
53
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c hello.c -o hello.o
57
 
54
 
58
division.o: division.c
55
division.o: division.c
59
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c division.c -o division.o
56
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c division.c -o division.o
60
 
57
 
61
 
-
 
62
image.bin: ../../image.boot 
58
image.bin: ../../image.boot 
63
	$(OBJCOPY) -O binary ../../image.boot image.bin
59
	$(OBJCOPY) -O binary ../../image.boot image.bin
64
 
60
 
65
 
-
 
66
image.o: ../../image.boot mkimage
61
image.o: ../../image.boot mkimage
67
	$(OBJCOPY) -O binary ../../image.boot image.bin
62
	$(OBJCOPY) -O binary ../../image.boot image.bin
68
	./mkimage
63
	./mkimage
69
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c image.c -o image.o
64
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c image.c -o image.o
70
#	$(OBJCOPY) -I binary -O elf64-ia64-little -B ia64  image.bin image.o
65
#	$(OBJCOPY) -I binary -O elf64-ia64-little -B ia64  image.bin image.o
71
 
66
 
72
mkimage: mkimage.c
67
mkimage: mkimage.c
73
	gcc -o mkimage mkimage.c
68
	gcc -o mkimage mkimage.c
74
 
69
 
75
 
-
 
76
gefi:
70
gefi:
77
	make -C .. prefix=$(PREFIX)
71
	make -C .. prefix=$(PREFIX)