-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.old
executable file
·62 lines (47 loc) · 2.11 KB
/
Makefile.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
CROSS_COMPILE = arm-linux-
# CROSS_COMPILE = arm-none-linux-gnueabi-
# CROSS_COMPILE = arm-linux-gnueabi-
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJJUMP = $(CROSS_COMPILE)objdump
CFLAGS = -g -Wall -O2 -nostdlib -fno-builtin -I$(shell pwd)/include
# CFLAGS += -marm -mno-thumb-interwork -mabi=aapcs-linux -mword-relocations -fno-pic -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -msoft-float -pipe -march=armv4t
# CFLAGS += -nostdinc -isystem -D__KERNEL__ -D__UBOOT__ -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -fno-stack-protector -fno-delete-null-pointer-checks -g -fstack-usage -Wno-format-nonliteral -Wno-unused-but-set-variable -Werror=date-time -D__ARM__ -marm -mno-thumb-interwork -mabi=aapcs-linux -mword-relocations -fno-pic -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -msoft-float -pipe -march=armv4t -D__LINUX_ARM_ARCH__=4
# OBJCOPYFLAGS = --gap-fill=0xff -j .text -j .secure_text -j .secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata
# LDFLAGS = -Bstatic --no-dynamic-linker
BUILTIN = boot/start.o
BUILTIN += init/main.o
BUILTIN += kernel/sched.o \
kernel/fork.o \
kernel/list.o
BUILTIN += drivers/lcd.o \
drivers/nand.o \
drivers/uart.o \
drivers/sd.o \
drivers/init.o
BUILTIN += fs/fs.o \
fs/romfs.o \
fs/simple_ext2.o
BUILTIN += mm/mem.o
.PHONY:
kernel.bin: $(BUILTIN) mylibc/mylibc.a
# make -C boot/
# make -C init/
# make -C kernel/
# make -C fs/
# make -C mm/
# make -C drivers/
# make -C mylibc/
$(LD) $(LDFLAGS) -T kernel.lds $^ -o kernel.elf
$(OBJCOPY) $(OBJCOPYFLAGS) -O binary kernel.elf $@
$(OBJJUMP) -D -m arm kernel.elf > kernel.dis
cp kernel.bin /mnt/hgfs/vmware_share
%.o:%.c
$(CC) $(CFLAGS) -c $< -o $@
%.o:%.S
$(CC) $(CFLAGS) -c $< -o $@
clean:
# make -C mylibc/ clean
rm -f $(shell find -name "*.o")
rm -rf *.o *.elf *.dis *.bin