summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rbutil/mkamsboot/Makefile56
-rw-r--r--rbutil/mkamsboot/README10
-rw-r--r--rbutil/mkamsboot/extract_fw.c (renamed from utils/AMS/hacking/extract_fw.c)0
-rw-r--r--rbutil/mkamsboot/mkamsboot.c (renamed from utils/AMS/hacking/mkamsboot.c)0
-rw-r--r--rbutil/mkamsboot/nrv2e_d8.S (renamed from utils/AMS/hacking/nrv2e_d8.S)0
-rw-r--r--rbutil/mkamsboot/test.S (renamed from utils/AMS/hacking/test.S)0
-rw-r--r--utils/AMS/hacking/Makefile56
-rw-r--r--utils/AMS/hacking/README9
8 files changed, 68 insertions, 63 deletions
diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile
new file mode 100644
index 0000000000..4040c716b5
--- /dev/null
+++ b/rbutil/mkamsboot/Makefile
@@ -0,0 +1,56 @@
1# Change INFILE to point to your original firmware file
2INFILE=$(HOME)/FW/AMS/CLIP/m300a-1.1.17A.bin
3
4# OUTFILE is the file you copy to your device's root and rename to
5# (e.g.) m300a.bin
6OUTFILE=patched.bin
7
8# The uclpack command
9UCLPACK=../../tools/uclpack
10
11all: $(OUTFILE)
12
13mkamsboot: mkamsboot.c
14 gcc -o mkamsboot -W -Wall mkamsboot.c
15
16extract_fw: extract_fw.c
17 gcc -o extract_fw -W -Wall extract_fw.c
18
19# Rules for our test ARM application - assemble, link, then extract
20# the binary code
21
22test.o: test.S
23 arm-elf-as -o test.o test.S
24
25test.elf: test.o
26 arm-elf-ld -e 0 -Ttext=0 -o test.elf test.o
27
28test.bin: test.elf
29 arm-elf-objcopy -O binary test.elf test.bin
30
31# Rules for the ucl unpack function - this is inserted in the padding at
32# the end of the original firmware block
33nrv2e_d8.o: nrv2e_d8.S
34 arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.o nrv2e_d8.S
35
36# NOTE: this function has no absolute references, so the link address (-e)
37# is irrelevant. We just link at address 0.
38nrv2e_d8.elf: nrv2e_d8.o
39 arm-elf-ld -e 0 -Ttext=0 -o nrv2e_d8.elf nrv2e_d8.o
40
41nrv2e_d8.bin: nrv2e_d8.elf
42 arm-elf-objcopy -O binary nrv2e_d8.elf nrv2e_d8.bin
43
44firmware_block.ucl: firmware_block.bin
45 $(UCLPACK) --best --2e firmware_block.bin firmware_block.ucl
46
47firmware_block.bin: $(INFILE) extract_fw
48 ./extract_fw $(INFILE) firmware_block.bin
49
50$(OUTFILE): mkamsboot firmware_block.ucl test.bin nrv2e_d8.bin $(INFILE)
51 ./mkamsboot $(INFILE) firmware_block.ucl test.bin nrv2e_d8.bin $(OUTFILE)
52
53clean:
54 rm -fr amsinfo mkamsboot test.o test.elf test.bin extract_fw \
55 nrv2e_d8.o nrv2e_d8.elf nrv2e_d8.bin firmware_block.bin \
56 firmware_block.ucl $(OUTFILE) *~
diff --git a/rbutil/mkamsboot/README b/rbutil/mkamsboot/README
new file mode 100644
index 0000000000..bf9ea698a2
--- /dev/null
+++ b/rbutil/mkamsboot/README
@@ -0,0 +1,10 @@
1mkamsboot
2---------
3
4A tool to inject some code (contained in test.S) into a firmware file.
5
6Edit the INFILE variable in the Makefile to point to the original
7firmware file you want to patch, edit "test.S" appropriately, and then
8type "make".
9
10
diff --git a/utils/AMS/hacking/extract_fw.c b/rbutil/mkamsboot/extract_fw.c
index e91d1f8de1..e91d1f8de1 100644
--- a/utils/AMS/hacking/extract_fw.c
+++ b/rbutil/mkamsboot/extract_fw.c
diff --git a/utils/AMS/hacking/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index 52ead58b69..52ead58b69 100644
--- a/utils/AMS/hacking/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
diff --git a/utils/AMS/hacking/nrv2e_d8.S b/rbutil/mkamsboot/nrv2e_d8.S
index 89cb76dead..89cb76dead 100644
--- a/utils/AMS/hacking/nrv2e_d8.S
+++ b/rbutil/mkamsboot/nrv2e_d8.S
diff --git a/utils/AMS/hacking/test.S b/rbutil/mkamsboot/test.S
index a4757b44ce..a4757b44ce 100644
--- a/utils/AMS/hacking/test.S
+++ b/rbutil/mkamsboot/test.S
diff --git a/utils/AMS/hacking/Makefile b/utils/AMS/hacking/Makefile
index 8f48d611c8..1a297bc3ab 100644
--- a/utils/AMS/hacking/Makefile
+++ b/utils/AMS/hacking/Makefile
@@ -1,59 +1,7 @@
1# Change INFILE to point to your original firmware file 1all: amsinfo
2INFILE=$(HOME)/FW/AMS/CLIP/m300a-1.1.17A.bin
3
4# OUTFILE is the file you copy to your device's root and rename to
5# (e.g.) m300a.bin
6OUTFILE=patched.bin
7
8# The uclpack command
9UCLPACK=../../../tools/uclpack
10
11all: amsinfo $(OUTFILE)
12 2
13amsinfo: amsinfo.c 3amsinfo: amsinfo.c
14 gcc -o amsinfo -W -Wall amsinfo.c 4 gcc -o amsinfo -W -Wall amsinfo.c
15 5
16mkamsboot: mkamsboot.c
17 gcc -o mkamsboot -W -Wall mkamsboot.c
18
19extract_fw: extract_fw.c
20 gcc -o extract_fw -W -Wall extract_fw.c
21
22# Rules for our test ARM application - assemble, link, then extract
23# the binary code
24
25test.o: test.S
26 arm-elf-as -o test.o test.S
27
28test.elf: test.o
29 arm-elf-ld -e 0 -Ttext=0 -o test.elf test.o
30
31test.bin: test.elf
32 arm-elf-objcopy -O binary test.elf test.bin
33
34# Rules for the ucl unpack function - this is inserted in the padding at
35# the end of the original firmware block
36nrv2e_d8.o: nrv2e_d8.S
37 arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.o nrv2e_d8.S
38
39# NOTE: this function has no absolute references, so the link address (-e)
40# is irrelevant. We just link at address 0.
41nrv2e_d8.elf: nrv2e_d8.o
42 arm-elf-ld -e 0 -Ttext=0 -o nrv2e_d8.elf nrv2e_d8.o
43
44nrv2e_d8.bin: nrv2e_d8.elf
45 arm-elf-objcopy -O binary nrv2e_d8.elf nrv2e_d8.bin
46
47firmware_block.ucl: firmware_block.bin
48 $(UCLPACK) --best --2e firmware_block.bin firmware_block.ucl
49
50firmware_block.bin: $(INFILE) extract_fw
51 ./extract_fw $(INFILE) firmware_block.bin
52
53$(OUTFILE): mkamsboot firmware_block.ucl test.bin nrv2e_d8.bin $(INFILE)
54 ./mkamsboot $(INFILE) firmware_block.ucl test.bin nrv2e_d8.bin $(OUTFILE)
55
56clean: 6clean:
57 rm -fr amsinfo mkamsboot test.o test.elf test.bin extract_fw \ 7 rm -fr amsinfo
58 nrv2e_d8.o nrv2e_d8.elf nrv2e_d8.bin firmware_block.bin \
59 firmware_block.ucl $(OUTFILE) *~
diff --git a/utils/AMS/hacking/README b/utils/AMS/hacking/README
index ce16f954cd..59bb27ebae 100644
--- a/utils/AMS/hacking/README
+++ b/utils/AMS/hacking/README
@@ -5,12 +5,3 @@ This directory contains the following tools related to the Sansa V2
5 5
6A tool that dumps information from an AMS firmware file. 6A tool that dumps information from an AMS firmware file.
7 7
82) mkamsboot
9
10A tool to inject some code (contained in test.S) into a firmware file.
11
12Edit the INFILE variable in the Makefile to point to the original
13firmware file you want to patch, edit "test.S" appropriately, and then
14type "make".
15
16