Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

136 lines (101 sloc) 3.242 kB
B2HTARGET = $(CURDIR)/tools/bin2header
CFLAGS = -Wall -O3
CC = gcc
PPU_CC = ppu-gcc
PPU_OBJCOPY = ppu-objcopy
PPU_CFLAGS =
# This isn't enough, you must also add rules for the filename_fw with the -D define
SUPPORTED_FIRMWARES = 3.41 3.41_kiosk 3.40 3.30 3.21 3.15 3.10 3.01 2.85 2.76 2.70 2.60 2.53 2.43
PAYLOADS = shellcode_egghunt.bin \
shellcode_panic.bin \
dump_lv2.bin
FW_PAYLOADS = \
default_payload.bin \
payload_dev.bin \
payload_no_unauth_syscall.bin \
payload_dump_elfs.bin \
payload_trace_syscalls.bin \
payload_trace_hypercalls.bin \
payload_trace_all_sc_calls.bin \
payload_trace_vuart.bin
STANDALONE_FIRMWARES = 3.55
STANDALONE_PAYLOADS = \
default_payload.bin \
payload_no_unauth_syscall.bin
FIRMWARES_2=$(SUPPORTED_FIRMWARES:2.%=2_%)
FIRMWARES=$(FIRMWARES_2:3.%=3_%)
FW_PAYLOADS_EXT = $(foreach fw,$(FIRMWARES), \
$(foreach pl,$(FW_PAYLOADS),$(pl:%.bin=%_$(fw).bin)))
ST_FIRMWARES=$(STANDALONE_FIRMWARES:3.%=3_%)
STANDALONE_PAYLOADS_EXT = $(foreach fw,$(ST_FIRMWARES), \
$(foreach pl,$(STANDALONE_PAYLOADS),$(pl:%.bin=%_$(fw).bin)))
SIZE_LIMITED_PAYLOADS = $(PAYLOADS) $(FW_PAYLOADS_EXT)
ALL_PAYLOADS = $(SIZE_LIMITED_PAYLOADS) $(STANDALONE_PAYLOADS_EXT)
HEADERS = $(ALL_PAYLOADS:%.bin=%.h)
MAX_PAYLOAD_SIZE=4064
all: tools $(ALL_PAYLOADS) $(HEADERS) check_sizes
echo "PAYLOADS: $(ALL_PAYLOADS)"
echo "ST_PAYLOADS: $(STANDALONE_PAYLOADS_EXT)"
echo "HEADERS: $(HEADERS)"
tools:
$(MAKE) -C tools
$(B2HTARGET): tools
@true
check_sizes: $(SIZE_LIMITED_PAYLOADS)
@error=0; \
for f in $+; do \
size=`ls -l $$f | awk '{print $$5}'`; \
if [ $$size -gt $(MAX_PAYLOAD_SIZE) ]; then \
echo "File $$f has a size of $$size."; \
false; \
error=1; \
fi; \
done; \
if [ $$error -eq 1 ]; then \
echo ""; \
echo "The maximum allowed size for a payload is $(MAX_PAYLOAD_SIZE)"; \
exit 1; \
fi; \
true
$(ALL_PAYLOADS): *.h.S config.h
%_2_43.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_2_43 -c $< -o $@
%_2_53.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_2_53 -c $< -o $@
%_2_60.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_2_60 -c $< -o $@
%_2_70.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_2_70 -c $< -o $@
%_2_76.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_2_76 -c $< -o $@
%_2_85.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_2_85 -c $< -o $@
%_3_01.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_01 -c $< -o $@
%_3_10.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_10 -c $< -o $@
%_3_15.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_15 -c $< -o $@
%_3_21.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_21 -c $< -o $@
%_3_30.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_30 -c $< -o $@
%_3_40.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_40 -c $< -o $@
%_3_41.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_41 -c $< -o $@
%_3_41_kiosk.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_41 -DKIOSK -c $< -o $@
%_3_55.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -DFIRMWARE_3_55 -DSTANDALONE -c $< -o $@
%.o : %.S
$(PPU_CC) $(PPU_CFLAGS) -c $< -o $@
%.bin : %.o
$(PPU_OBJCOPY) -O binary $< $@
%.h : %.bin $(B2HTARGET)
$(B2HTARGET) $< $@ $(*F)
# Target: clean project.
clean:
$(MAKE) -C tools/ clean
rm -f *~ *.bin $(ALL_PAYLOADS) $(HEADERS)
.PHONY: all clean tools check_sizes
Jump to Line
Something went wrong with that request. Please try again.