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