summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2012-03-04 15:34:29 +0100
committerMarcin Bukat <marcin.bukat@gmail.com>2013-06-27 13:50:11 +0200
commit0b29691324e5700f15ea653592bf29f8552d47d7 (patch)
tree00e4f77f28c813a493cd8af22170f486f6e82903 /firmware/export
parent46ea8bfe7c690c8db230fff3a582a69779f8e432 (diff)
downloadrockbox-0b29691324e5700f15ea653592bf29f8552d47d7.zip
rockbox-0b29691324e5700f15ea653592bf29f8552d47d7.tar.gz
rockbox-0b29691324e5700f15ea653592bf29f8552d47d7.tar.bz2
rockbox-0b29691324e5700f15ea653592bf29f8552d47d7.tar.xz
Move load_firmware() to separate file
The idea is to share loading code between bootloaders and rolo(). Change-Id: I1656ed91946d7a05cb7c9fa7a16793c3c862a5cd Reviewed-on: http://gerrit.rockbox.org/190 Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/mi4-loader.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/firmware/export/mi4-loader.h b/firmware/export/mi4-loader.h
new file mode 100644
index 0000000..1b4a4b9
--- /dev/null
+++ b/firmware/export/mi4-loader.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2006 by Barry Wardell
+ *
+ * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
+ * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <stdint.h>
+
+#define MI4_HEADER_SIZE 0x200
+
+/* mi4 header structure */
+struct mi4header_t {
+ unsigned char magic[4];
+ uint32_t version;
+ uint32_t length;
+ uint32_t crc32;
+ uint32_t enctype;
+ uint32_t mi4size;
+ uint32_t plaintext;
+ uint32_t dsa_key[10];
+ uint32_t pad[109];
+ unsigned char type[4];
+ unsigned char model[4];
+};
+
+struct tea_key {
+ const char * name;
+ uint32_t key[4];
+};
+
+#define NUM_KEYS (sizeof(tea_keytable)/sizeof(tea_keytable[0]))
+
+int load_mi4(unsigned char* buf, const char* firmware, unsigned int buffer_size);
+const char *mi4_strerror(int8_t errno);