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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# $Id$
#
INCLUDES= $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \
-I$(BUILDDIR) -I$(BUILDDIR)/bitmaps
DEPFILE = $(OBJDIR)/dep-bootloader
LDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds
# Set up the bitmap libraries
BITMAPLIBS =
LINKBITMAPS =
ifneq ($(strip $(BMP2RB_MONO)),)
BITMAPLIBS += $(BUILDDIR)/libbitmapsmono.a
LINKBITMAPS += -lbitmapsmono
endif
ifneq ($(strip $(BMP2RB_NATIVE)),)
BITMAPLIBS += $(BUILDDIR)/libbitmapsnative.a
LINKBITMAPS += -lbitmapsnative
endif
ifneq ($(strip $(BMP2RB_REMOTEMONO)),)
BITMAPLIBS += $(BUILDDIR)/libbitmapsremotemono.a
LINKBITMAPS += -lbitmapsremotemono
endif
ifneq ($(strip $(BMP2RB_REMOTENATIVE)),)
BITMAPLIBS += $(BUILDDIR)/libbitmapsremotenative.a
LINKBITMAPS += -lbitmapsremotenative
endif
ifdef DEBUG
DEFINES := -DDEBUG
CFLAGS += -g
endif
SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - )
DIRS = .
ifdef APPEXTRA
DIRS += $(subst :, ,$(APPEXTRA))
INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA)))
endif
CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) $(EXTRA_DEFINES) \
-DMEM=${MEMORYSIZE}
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
SOURCES = $(SRC)
LINKFILE = $(OBJDIR)/linkage.lds
MAXINFILE = $(OBJDIR)/romstart.temp
MAXOUTFILE = $(OBJDIR)/romstart
LIBROCKBOX = $(BUILDDIR)/librockbox.a
ifdef DEBUG
all: $(OBJDIR)/bootloader.elf
else
all: $(BUILDDIR)/$(BINARY) $(FLASHFILE)
endif
$(DEPFILE): $(BITMAPLIBS)
dep: $(DEPFILE)
$(LINKFILE): $(LDS)
$(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) $(DEFINES) -E -P $(ROMBUILD) - >$@
$(MAXOUTFILE):
$(SILENT)echo '#include "config.h"' > $(MAXINFILE)
$(SILENT)echo "ROM_START" >> $(MAXINFILE)
$(SILENT)cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
$(SILENT)rm $(MAXINFILE)
build-bitmapsmono:
$(call PRINTS,MAKE in bitmaps/mono)$(MAKE) -C ../apps/bitmaps/mono OBJDIR=$(OBJDIR)/bitmaps/mono
build-bitmapsnative:
$(call PRINTS,MAKE in bitmaps/native)$(MAKE) -C ../apps/bitmaps/native OBJDIR=$(OBJDIR)/bitmaps/native
build-bitmapsremotemono:
$(call PRINTS,MAKE in bitmaps/remote_mono)$(MAKE) -C ../apps/bitmaps/remote_mono OBJDIR=$(OBJDIR)/bitmaps/remote_mono
build-bitmapsremotenative:
$(call PRINTS,MAKE in bitmaps/remote_native)$(MAKE) -C ../apps/bitmaps/remote_native OBJDIR=$(OBJDIR)/bitmaps/remote_native
$(BITMAPLIBS): $(BUILDDIR)/lib%.a: build-%
$(OBJDIR)/bootloader.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX) $(BITMAPLIBS)
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Wl,--gc-sections -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -L$(BUILDDIR)/firmware -lrockbox $(LINKBITMAPS) -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/bootloader.map
$(OBJDIR)/bootloader.bin : $(OBJDIR)/bootloader.elf
$(call PRINTS,OBJCOPY $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@
$(BUILDDIR)/$(BINARY) : $(OBJDIR)/bootloader.bin
$(call PRINTS,Build bootloader file)$(MKFIRMWARE) $< $@
include $(TOOLSDIR)/make.inc
clean:
$(call PRINTS,cleaning bootloader)-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) \
$(OBJDIR)/bootloader.bin $(OBJDIR)/bootloader.elf $(OBJDIR)/*.map \
$(LINKFILE) $(MAXOUTFILE) $(DEPFILE)
$(SILENT)$(MAKE) -C bitmaps/mono clean OBJDIR=$(OBJDIR)/bitmaps/mono
$(SILENT)$(MAKE) -C bitmaps/native clean OBJDIR=$(OBJDIR)/bitmaps/native
$(SILENT)$(MAKE) -C bitmaps/remote_mono clean OBJDIR=$(OBJDIR)/bitmaps/remote_mono
$(SILENT)$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native
-include $(DEPFILE)
|