2016-11-12 03:29:35 +01:00
|
|
|
PATH := $(DEVKITPPC)/bin:$(PATH)
|
|
|
|
PREFIX ?= powerpc-eabi-
|
|
|
|
CC = $(PREFIX)gcc
|
|
|
|
AS = $(PREFIX)gcc
|
2016-11-12 22:16:06 +01:00
|
|
|
CFLAGS = -std=gnu99 -O3 -nostdinc -fno-builtin
|
2016-11-12 03:29:35 +01:00
|
|
|
ASFLAGS = -mregnames -x assembler-with-cpp
|
|
|
|
LD = $(PREFIX)ld
|
|
|
|
OBJCOPY = $(PREFIX)objcopy
|
2016-11-14 00:18:10 +01:00
|
|
|
LDFLAGS=-Ttext 180C000 -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/4.8.2 -lgcc
|
2016-11-12 03:29:35 +01:00
|
|
|
OBJDUMP ?= $(PREFIX)objdump
|
|
|
|
project := .
|
|
|
|
root := $(CURDIR)
|
|
|
|
build := $(root)/bin
|
|
|
|
|
|
|
|
FIRMWARE = 550
|
|
|
|
|
|
|
|
all: clean setup main
|
|
|
|
|
|
|
|
$(CURDIR)/payload/arm_kernel_bin.h: $(CURDIR)/payload/arm_user_bin.h
|
|
|
|
@$(MAKE) --no-print-directory -C $(CURDIR)/arm_kernel -f $(CURDIR)/arm_kernel/Makefile
|
|
|
|
@-mkdir -p $(CURDIR)/payload
|
|
|
|
@cp -p $(CURDIR)/arm_kernel/arm_kernel_bin.h $@
|
|
|
|
|
|
|
|
$(CURDIR)/payload/arm_user_bin.h:
|
|
|
|
@$(MAKE) --no-print-directory -C $(CURDIR)/arm_user -f $(CURDIR)/arm_user/Makefile
|
|
|
|
@-mkdir -p $(CURDIR)/payload
|
|
|
|
@cp -p $(CURDIR)/arm_user/arm_user_bin.h $@
|
|
|
|
|
|
|
|
setup:
|
|
|
|
mkdir -p $(root)/bin/
|
|
|
|
|
|
|
|
main: $(CURDIR)/payload/arm_kernel_bin.h
|
|
|
|
$(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/main.c
|
|
|
|
$(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/crt0.S
|
|
|
|
cp -r $(root)/*.o $(build)
|
|
|
|
rm $(root)/*.o
|
2016-11-14 00:18:10 +01:00
|
|
|
$(LD) -o cfw_booter.elf $(build)/crt0.o `find $(build) -name "*.o" ! -name "crt0.o"` $(LDFLAGS) -Map cfw_booter.map
|
|
|
|
$(OBJCOPY) cfw_booter.elf -S -O binary ../cfw_booter.bin
|
2016-11-12 03:29:35 +01:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(build) payload
|
2016-11-14 00:18:10 +01:00
|
|
|
rm -rf cfw_booter.elf cfw_booter.map
|
2016-11-12 03:29:35 +01:00
|
|
|
$(MAKE) --no-print-directory -C $(CURDIR)/arm_user -f $(CURDIR)/arm_user/Makefile clean
|
|
|
|
$(MAKE) --no-print-directory -C $(CURDIR)/arm_kernel -f $(CURDIR)/arm_kernel/Makefile clean
|