lab/x1/Makefile

50 lines
1.5 KiB
Makefile
Raw Normal View History

2021-03-04 02:19:24 +09:00
CROSS_COMPILE:=arm-linux-gnueabihf-
2021-03-04 02:15:40 +09:00
AS:=$(CROSS_COMPILE)as
CC:=$(CROSS_COMPILE)gcc
2021-03-10 00:30:19 +09:00
STRIP:=$(CROSS_COMPILE)strip
2021-03-04 02:15:40 +09:00
.PHONY:
all: return.bin mrc.bin c/main.bin
.PHONY:
clean:
2021-03-10 00:30:19 +09:00
@rm -f *.bin spray/*.bin c/*.bin c/*.elf injector/*.bin injector/*.elf
2021-03-04 02:15:40 +09:00
%.bin: %.S
@$(AS) $<
@./extract.py a.out $@
@rm -f a.out
2021-03-10 00:33:57 +09:00
c/main.elf:
@$(CC) -nostdlib -static -fPIC -marm -O0 c/start.S c/main.c c/scg.c c/divmod.c c/divmod.S -o c/main.elf
c/main.bin: c/main.elf
@./extract.py c/main.elf $@
2021-03-05 22:07:56 +09:00
spray/main.bin:
@$(AS) spray/top.S
@./extract.py -p a.out spray/top.bin
@$(AS) spray/bottom.S
@./extract.py -p a.out spray/bottom.bin
2021-03-06 00:02:19 +09:00
@$(AS) spray/bottom_reset.S
@./extract.py -p a.out spray/bottom_reset.bin
@./append_nop.py spray/top.bin spray/bottom.bin spray/bottom_reset.bin spray/main.bin 112 113
2021-03-05 22:07:56 +09:00
@rm -f a.out
2021-03-06 20:32:14 +09:00
injector/AppMain.bin:
2021-03-10 00:33:57 +09:00
@if [ "$(ELF)" = "" ]; then \
echo "Please specify ELF."; \
2021-03-06 20:32:14 +09:00
exit 1; \
fi
2021-03-10 00:33:57 +09:00
@$(STRIP) $(ELF)
@./extract.py $(ELF) injector/injected.bin
2021-03-06 20:32:14 +09:00
@$(AS) injector/disable_mmu.S -o injector/disable_mmu.elf
@./extract.py -p injector/disable_mmu.elf injector/disable_mmu.bin
@./injector/inject.py 0xf00000 0x700000 injector/disable_mmu.bin injector/injected.bin injector/AppMain.bin
2021-03-11 13:33:13 +09:00
injector/uboot.bin:
@$(AS) injector/disable_mmu.S -o injector/disable_mmu.elf
@./extract.py -p injector/disable_mmu.elf injector/disable_mmu.bin
@./extract.py -p injector/disable_mmu.elf injector/disable_mmu.bin
@./injector/inject.py 0xed0000 0x700000 injector/disable_mmu.bin u-boot.bin injector/uboot.bin