diff --git a/rbutil/mkamsboot/dualboot/Makefile b/rbutil/mkamsboot/dualboot/Makefile
index 06b90c7..604a351 100644
--- a/rbutil/mkamsboot/dualboot/Makefile
+++ b/rbutil/mkamsboot/dualboot/Makefile
@@ -4,8 +4,8 @@ CC=gcc
# adding a new target. mkamsboot.c also needs to be edited to refer to these
# new images.

-BOOTOBJS = nrv2e_d8.o dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o dualboot_clipv2.o
-BOOTBINS = nrv2e_d8.arm-bin dualboot_clip.arm-bin dualboot_e200v2.arm-bin dualboot_c200v2.arm-bin dualboot_m200v4.arm-bin dualboot_fuze.arm-bin dualboot_clipv2.arm-bin
+BOOTOBJS = nrv2e_d8.o dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o dualboot_clipv2.o dualboot_fuzev2.o
+BOOTBINS = nrv2e_d8.arm-bin dualboot_clip.arm-bin dualboot_e200v2.arm-bin dualboot_c200v2.arm-bin dualboot_m200v4.arm-bin dualboot_fuze.arm-bin dualboot_clipv2.arm-bin dualboot_fuzev2.arm-bin

all: dualboot.h

@@ -31,6 +31,9 @@ dualboot_c200v2.o: dualboot.S
dualboot_clipv2.o: dualboot.S
arm-elf-gcc -DSANSA_CLIPV2 -c -o dualboot_clipv2.o dualboot.S

+dualboot_fuzev2.o: dualboot.S
+ arm-elf-gcc -DSANSA_FUZEV2 -c -o dualboot_fuzev2.o dualboot.S
+
# Rules for the ucl unpack function
nrv2e_d8.o: nrv2e_d8.S
arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.o nrv2e_d8.S
diff --git a/rbutil/mkamsboot/dualboot/dualboot.S b/rbutil/mkamsboot/dualboot/dualboot.S
index 5210ba5..fc5049c 100644
--- a/rbutil/mkamsboot/dualboot/dualboot.S
+++ b/rbutil/mkamsboot/dualboot/dualboot.S
@@ -180,6 +180,19 @@ uclcopy:
/* check value read (1 means button pressed) */
cmp r2, #0
bne boot_of
+#elif defined(SANSA_FUZEV2)
+ ldr r0, =GPIOC
+ mov r1, #0
+ str r1, [r0, #0x400]
+
+ ldr r0, [r0, #0x20]
+ cmp r0, #0
+ beq boot_of @ if the pin is unset, boot immediately
+ @ else, boot after a noticeable delay
+
+delay: mov r0, #0x3000000
+1: subs r0, r0, #1
+ bne 1b
#else
#error No target-specific key check defined!
#endif
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index fb0e3cb..eff99cf 100644
--- a/rbutil/mkamsboot/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
@@ -117,6 +117,7 @@ static const unsigned short hw_revisions[] = {
[MODEL_E200V2] = 2,
[MODEL_M200V4] = 4,
[MODEL_C200V2] = 2,
+ [MODEL_FUZEV2] = 2,
};

/* version 2 is used in Clipv2 and Fuzev2 firmwares */
@@ -127,6 +128,7 @@ static const unsigned short fw_revisions[] = {
[MODEL_E200V2] = 1,
[MODEL_M200V4] = 1,
[MODEL_C200V2] = 1,
+ [MODEL_FUZEV2] = 2,
};

/* Descriptive name of these models */
@@ -137,6 +139,7 @@ static const char* model_names[] = {
[MODEL_E200V2] = "e200",
[MODEL_M200V4] = "m200",
[MODEL_C200V2] = "c200",
+ [MODEL_FUZEV2] = "Fuze",
};

/* Dualboot functions for these models */
@@ -147,6 +150,7 @@ static const unsigned char* bootloaders[] = {
[MODEL_E200V2] = dualboot_e200v2,
[MODEL_M200V4] = dualboot_m200v4,
[MODEL_C200V2] = dualboot_c200v2,
+ [MODEL_FUZEV2] = dualboot_fuzev2,
};

/* Size of dualboot functions for these models */
@@ -157,6 +161,7 @@ static const int bootloader_sizes[] = {
[MODEL_E200V2] = sizeof(dualboot_e200v2),
[MODEL_M200V4] = sizeof(dualboot_m200v4),
[MODEL_C200V2] = sizeof(dualboot_c200v2),
+ [MODEL_FUZEV2] = sizeof(dualboot_fuzev2),
};

/* Model names used in the Rockbox header in ".sansa" files - these match the
@@ -168,6 +173,7 @@ static const char* rb_model_names[] = {
[MODEL_E200V2] = "e2v2",
[MODEL_M200V4] = "m2v4",
[MODEL_C200V2] = "c2v2",
+ [MODEL_FUZEV2] = "fzv2",
};

/* Model numbers used to initialise the checksum in the Rockbox header in
@@ -179,6 +185,7 @@ static const int rb_model_num[] = {
[MODEL_E200V2] = 41,
[MODEL_M200V4] = 42,
[MODEL_C200V2] = 44
+ [MODEL_FUZEV2] = 99,
};

/* Checksums of unmodified original firmwares - for safety, and device
@@ -211,7 +218,9 @@ static struct md5sums sansasums[] = {
{ MODEL_CLIP, "1.01.32", "d835d12342500732ffb9c4ee54abec15" },

{ MODEL_CLIPV2, "2.01.16", "c57fb3fcbe07c2c9b360f060938f80cb" },
- { MODEL_CLIPV2, "2.01.32", "0ad3723e52022509089d938d0fbbf8c5" }
+ { MODEL_CLIPV2, "2.01.32", "0ad3723e52022509089d938d0fbbf8c5" },
+
+ { MODEL_FUZEV2, "2.02.26", "d4f6f85c3e4a8ea8f2e5acc421641801" },
};

#define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0]))
@@ -287,6 +296,8 @@ static int get_model(int model_id)
return MODEL_M200V4;
case 0x27:
return MODEL_CLIPV2;
+ case 0x70:
+ return MODEL_FUZEV2;
}

return MODEL_UNKNOWN;
diff --git a/rbutil/mkamsboot/mkamsboot.h b/rbutil/mkamsboot/mkamsboot.h
index a14b320..6b50160 100644
--- a/rbutil/mkamsboot/mkamsboot.h
+++ b/rbutil/mkamsboot/mkamsboot.h
@@ -37,6 +37,7 @@ enum {
MODEL_E200V2,
MODEL_M200V4,
MODEL_C200V2,
+ MODEL_FUZEV2,
};