summaryrefslogtreecommitdiffstats
path: root/utils/AMS/hacking/Makefile
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-10-01 09:15:44 +0000
committerDave Chapman <dave@dchapman.com>2008-10-01 09:15:44 +0000
commit757f5112e25efbfa71a2d289436a1b285ca46663 (patch)
tree04ab1f66bf8e6d7e8e49a4c0d7180e1250de90a1 /utils/AMS/hacking/Makefile
parentfe72d579969b9b5365fb5f430cd8eb265d2f4d44 (diff)
downloadrockbox-757f5112e25efbfa71a2d289436a1b285ca46663.tar.gz
rockbox-757f5112e25efbfa71a2d289436a1b285ca46663.tar.bz2
rockbox-757f5112e25efbfa71a2d289436a1b285ca46663.zip
Untested (i.e. will almost certainly brick your device if you attempt to use it) first attempt at making mkamsboot store the original firmware as a UCL compressed image. If it works, then this means we have about 40KB (depending on target and OF version) for our bootloader code. I repeat: This is UNTESTED and needs reviewing fully before attempting to install on a device.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18675 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/AMS/hacking/Makefile')
-rw-r--r--utils/AMS/hacking/Makefile35
1 files changed, 30 insertions, 5 deletions
diff --git a/utils/AMS/hacking/Makefile b/utils/AMS/hacking/Makefile
index 7a10c20ae4..8f48d611c8 100644
--- a/utils/AMS/hacking/Makefile
+++ b/utils/AMS/hacking/Makefile
@@ -1,4 +1,3 @@
-
# Change INFILE to point to your original firmware file
INFILE=$(HOME)/FW/AMS/CLIP/m300a-1.1.17A.bin
@@ -6,6 +5,8 @@ INFILE=$(HOME)/FW/AMS/CLIP/m300a-1.1.17A.bin
# (e.g.) m300a.bin
OUTFILE=patched.bin
+# The uclpack command
+UCLPACK=../../../tools/uclpack
all: amsinfo $(OUTFILE)
@@ -15,6 +16,9 @@ amsinfo: amsinfo.c
mkamsboot: mkamsboot.c
gcc -o mkamsboot -W -Wall mkamsboot.c
+extract_fw: extract_fw.c
+ gcc -o extract_fw -W -Wall extract_fw.c
+
# Rules for our test ARM application - assemble, link, then extract
# the binary code
@@ -22,13 +26,34 @@ test.o: test.S
arm-elf-as -o test.o test.S
test.elf: test.o
- arm-elf-ld -e 0 -o test.elf test.o
+ arm-elf-ld -e 0 -Ttext=0 -o test.elf test.o
test.bin: test.elf
arm-elf-objcopy -O binary test.elf test.bin
-$(OUTFILE): mkamsboot test.bin $(INFILE)
- ./mkamsboot $(INFILE) test.bin $(OUTFILE)
+# Rules for the ucl unpack function - this is inserted in the padding at
+# the end of the original firmware block
+nrv2e_d8.o: nrv2e_d8.S
+ arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.o nrv2e_d8.S
+
+# NOTE: this function has no absolute references, so the link address (-e)
+# is irrelevant. We just link at address 0.
+nrv2e_d8.elf: nrv2e_d8.o
+ arm-elf-ld -e 0 -Ttext=0 -o nrv2e_d8.elf nrv2e_d8.o
+
+nrv2e_d8.bin: nrv2e_d8.elf
+ arm-elf-objcopy -O binary nrv2e_d8.elf nrv2e_d8.bin
+
+firmware_block.ucl: firmware_block.bin
+ $(UCLPACK) --best --2e firmware_block.bin firmware_block.ucl
+
+firmware_block.bin: $(INFILE) extract_fw
+ ./extract_fw $(INFILE) firmware_block.bin
+
+$(OUTFILE): mkamsboot firmware_block.ucl test.bin nrv2e_d8.bin $(INFILE)
+ ./mkamsboot $(INFILE) firmware_block.ucl test.bin nrv2e_d8.bin $(OUTFILE)
clean:
- rm -fr amsinfo mkamsboot test.bin test.o test.elf $(OUTFILE) *~
+ rm -fr amsinfo mkamsboot test.o test.elf test.bin extract_fw \
+ nrv2e_d8.o nrv2e_d8.elf nrv2e_d8.bin firmware_block.bin \
+ firmware_block.ucl $(OUTFILE) *~