Subversion Repositories HelenOS

Rev

Rev 3191 | Rev 3674 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3191 Rev 3588
1
#
1
#
2
#  Copyright (C) 1999-2001 Hewlett-Packard Co.
2
#  Copyright (C) 1999-2001 Hewlett-Packard Co.
3
#	Contributed by David Mosberger <davidm@hpl.hp.com>
3
#	Contributed by David Mosberger <davidm@hpl.hp.com>
4
#	Contributed by Stephane Eranian <eranian@hpl.hp.com>
4
#	Contributed by Stephane Eranian <eranian@hpl.hp.com>
5
#
5
#
6
# This file is part of the gnu-efi package.
6
# This file is part of the gnu-efi package.
7
#
7
#
8
#  GNU-EFI is free software; you can redistribute it and/or modify
8
#  GNU-EFI is free software; you can redistribute it and/or modify
9
#  it under the terms of the GNU General Public License as published by
9
#  it under the terms of the GNU General Public License as published by
10
#  the Free Software Foundation; either version 2, or (at your option)
10
#  the Free Software Foundation; either version 2, or (at your option)
11
#  any later version.
11
#  any later version.
12
#
12
#
13
#  GNU-EFI is distributed in the hope that it will be useful,
13
#  GNU-EFI is distributed in the hope that it will be useful,
14
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
#  GNU General Public License for more details.
16
#  GNU General Public License for more details.
17
#
17
#
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
prefix=$(PREFIX)
23
prefix=$(PREFIX)
24
include ../Make.defaults
24
include ../Make.defaults
25
CDIR=$(TOPDIR)/..
25
CDIR=$(TOPDIR)/..
26
LINUX_HEADERS	= /usr/src/sys/build
26
LINUX_HEADERS	= /usr/src/sys/build
27
CPPFLAGS	+= -D__KERNEL__ -I$(LINUX_HEADERS)/include
27
CPPFLAGS	+= -D__KERNEL__ -I$(LINUX_HEADERS)/include
28
CRTOBJS		= ../gnuefi/crt0-efi-$(ARCH).o
28
CRTOBJS		= ../gnuefi/crt0-efi-$(ARCH).o
29
LDSCRIPT	= ../gnuefi/elf_$(ARCH)_efi.lds
29
LDSCRIPT	= ../gnuefi/elf_$(ARCH)_efi.lds
30
LDFLAGS		+= -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
30
LDFLAGS		+= -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
31
LOADLIBES	= -lefi -lgnuefi
31
LOADLIBES	= -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
32
FORMAT		= efi-app-$(ARCH)
32
FORMAT		= efi-app-$(ARCH)
33
 
33
 
34
 
34
 
35
all:	gefi hello.efi
35
all:	gefi hello.efi
36
 
36
 
37
 
37
 
38
clean:
38
clean:
39
	rm -f *.efi *~ *.o *.so *.map *.disass *.bin
39
	rm -f *.efi *~ *.o *.so *.map *.disass *.bin
40
 
40
 
41
.PHONY: install
41
.PHONY: install
42
 
42
 
43
hello.efi: hello.so
43
hello.efi: hello.so
44
	$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
44
	$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
45
		   -j .rela -j .reloc --target=$(FORMAT) hello.so hello.efi
45
		   -j .rela -j .reloc --target=$(FORMAT) hello.so hello.efi
46
	$(OBJDUMP) -d hello.efi > hello.disass  
46
	$(OBJDUMP) -d hello.efi > hello.disass  
47
 
47
 
-
 
48
#When selected first lines or second lines, select if image is linked into hello or not - usefull for network boot
48
hello.so: hello.o image.o
49
#hello.so: hello.o image.o 
-
 
50
hello.so: hello.o image.bin
-
 
51
#	$(LD) $(LDFLAGS) -Map hello.map hello.o image.o -o hello.so $(LOADLIBES) #link image inside hello
49
	$(LD) $(LDFLAGS) -Map hello.map hello.o -o hello.so $(LOADLIBES)
52
	$(LD) $(LDFLAGS) -Map hello.map hello.o -o hello.so $(LOADLIBES) #dont link image inside hello
50
 
53
 
51
hello.o: hello.c
54
hello.o: hello.c
52
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c hello.c -o hello.o
55
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c hello.c -o hello.o
53
 
56
 
-
 
57
 
54
image.o: ../../image.boot
58
image.bin: ../../image.boot 
55
	$(OBJCOPY) -O binary ../../image.boot image.bin
59
	$(OBJCOPY) -O binary ../../image.boot image.bin
-
 
60
 
-
 
61
 
-
 
62
image.o: ../../image.boot mkimage
-
 
63
	$(OBJCOPY) -O binary ../../image.boot image.bin
-
 
64
	./mkimage
-
 
65
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c image.c -o image.o
56
	$(OBJCOPY) -I binary -O elf64-ia64-little -B ia64 image.bin image.o
66
#	$(OBJCOPY) -I binary -O elf64-ia64-little -B ia64  image.bin image.o
-
 
67
 
-
 
68
mkimage: mkimage.c
-
 
69
	gcc -o mkimage mkimage.c
57
 
70
 
58
 
71
 
59
gefi:
72
gefi:
60
	make -C .. prefix=$(PREFIX)
73
	make -C .. prefix=$(PREFIX)
61
 
74