annotate Makefile @ 2:08b78c2f55c6

add hgignore file. fix Makefile
author taiki
date Wed, 26 Mar 2014 00:51:22 +0900
parents 8d0e5be5d742
children a2c1382b25ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
1 ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
2 EFI_INCLUDE = /usr/include/efi
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
3 EFI_INCLUDES = -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
4 EFI_PATH = /usr/lib64/gnuefi
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
5 EFI_LIB_PATH = /usr/lib64
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
6 LIB_GCC = $(shell $(CC) -print-libgcc-file-name)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
7 EFI_LIBS = -lefi -lgnuefi $(LIB_GCC)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
8 EFI_CRT_OBJS = $(EFI_PATH)/crt0-efi-$(ARCH).o
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
9 EFI_LDS = $(EFI_PATH)/elf_$(ARCH)_efi.lds
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
10 CFLAGS = -O2 -g -mno-red-zone -fno-stack-protector -fno-strict-aliasing -fpic -fshort-wchar -fno-merge-constants -Wall -Werror $(EFI_INCLUDES)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
11
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
12 ifeq ($(ARCH),x86_64)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
13 CFLAGS += -DEFI_FUNCTION_WRAPPER
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
14 endif
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
15
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
16 LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L$(EFI_LIB_PATH) $(EFI_CRT_OBJS)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
17 TARGET = bootx64.efi
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
18 OBJS = bootx64.o
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
19
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
20 all: $(TARGET)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
21
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
22 bootx64.efi: $(OBJS)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
23
2
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
24 exec:
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
25 qemu-kvm -s -L ovmf -bios ovmf/OVMF.fd -hdb disk/disk.qcow2
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
26
0
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
27 %.efi: %.o
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
28 $(LD) $(LDFLAGS) $^ -o $@ $(EFI_LIBS)
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
29 objcopy -j .text -j .sdata -j .data \
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
30 -j .dynamic -j .dynsym -j .rel \
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
31 -j .rela -j .reloc \
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
32 --target=efi-app-$(ARCH) $@
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
33 strip $@
2
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
34 modprobe nbd
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
35 qemu-nbd -c /dev/nbd0 disk/disk.qow2
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
36 mount /dev/nbd0 /mnt/nbd
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
37 cp bootx64.efi /mnt/nbd/EFI/BOOT/
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
38 umount /mnt/nbd
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
39 qemu-nbd -d /dev/nbd0
08b78c2f55c6 add hgignore file. fix Makefile
taiki
parents: 0
diff changeset
40 rmmod nbd
0
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
41
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
42 clean:
8d0e5be5d742 test exit boot services
taiki
parents:
diff changeset
43 rm -f $(TARGET) $(OBJS)