From 75e03197a369019e27d0ade6cce210bb0ddaead5 Mon Sep 17 00:00:00 2001 From: Jonathan Herrewijnen Date: Thu, 8 Aug 2024 11:07:57 +0200 Subject: [PATCH] Reverting makefile changes and changing readme --- Makefile | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 +- 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a745a80..5f93d63 100644 --- a/Makefile +++ b/Makefile @@ -30,5 +30,118 @@ all: error error: @echo "Please specify a target to build (-f devices/nvidia_shield_t)" +#Thumb cflags + + +all: clean s905x3 pixel3a pixel3 nvidia_shield_t nvidia_shield pixel4a msm8996 pixel6_fastboot + +#==================Target pixel 3a================== +CFLAGS_PIXEL3A = -Werror -Wno-unused-variable -Os -Idevices/pixel3a/ +CFLAGS_PIXEL3A_GLITCH = -Werror -Wno-unused-variable -Os -Idevices/pixel3a/ -DGLITCH_ENABLE=1 +pixel3a: +# Debugger + [ -d bin/pixel3a ] || mkdir -p bin/pixel3a/ + $(CC) arm64_stub.S -c -o bin/pixel3a/entry.o $(CFLAGS_PIXEL3A) + $(CC) debugger.c -c -o bin/pixel3a/debugger.o $(CFLAGS_PIXEL3A) + $(LD) -T devices/pixel3a/linkscript.ld bin/pixel3a/entry.o bin/pixel3a/debugger.o -o bin/pixel3a/debugger.elf --just-symbols=devices/pixel3a/symbols.txt + +# Glitch + $(CC) arm64_glitch_stub.S -c -o bin/pixel3a/glitch_stub.o $(CFLAGS_PIXEL3A_GLITCH) + $(CC) debugger.c -c -o bin/pixel3a/debugger_glitch.o $(CFLAGS_PIXEL3A_GLITCH) + $(LD) -T devices/pixel3a/linkscript.ld bin/pixel3a/entry.o bin/pixel3a/debugger_glitch.o bin/pixel3a/glitch_stub.o -o bin/pixel3a/glitch.elf --just-symbols=devices/pixel3a/symbols.txt + +# Relocated debugger + $(LD) -T devices/pixel3a/linkscript_reloc.ld bin/pixel3a/entry.o bin/pixel3a/debugger.o -o bin/pixel3a/debugger_reloc.elf --just-symbols=devices/pixel3a/symbols.txt + +# Objcopy + $(OBJCOPY) -O binary bin/pixel3a/debugger.elf bin/pixel3a/debugger.bin + $(OBJCOPY) -O binary bin/pixel3a/debugger_reloc.elf bin/pixel3a/debugger_reloc.bin + $(OBJCOPY) -O binary bin/pixel3a/glitch.elf bin/pixel3a/glitch.bin + + +#==================Target pixel 3================== +#Pixel 3 uses most code from pixel 3a, except for different offsets for functions(symbols.txt) because the devices are so familiar. +CFLAGS_PIXEL3 = -Werror -Wno-unused-variable -Os -Idevices/pixel3a/ +pixel3: + [ -d bin/pixel3 ] || mkdir -p bin/pixel3/ + $(CC) arm64_stub.S -c -o bin/pixel3/entry.o $(CFLAGS_PIXEL3) + $(CC) debugger.c -c -o bin/pixel3/debugger.o $(CFLAGS_PIXEL3) + $(LD) -T devices/pixel3a/linkscript.ld bin/pixel3/entry.o bin/pixel3/debugger.o -o bin/pixel3/debugger.elf --just-symbols=devices/pixel3/symbols.txt + $(LD) -T devices/pixel3a/linkscript_reloc.ld bin/pixel3/entry.o bin/pixel3/debugger.o -o bin/pixel3/debugger_reloc.elf --just-symbols=devices/pixel3/symbols.txt + $(OBJCOPY) -O binary bin/pixel3/debugger.elf bin/pixel3/debugger.bin + $(OBJCOPY) -O binary bin/pixel3/debugger_reloc.elf bin/pixel3/debugger_reloc.bin + + +#==============Target MSM8996 ================ +CFLAGS_MSM8996 = -Werror -Wno-unused-variable -Os -Idevices/msm8996/ -DDEVICE_SETUP=1 +msm8996: + [ -d bin/msm8996 ] || mkdir -p bin/msm8996/ + $(CC) arm64_stub.S -c -o bin/msm8996/entry.o $(CFLAGS_MSM8996) + $(CC) debugger.c -c -o bin/msm8996/debugger.o $(CFLAGS_MSM8996) + $(LD) -T devices/msm8996/linkscript.ld bin/msm8996/entry.o bin/msm8996/debugger.o -o bin/msm8996/debugger.elf --just-symbols=devices/msm8996/symbols.txt + $(OBJCOPY) -O binary bin/msm8996/debugger.elf bin/msm8996/debugger.bin + +# Relocated debugger + $(LD) -T devices/msm8996/linkscript_reloc.ld bin/msm8996/entry.o bin/msm8996/debugger.o -o bin/msm8996/debugger_reloc.elf --just-symbols=devices/msm8996/symbols_reloc.txt + $(OBJCOPY) -O binary bin/msm8996/debugger_reloc.elf bin/msm8996/debugger_reloc.bin + + +#==================Target pixel 4a================== +CFLAGS_PIXEL4A=-Idevices/pixel4a/ -Idevices/pixel4a/include/ -Werror -O0 -nostdlib +pixel4a: + [ -d bin/pixel4a ] || mkdir -p bin/pixel4a/ + $(CC) arm64_stub.S -c -o bin/pixel4a/entry.o $(CFLAGS_PIXEL4A) + $(CC) debugger.c -c -o bin/pixel4a/debugger.o $(CFLAGS_PIXEL4A) + $(LD) -T devices/pixel4a/linkscript.ld bin/pixel4a/entry.o bin/pixel4a/debugger.o -o bin/pixel4a/debugger.elf --just-symbols=devices/pixel4a/symbols.txt + $(OBJCOPY) -O binary bin/pixel4a/debugger.elf bin/pixel4a/debugger.bin + + +#==================Target fastboot================== +CFLAGS_PIXEL_FASTBOOT=-Idevices/pixel_fastboot/ -Werror -O0 -nostdlib +pixel_fastboot: + [ -d bin/pixel_fastboot ] || mkdir -p bin/pixel_fastboot/ + $(CC) arm64_stub.S -c -o bin/pixel_fastboot/entry.o $(CFLAGS_PIXEL_FASTBOOT) + $(CC) debugger.c -c -o bin/pixel_fastboot/debugger.o $(CFLAGS_PIXEL_FASTBOOT) + $(LD) -T devices/pixel_fastboot/linkscript.ld bin/pixel_fastboot/entry.o bin/pixel_fastboot/debugger.o -o bin/pixel_fastboot/debugger.elf --just-symbols=devices/pixel_fastboot/symbols.txt + $(OBJCOPY) -O binary bin/pixel_fastboot/debugger.elf bin/pixel_fastboot/debugger.bin + + +#==================Pixel 6================== +CFLAGS_PIXEL6_FASTBOOT=-Idevices/pixel6_fastboot/ -Werror -O0 -nostdlib +pixel6_fastboot: + [ -d bin/pixel6_fastboot ] || mkdir -p bin/pixel6_fastboot/ + $(CC) arm64_stub.S -c -o bin/pixel6_fastboot/entry.o $(CFLAGS_PIXEL6_FASTBOOT) + $(CC) debugger.c -c -o bin/pixel6_fastboot/debugger.o $(CFLAGS_PIXEL6_FASTBOOT) + $(LD) -T devices/pixel6_fastboot/linkscript.ld bin/pixel6_fastboot/entry.o bin/pixel6_fastboot/debugger.o -o bin/pixel6_fastboot/debugger.elf --just-symbols=devices/pixel6_fastboot/symbols.txt + $(OBJCOPY) -O binary bin/pixel6_fastboot/debugger.elf bin/pixel6_fastboot/debugger.bin + + +#==================Target Amlogic S905X3================== +CFLAGS_S905X3 = -Werror -Wno-unused-variable -Os -Idevices/s905x3/ -DDEVICE_SETUP=1 +s905x3: + [ -d bin/s905x3 ] || mkdir -p bin/s905x3/ + $(CC) arm64_stub.S -c -o bin/s905x3/entry.o $(CFLAGS_S905X3) + $(CC) debugger.c -c -o bin/s905x3/debugger.o $(CFLAGS_S905X3) + $(LD) -T devices/s905x3/linkscript.ld bin/s905x3/entry.o bin/s905x3/debugger.o -o bin/s905x3/debugger.elf --just-symbols=devices/s905x3/symbols.txt + $(OBJCOPY) -O binary bin/s905x3/debugger.elf bin/s905x3/debugger.bin + +CFLAGS_S9XX_DUMPBROM = -Werror -Wno-unused-variable -Os -Idevices/s905x3/dump_bootrom -DDEVICE_SETUP=1 +S9XX_dumpbootrom: + [ -d bin/s905x3 ] || mkdir -p bin/s905x3/ + $(CC) arm64_stub.S -c -o bin/s905x3/entry.o $(CFLAGS_S9XX_DUMPBROM) + $(CC) debugger.c -c -o bin/s905x3/dump_bootrom.o $(CFLAGS_S9XX_DUMPBROM) + $(LD) -T devices/s905x3/linkscript.ld bin/s905x3/entry.o bin/s905x3/dump_bootrom.o -o bin/s905x3/dump_bootrom.elf --just-symbols=devices/s905x3/symbols.txt + $(OBJCOPY) -O binary bin/s905x3/dump_bootrom.elf bin/s905x3/dump_bootrom.bin + + +#==================Target Samsung S7 (8890)================== +CFLAGS_SAMSUNGS7 = -Werror -Wno-unused-variable -Os -Idevices/samsung_s7/ +samsung_s7: + [ -d bin/samsung_s7 ] || mkdir -p bin/samsung_s7/ + $(CC) arm64_stub.S -c -o bin/samsung_s7/entry.o $(CFLAGS_SAMSUNGS7) + $(CC) debugger.c -c -o bin/samsung_s7/debugger.o $(CFLAGS_SAMSUNGS7) + $(LD) -T devices/samsung_s7/linkscript.ld bin/samsung_s7/entry.o bin/samsung_s7/debugger.o -o bin/samsung_s7/debugger.elf --just-symbols=devices/samsung_s7/symbols.txt + $(OBJCOPY) -O binary bin/samsung_s7/debugger.elf bin/samsung_s7/debugger.bin + clean: rm -rf bin/* \ No newline at end of file diff --git a/README.md b/README.md index 13aeff5..2cfcb99 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ Download an Android NDK and set it's root path: $ export ANDROID_NDK_ROOT=$TOOLCHAINENV/android-ndk-r21_Linux ``` -Now you can build one of your targets: +Now you can build one of your targets by running `make `: ```bash -$ make -f devices/pixel3a/Makefile +$ make samsung_s7 ``` \ No newline at end of file