mkamsboot: supports Fuze firmwares

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18936 a1c6a512-1295-4272-9138-f99709370657
diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile
index ea8ca27..93a25ae 100644
--- a/rbutil/mkamsboot/Makefile
+++ b/rbutil/mkamsboot/Makefile
@@ -10,8 +10,8 @@
 #
 # If anyone reading this wants to improve this makefile, please do!
 
-BOOTIMAGES = bootimg_clip.o bootimg_e200v2.o bootimg_m200v2.o
-BOOTHEADERS = bootimg_clip.h bootimg_e200v2.h bootimg_m200v2.h
+BOOTIMAGES = bootimg_clip.o bootimg_e200v2.o bootimg_m200v2.o bootimg_fuze.o
+BOOTHEADERS = bootimg_clip.h bootimg_e200v2.h bootimg_m200v2.h bootimg_fuze.h
 
 CLIPFILES = dualboot-clip.o dualboot-clip.elf dualboot-clip.o \
             dualboot-clip.bin bootimg_clip.c bootimg_clip.h
@@ -22,6 +22,9 @@
 M200V2FILES = dualboot-m200v2.o dualboot-m200v2.elf dualboot-m200v2.o \
               dualboot-m200v2.bin bootimg_m200v2.c bootimg_m200v2.h
 
+FUZEFILES = dualboot-fuze.o dualboot-fuze.elf dualboot-fuze.o \
+              dualboot-fuze.bin bootimg_fuze.c bootimg_fuze.h
+
 all: mkamsboot
 
 $(LIBUCL):
@@ -56,6 +59,23 @@
 bootimg_clip.o: bootimg_clip.c
 	gcc -c -o bootimg_clip.o bootimg_clip.c
 
+# FUZE
+
+dualboot-fuze.o: dualboot.S
+	arm-elf-gcc -DSANSA_FUZE -c -o dualboot-fuze.o dualboot.S
+
+dualboot-fuze.elf: dualboot-fuze.o
+	arm-elf-ld -e 0 -Ttext=0 -o dualboot-fuze.elf dualboot-fuze.o
+
+dualboot-fuze.bin: dualboot-fuze.elf
+	arm-elf-objcopy -O binary dualboot-fuze.elf dualboot-fuze.bin
+
+bootimg_fuze.c bootimg_fuze.h: dualboot-fuze.bin bin2c
+	./bin2c dualboot-fuze.bin bootimg_fuze
+
+bootimg_fuze.o: bootimg_fuze.c
+	gcc -c -o bootimg_fuze.o bootimg_fuze.c
+
 # E200V2
 
 dualboot-e200v2.o: dualboot.S
@@ -114,4 +134,4 @@
 clean:
 	rm -f mkamsboot mkamsboot.o nrv2e_d8.o nrv2e_d8.elf nrv2e_d8.bin *~ \
 	bin2c uclimg.c uclimg.h uclimg.o md5.o \
-	$(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) $(M200V2FILES)
+	$(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) $(M200V2FILES) $(FUZEFILES)
diff --git a/rbutil/mkamsboot/dualboot.S b/rbutil/mkamsboot/dualboot.S
index 4fac02f..e3033de 100644
--- a/rbutil/mkamsboot/dualboot.S
+++ b/rbutil/mkamsboot/dualboot.S
@@ -132,6 +132,8 @@
         /* check value read (0 means button pressed) */
         cmp   r2, #0
         beq   boot_of
+#elif defined(SANSA_FUZE)
+        /* no pinout known except A3 */
 #else
         #error No target-specific key check defined!
 #endif
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index f2fc819..476bdf2 100644
--- a/rbutil/mkamsboot/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
@@ -91,6 +91,7 @@
 
 #include "bootimg_clip.h"
 #include "bootimg_e200v2.h"
+#include "bootimg_fuze.h"
 #include "bootimg_m200v2.h"
 
 /* Win32 compatibility */
@@ -125,7 +126,7 @@
 
 static const unsigned char* bootloaders[] = 
 {
-    NULL,
+    bootimg_fuze,
     bootimg_clip,
     NULL,
     bootimg_e200v2,
@@ -135,7 +136,7 @@
 
 static const int bootloader_sizes[] = 
 {
-    0,
+    sizeof(bootimg_fuze),
     sizeof(bootimg_clip),
     0,
     sizeof(bootimg_e200v2),
@@ -147,7 +148,7 @@
    -add parameter to the "scramble" tool */
 static const char* rb_model_names[] =
 {
-    NULL,
+    "fuze",
     "clip",
     NULL,
     "e2v2",
@@ -159,7 +160,7 @@
    ".sansa" files - these are the same as MODEL_NUMBER in config-target.h */
 static const int rb_model_num[] =
 {
-    0,
+    43,
     40,
     0,
     41,