1 BOOT_SRCDIR
:= boot
/$(ARCH
)
2 BOOT_TARGETDIR
:= $(call TOBUILDDIR
, boot
)
4 STAGE2
= $(BOOT_TARGETDIR
)/stage2
6 # make a rule for the stage2
7 MY_TARGETDIR
:= $(BOOT_TARGETDIR
)
8 MY_SRCDIR
:= $(BOOT_SRCDIR
)
13 MY_INCLUDES
:= $(STDINCLUDE
)
14 MY_CFLAGS
:= $(KERNEL_CFLAGS
)
16 MY_LIBS
:= $(LIBS_BUILD_DIR
)/libc.a
19 MY_LINKSCRIPT
:= $(MY_SRCDIR
)/stage2.
ld
22 include templates
/app.mk
24 CONFIG_FILE
:= $(BOOT_SRCDIR
)/config.ini
26 SEMIFINAL
:= $(BOOT_TARGETDIR
)/final.bootdir
28 $(SEMIFINAL
): $(STAGE2
) $(ALL
) $(TOOLS
) $(MAKEFLOP
) $(CONFIG_FILE
)
29 # $(BOOTMAKER) $(CONFIG_FILE) -o $(SEMIFINAL)
30 $(BOOTMAKER
) --strip-debug
--strip-binary
$(STRIP
) $(CONFIG_FILE
) -o
$(SEMIFINAL
)
32 FINAL_ASMINCLUDE
:= $(BOOT_TARGETDIR
)/final.asminclude
34 $(FINAL_ASMINCLUDE
): $(SEMIFINAL
) $(TOOLS
)
35 $(BIN2ASM
) < $(SEMIFINAL
) > $(FINAL_ASMINCLUDE
)
37 STAGE1
:= $(BOOT_TARGETDIR
)/stage1
38 STAGE1_OBJS
:= $(BOOT_TARGETDIR
)/stage1.o
40 ALL_DEPS
:= $(ALL_DEPS
) $(STAGE1_OBJS
:.o
=.d
)
42 $(BOOT_TARGETDIR
)/stage1.o
: $(BOOT_SRCDIR
)/stage1.S
$(FINAL_ASMINCLUDE
)
43 @mkdir
-p
$(BOOT_TARGETDIR
)
44 $(CC
) $(GLOBAL_CFLAGS
) -I.
-Iinclude
-I
$(BOOT_TARGETDIR
) -c
$< -o
$@
46 $(BOOT_TARGETDIR
)/stage1.d
: $(BOOT_SRCDIR
)/stage1.S
47 @mkdir
-p
$(BOOT_TARGETDIR
)
48 @echo
"making deps for $<..."
49 ($(ECHO
) -n
$(dir $@
);$(CC
) $(GLOBAL_CFLAGS
) -g
-Iinclude
-I
$(BOOT_TARGETDIR
) -M
-MG
$<) > $@
51 #$(FINAL): $(ALL) $(TOOLS)
52 $(FINAL
): $(STAGE1_OBJS
) $(STAGE2
)
53 $(LD
) $(GLOBAL_LDFLAGS
) -dN
--script
=$(BOOT_SRCDIR
)/stage1.
ld $(STAGE1_OBJS
) -o
$@.elf
54 $(OBJCOPY
) -O binary
$@.elf
$@