diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-29 21:31:50 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-29 21:31:50 +0000 |
commit | ad785518111eabe4518dca485421e533186f63a5 (patch) | |
tree | 1933da66814ac5bb19b7b7f87bc2ab56ea27ed1d /rbutil/rbutilqt | |
parent | 0f90f0b423674494a648a0bb8fd2cfe31f29b68b (diff) | |
download | rockbox-ad785518111eabe4518dca485421e533186f63a5.tar.gz rockbox-ad785518111eabe4518dca485421e533186f63a5.zip |
FS#10728 - Cowon D2: Add support for D2 in rbutil
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23410 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstalltcc.cpp | 154 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstalltcc.h | 45 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutil.ini | 15 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 4 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.pro | 16 |
5 files changed, 228 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstalltcc.cpp b/rbutil/rbutilqt/base/bootloaderinstalltcc.cpp new file mode 100644 index 0000000000..1d0a9e606e --- /dev/null +++ b/rbutil/rbutilqt/base/bootloaderinstalltcc.cpp | |||
@@ -0,0 +1,154 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2009 by Tomer Shalev | ||
10 | * $Id$ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | * This file is a modified version of the AMS installer by Dominik Wenger | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include <QtCore> | ||
23 | #include "bootloaderinstallbase.h" | ||
24 | #include "bootloaderinstalltcc.h" | ||
25 | #include "../mktccboot/mktccboot.h" | ||
26 | |||
27 | BootloaderInstallTcc::BootloaderInstallTcc(QObject *parent) | ||
28 | : BootloaderInstallBase(parent) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | QString BootloaderInstallTcc::ofHint() | ||
33 | { | ||
34 | return tr("Bootloader installation requires you to provide " | ||
35 | "a firmware file of the original firmware (bin file). " | ||
36 | "You need to download this file yourself due to legal " | ||
37 | "reasons." | ||
38 | "Press Ok to continue and browse your computer for the firmware " | ||
39 | "file."); | ||
40 | } | ||
41 | |||
42 | bool BootloaderInstallTcc::install(void) | ||
43 | { | ||
44 | if(m_offile.isEmpty()) | ||
45 | return false; | ||
46 | |||
47 | // Download firmware from server | ||
48 | emit logItem(tr("Downloading bootloader file"), LOGINFO); | ||
49 | |||
50 | connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); | ||
51 | downloadBlStart(m_blurl); | ||
52 | |||
53 | return true; | ||
54 | } | ||
55 | |||
56 | void BootloaderInstallTcc::installStage2(void) | ||
57 | { | ||
58 | unsigned char *of_buf, *boot_buf = NULL, *patched_buf = NULL; | ||
59 | int n, of_size, boot_size, patched_size; | ||
60 | char errstr[200]; | ||
61 | bool ret = false; | ||
62 | |||
63 | m_tempfile.open(); | ||
64 | QString bootfile = m_tempfile.fileName(); | ||
65 | m_tempfile.close(); | ||
66 | |||
67 | /* Construct path for write out. | ||
68 | * Combine path of m_blfile with filename from OF */ | ||
69 | QString outfilename = QFileInfo(m_blfile).absolutePath() + "/" + | ||
70 | QFileInfo(m_offile).fileName(); | ||
71 | |||
72 | /* Write out file */ | ||
73 | QFile out(outfilename); | ||
74 | |||
75 | /* Load original firmware file */ | ||
76 | of_buf = file_read(m_offile.toLocal8Bit().data(), &of_size); | ||
77 | if (of_buf == NULL) | ||
78 | { | ||
79 | emit logItem(errstr, LOGERROR); | ||
80 | emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR); | ||
81 | goto exit; | ||
82 | } | ||
83 | |||
84 | /* Load bootloader file */ | ||
85 | boot_buf = file_read(bootfile.toLocal8Bit().data(), &boot_size); | ||
86 | if (boot_buf == NULL) | ||
87 | { | ||
88 | emit logItem(errstr, LOGERROR); | ||
89 | emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR); | ||
90 | goto exit; | ||
91 | } | ||
92 | |||
93 | /* Patch the firmware */ | ||
94 | emit logItem(tr("Patching Firmware..."), LOGINFO); | ||
95 | |||
96 | patched_buf = patch_firmware_tcc(of_buf, of_size, boot_buf, boot_size, | ||
97 | &patched_size); | ||
98 | if (patched_buf == NULL) | ||
99 | { | ||
100 | emit logItem(errstr, LOGERROR); | ||
101 | emit logItem(tr("Could patch firmware"), LOGERROR); | ||
102 | goto exit; | ||
103 | } | ||
104 | |||
105 | if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate)) | ||
106 | { | ||
107 | emit logItem(tr("Could not open %1 for writing").arg(m_blfile), | ||
108 | LOGERROR); | ||
109 | goto exit; | ||
110 | } | ||
111 | |||
112 | n = out.write((char*)patched_buf, patched_size); | ||
113 | out.close(); | ||
114 | if (n != patched_size) | ||
115 | { | ||
116 | emit logItem(tr("Could not write firmware file"), LOGERROR); | ||
117 | goto exit; | ||
118 | } | ||
119 | |||
120 | /* End of install */ | ||
121 | emit logItem(tr("Success: modified firmware file created"), LOGINFO); | ||
122 | logInstall(LogAdd); | ||
123 | |||
124 | ret = true; | ||
125 | |||
126 | exit: | ||
127 | if (of_buf) | ||
128 | free(of_buf); | ||
129 | |||
130 | if (boot_buf) | ||
131 | free(boot_buf); | ||
132 | |||
133 | if (patched_buf) | ||
134 | free(patched_buf); | ||
135 | |||
136 | emit done(ret); | ||
137 | } | ||
138 | |||
139 | bool BootloaderInstallTcc::uninstall(void) | ||
140 | { | ||
141 | emit logItem("To uninstall, perform a normal upgrade with an unmodified original firmware", LOGINFO); | ||
142 | logInstall(LogRemove); | ||
143 | return false; | ||
144 | } | ||
145 | |||
146 | BootloaderInstallBase::BootloaderType BootloaderInstallTcc::installed(void) | ||
147 | { | ||
148 | return BootloaderUnknown; | ||
149 | } | ||
150 | |||
151 | BootloaderInstallBase::Capabilities BootloaderInstallTcc::capabilities(void) | ||
152 | { | ||
153 | return (Install | NeedsOf); | ||
154 | } | ||
diff --git a/rbutil/rbutilqt/base/bootloaderinstalltcc.h b/rbutil/rbutilqt/base/bootloaderinstalltcc.h new file mode 100644 index 0000000000..b91970034e --- /dev/null +++ b/rbutil/rbutilqt/base/bootloaderinstalltcc.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2009 by Tomer Shalev | ||
10 | * $Id$ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | * This file is a modified version of the AMS installer by Dominik Wenger | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef BOOTLOADERINSTALLTCC_H | ||
22 | #define BOOTLOADERINSTALLTCC_H | ||
23 | |||
24 | #include <QtCore> | ||
25 | #include "bootloaderinstallbase.h" | ||
26 | |||
27 | //! bootloader installation derivate based on mktccboot | ||
28 | class BootloaderInstallTcc : public BootloaderInstallBase | ||
29 | { | ||
30 | Q_OBJECT | ||
31 | public: | ||
32 | BootloaderInstallTcc(QObject *parent); | ||
33 | bool install(void); | ||
34 | bool uninstall(void); | ||
35 | BootloaderInstallBase::BootloaderType installed(void); | ||
36 | Capabilities capabilities(void); | ||
37 | QString ofHint(); | ||
38 | |||
39 | private: | ||
40 | |||
41 | private slots: | ||
42 | void installStage2(void); | ||
43 | }; | ||
44 | |||
45 | #endif | ||
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini index 9face81edf..46559fb3c1 100644 --- a/rbutil/rbutilqt/rbutil.ini +++ b/rbutil/rbutilqt/rbutil.ini | |||
@@ -58,7 +58,7 @@ platform60=mrobe100 | |||
58 | platform70=smsgyh820 | 58 | platform70=smsgyh820 |
59 | platform71=smsgyh920 | 59 | platform71=smsgyh920 |
60 | platform72=smsgyh925 | 60 | platform72=smsgyh925 |
61 | 61 | platform73=cowond2 | |
62 | 62 | ||
63 | [player] | 63 | [player] |
64 | name="Jukebox Player 6000 / Jukebox Studio 5 / 10 / 20" | 64 | name="Jukebox Player 6000 / Jukebox Studio 5 / 10 / 20" |
@@ -537,6 +537,19 @@ usbid=0x04e85024 | |||
537 | configure_modelname=yh925 | 537 | configure_modelname=yh925 |
538 | encoder=rbspeex | 538 | encoder=rbspeex |
539 | 539 | ||
540 | [cowond2] | ||
541 | name="D2 (Unstable)" | ||
542 | buildserver_modelname=cowond2 | ||
543 | bootloadermethod=tcc | ||
544 | bootloadername=/cowon/d2.bin | ||
545 | bootloaderfile=d2n.bin | ||
546 | manualname= | ||
547 | brand=Cowon | ||
548 | usbid=0x0e210800, 0x0e210860, 0x0e210870, 0x0e210880, 0x0e210890 | ||
549 | usberror=0x0e210801, 0x0e210861, 0x0e210871, 0x0e210881, 0x0e210891 | ||
550 | configure_modelname=cowond2 | ||
551 | encoder=rbspeex | ||
552 | |||
540 | [05ac1240] | 553 | [05ac1240] |
541 | name="Apple Ipod Nano (Second Generation, DFU Mode)" | 554 | name="Apple Ipod Nano (Second Generation, DFU Mode)" |
542 | 555 | ||
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index df8b4d878d..fd5983306d 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "bootloaderinstallfile.h" | 47 | #include "bootloaderinstallfile.h" |
48 | #include "bootloaderinstallchinachip.h" | 48 | #include "bootloaderinstallchinachip.h" |
49 | #include "bootloaderinstallams.h" | 49 | #include "bootloaderinstallams.h" |
50 | #include "bootloaderinstalltcc.h" | ||
50 | 51 | ||
51 | 52 | ||
52 | #if defined(Q_OS_LINUX) | 53 | #if defined(Q_OS_LINUX) |
@@ -673,6 +674,9 @@ void RbUtilQt::installBootloader() | |||
673 | else if(type == "ams") { | 674 | else if(type == "ams") { |
674 | bl = new BootloaderInstallAms(this); | 675 | bl = new BootloaderInstallAms(this); |
675 | } | 676 | } |
677 | else if(type == "tcc") { | ||
678 | bl = new BootloaderInstallTcc(this); | ||
679 | } | ||
676 | else { | 680 | else { |
677 | logger->addItem(tr("No install method known."), LOGERROR); | 681 | logger->addItem(tr("No install method known."), LOGERROR); |
678 | logger->setFinished(); | 682 | logger->setFinished(); |
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index c1178b8967..b04667028b 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro | |||
@@ -42,14 +42,16 @@ LIBSPEEX = $$system(pkg-config --silence-errors --libs speex) | |||
42 | rbspeex.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex librbspeex.a | 42 | rbspeex.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex librbspeex.a |
43 | libucl.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src libucl.a | 43 | libucl.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src libucl.a |
44 | libmkamsboot.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot libmkamsboot.a | 44 | libmkamsboot.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot libmkamsboot.a |
45 | libmktccboot.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot libmktccboot.a | ||
45 | } | 46 | } |
46 | mac { | 47 | mac { |
47 | rbspeex.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex librbspeex-universal | 48 | rbspeex.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex librbspeex-universal |
48 | libucl.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src libucl-universal | 49 | libucl.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src libucl-universal |
49 | libmkamsboot.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot libmkamsboot-universal | 50 | libmkamsboot.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot libmkamsboot-universal |
51 | libmktccboot.commands = @$(MAKE) TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot libmktccboot-universal | ||
50 | } | 52 | } |
51 | QMAKE_EXTRA_TARGETS += rbspeex libucl libmkamsboot | 53 | QMAKE_EXTRA_TARGETS += rbspeex libucl libmkamsboot libmktccboot |
52 | PRE_TARGETDEPS += rbspeex libucl libmkamsboot | 54 | PRE_TARGETDEPS += rbspeex libucl libmkamsboot libmktccboot |
53 | 55 | ||
54 | # rule for creating ctags file | 56 | # rule for creating ctags file |
55 | tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES) | 57 | tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES) |
@@ -110,8 +112,10 @@ SOURCES += rbutilqt.cpp \ | |||
110 | base/bootloaderinstallfile.cpp \ | 112 | base/bootloaderinstallfile.cpp \ |
111 | base/bootloaderinstallchinachip.cpp \ | 113 | base/bootloaderinstallchinachip.cpp \ |
112 | base/bootloaderinstallams.cpp \ | 114 | base/bootloaderinstallams.cpp \ |
115 | base/bootloaderinstalltcc.cpp \ | ||
113 | ../../tools/mkboot.c \ | 116 | ../../tools/mkboot.c \ |
114 | ../../tools/iriver.c | 117 | ../../tools/iriver.c \ |
118 | ../../tools/telechips.c \ | ||
115 | 119 | ||
116 | HEADERS += rbutilqt.h \ | 120 | HEADERS += rbutilqt.h \ |
117 | install.h \ | 121 | install.h \ |
@@ -170,8 +174,10 @@ HEADERS += rbutilqt.h \ | |||
170 | base/bootloaderinstallfile.h \ | 174 | base/bootloaderinstallfile.h \ |
171 | base/bootloaderinstallchinachip.h \ | 175 | base/bootloaderinstallchinachip.h \ |
172 | base/bootloaderinstallams.h \ | 176 | base/bootloaderinstallams.h \ |
177 | base/bootloaderinstalltcc.h \ | ||
173 | ../../tools/mkboot.h \ | 178 | ../../tools/mkboot.h \ |
174 | ../../tools/iriver.h | 179 | ../../tools/iriver.h \ |
180 | ../../tools/telechips.h \ | ||
175 | 181 | ||
176 | # Needed by QT on Win | 182 | # Needed by QT on Win |
177 | INCLUDEPATH = $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools $$_PRO_FILE_PWD_/zip $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/base | 183 | INCLUDEPATH = $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools $$_PRO_FILE_PWD_/zip $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/base |
@@ -179,7 +185,7 @@ INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher | |||
179 | 185 | ||
180 | DEPENDPATH = $$INCLUDEPATH | 186 | DEPENDPATH = $$INCLUDEPATH |
181 | 187 | ||
182 | LIBS += -L$$OUT_PWD -L$$MYBUILDDIR -lrbspeex -lmkamsboot -lucl | 188 | LIBS += -L$$OUT_PWD -L$$MYBUILDDIR -lrbspeex -lmkamsboot -lmktccboot -lucl |
183 | 189 | ||
184 | TEMPLATE = app | 190 | TEMPLATE = app |
185 | dbg { | 191 | dbg { |