diff --git a/source/dwc3_test/Makefile b/source/dwc3_test/Makefile index 28d2fe1..07a1bb1 100644 --- a/source/dwc3_test/Makefile +++ b/source/dwc3_test/Makefile @@ -8,10 +8,11 @@ OBJCOPY := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64 LD := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld.bfd #==================Target Samsung S7 (8890)================== -CFLAGS_SAMSUNGS7 = -Os +CFLAGS_SAMSUNGS7 = -Os # -Os for optimization for size dwc3: - $(CC) entry.S -c -o entry.o $(CFLAGS_SAMSUNGS7) - $(CC) $(CFLAGS_SAMSUNGS7) -c test_dwc3.c -o dwc3.o - $(LD) -T test_dwc3.ld entry.o dwc3.o -o dwc3.elf --just-symbols=symbols.txt + $(CC) entry.S -c -o entry.o $(CFLAGS_SAMSUNGS7) # -c compiles assembly code, and -o creates an object file (containing linking and symbol information) + $(CC) $(CFLAGS_SAMSUNGS7) -c test_dwc3.c -o dwc3.o # compiles test_dwc3.c to dwc3.o + $(LD) -T test_dwc3.ld entry.o dwc3.o -o dwc3.elf --just-symbols=symbols.txt # -T for linker script, --just-symbols for symbols file $(OBJCOPY) -O binary dwc3.elf dwc3.bin + \ No newline at end of file diff --git a/source/dwc3_test/dwc3.elf b/source/dwc3_test/dwc3.elf index 1531389..ff987b8 100755 Binary files a/source/dwc3_test/dwc3.elf and b/source/dwc3_test/dwc3.elf differ diff --git a/source/dwc3_test/dwc3.o b/source/dwc3_test/dwc3.o index bf81e16..b8d7780 100644 Binary files a/source/dwc3_test/dwc3.o and b/source/dwc3_test/dwc3.o differ diff --git a/source/exploit/debugger/Makefile b/source/exploit/debugger/Makefile new file mode 100644 index 0000000..3ddaa87 --- /dev/null +++ b/source/exploit/debugger/Makefile @@ -0,0 +1,17 @@ +ifeq ($(ANDROID_NDK_ROOT),) +$(error Error : Set the env variable 'ANDROID_NDK_ROOT' with the path of the Android NDK (version 20)) +endif + +CC := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android27-clang +AR := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar +OBJCOPY := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-objcopy +LD := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld.bfd + +#==================Target Samsung S7 (8890)================== +CFLAGS_SAMSUNGS7 = -Os + +stage1: + $(CC) entry.S -c -o entry.o $(CFLAGS_SAMSUNGS7) + $(CC) $(CFLAGS_SAMSUNGS7) -c stage1.c -o stage1.o + $(LD) -T linkscript.ld entry.o stage1.o -o stage1.elf --just-symbols=symbols.txt + $(OBJCOPY) -O binary stage1.elf stage1.bin diff --git a/source/exploit/modify_bin.py b/source/exploit/modify_bin.py new file mode 100644 index 0000000..b7195f5 --- /dev/null +++ b/source/exploit/modify_bin.py @@ -0,0 +1,8 @@ +# Open a binary file and modify it +bl1 = open('../S7/bl1.bin', 'rb').read() + +# Modify the binary file at 1C10 +bl1 = bl1[:0x1C1C] + b'\x48' + bl1[0x1C1D:] + +# Write the modified binary file +open('../S7/bl1_mod.bin', 'wb').write(bl1) \ No newline at end of file diff --git a/source/exploit/stage1/Makefile b/source/exploit/stage1/Makefile index 3ddaa87..6c1349d 100644 --- a/source/exploit/stage1/Makefile +++ b/source/exploit/stage1/Makefile @@ -15,3 +15,4 @@ stage1: $(CC) $(CFLAGS_SAMSUNGS7) -c stage1.c -o stage1.o $(LD) -T linkscript.ld entry.o stage1.o -o stage1.elf --just-symbols=symbols.txt $(OBJCOPY) -O binary stage1.elf stage1.bin + \ No newline at end of file