Index: apps/plugins/SUBDIRS =================================================================== --- apps/plugins/SUBDIRS (revision 21166) +++ apps/plugins/SUBDIRS (working copy) @@ -46,6 +46,7 @@ /* For all the swcodec targets */ #if CONFIG_CODEC == SWCODEC midi +pdbox /* beatbox */ #ifndef RB_PROFILE #if MEMORYSIZE > 2 /* mpegplayer allocates at least 2MB of RAM */ Index: rbutil/rbutilqt/base/bootloaderinstallams.cpp =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallams.cpp (revision 0) +++ rbutil/rbutilqt/base/bootloaderinstallams.cpp (revision 0) @@ -0,0 +1,186 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2008 by Dominik Wenger + * $Id: bootloaderinstallhex.cpp 19724 2009-01-08 17:16:53Z bluebrother $ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include "bootloaderinstallbase.h" +#include "bootloaderinstallams.h" + +extern "C" +{ + #include "../mkamsboot/mkamsboot.h" +}; + +//remove me +#include + + +BootloaderInstallAms::BootloaderInstallAms(QObject *parent) + : BootloaderInstallBase(parent) +{ +} + +QString BootloaderInstallAms::ofHint() +{ + return tr("Bootloader installation requires you to provide " + "a firmware file of the original firmware (bin file). " + "You need to download this file yourself due to legal " + "reasons." + "Press Ok to continue and browse your computer for the firmware " + "file."); +} + +bool BootloaderInstallAms::install(void) +{ + if(m_offile.isEmpty()) + return false; + + // download firmware from server + emit logItem(tr("Downloading bootloader file"), LOGINFO); + + // remove me + installStage2(); +#if 0 // no bootloader on server available + connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); + downloadBlStart(m_blurl); +#endif + + return true; +} + + +void BootloaderInstallAms::installStage2(void) +{ + unsigned char* buf; + unsigned char* of_packed; + int of_packedsize; + unsigned char* rb_packed; + int rb_packedsize; + off_t len; + char md5sum[33]; /* 32 hex digits, plus terminating zero */ + int n; + int model; + int fw_version; + int firmware_size; + int bootloader_size; + int totalsize; + char errstr[200]; + + // remove me + QString bootfile = QFileDialog::getOpenFileName(NULL,"Select bootloader","","*.sansa"); +#if 0 // No bootloader on server for now + m_tempfile.open(); + bootfile = m_tempfile.fileName(): + m_tempfile.close(); +#endif + + /* Load original firmware file */ + buf = load_of_file(m_offile.toLocal8Bit().data(), &len,md5sum,&model,&fw_version,&firmware_size, + &of_packed,&of_packedsize,errstr,sizeof(errstr)); + if (buf == NULL) + { + emit logItem(errstr, LOGERROR); + emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR); + emit done(true); + return; + } + + /* Load bootloader file */ + rb_packed = load_rockbox_file(bootfile.toLocal8Bit().data(), model, &bootloader_size,&rb_packedsize, + errstr,sizeof(errstr)); + if (rb_packed == NULL) + { + emit logItem(errstr, LOGERROR); + emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR); + free(buf); + free(of_packed); + emit done(true); + return; + } + + /* check total size */ + totalsize = total_size(model,rb_packedsize,of_packedsize); + if (totalsize > firmware_size) + { + emit logItem("No room to insert bootloader",LOGERROR); + free(buf); + free(of_packed); + free(rb_packed); + emit done(true); + return; + } + + /* patch the firmware */ + emit logItem(tr("Patching Firmware..."), LOGINFO); + + patch_firmware(model,fw_version,firmware_size,buf,len,of_packed,of_packedsize,rb_packed,rb_packedsize); + + /* write out file*/ + QFile out(m_blfile); + + if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate)) + { + emit logItem(tr("Could not open %1 for writing").arg(m_blfile),LOGERROR); + free(buf); + free(of_packed); + free(rb_packed); + emit done(true); + return; + } + + n = out.write((char*)buf, len); + + if (n != len) + { + emit logItem(tr("Could not write firmware file"),LOGERROR); + free(buf); + free(of_packed); + free(rb_packed); + emit done(true); + return; + } + + out.close(); + + free(buf); + free(of_packed); + free(rb_packed); + + //end of install + emit logItem(tr("Success: modified firmware file created"), LOGINFO); + logInstall(LogAdd); + emit done(false); + return; +} + +bool BootloaderInstallAms::uninstall(void) +{ + emit logItem("Uninstallation not possible, only installation info removed", LOGINFO); + logInstall(LogRemove); + return false; +} + +BootloaderInstallBase::BootloaderType BootloaderInstallAms::installed(void) +{ + return BootloaderUnknown; +} + +BootloaderInstallBase::Capabilities BootloaderInstallAms::capabilities(void) +{ + return (Install | NeedsOf); +} Index: rbutil/rbutilqt/base/bootloaderinstallams.h =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallams.h (revision 0) +++ rbutil/rbutilqt/base/bootloaderinstallams.h (revision 0) @@ -0,0 +1,43 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2008 by Dominik Wenger + * $Id: bootloaderinstallhex.h 18788 2008-10-12 19:21:58Z bluebrother $ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef BOOTLOADERINSTALLAMS_H +#define BOOTLOADERINSTALLAMS_H + +#include +#include "bootloaderinstallbase.h" + +//! bootloader installation derivate based on mkamsboot +class BootloaderInstallAms : public BootloaderInstallBase +{ + Q_OBJECT + public: + BootloaderInstallAms(QObject *parent); + bool install(void); + bool uninstall(void); + BootloaderInstallBase::BootloaderType installed(void); + Capabilities capabilities(void); + QString ofHint(); + + private: + + private slots: + void installStage2(void); +}; + +#endif Index: rbutil/rbutilqt/rbutil.ini =================================================================== --- rbutil/rbutilqt/rbutil.ini (revision 21166) +++ rbutil/rbutilqt/rbutil.ini (working copy) @@ -45,10 +45,10 @@ platform40=gigabeatf platform50=sansae200 platform51=sansac200 +platform52=sansae200v2 platform60=mrobe100 - [player] name="Jukebox Player 6000 / Jukebox Studio 5 / 10 / 20" buildserver_modelname=player @@ -420,7 +420,6 @@ brand=Sandisk usbid=0x07817421 usberror=0x07810720 -usbincompat=0x07817422, 0x07817423 configure_modelname=e200 targetid=23 encoder=rbspeex @@ -438,6 +437,22 @@ targetid=30 encoder=rbspeex +[sansae200v2] +name="Sansa e200v2 series" +buildserver_modelname=sansae200v2 +bootloadermethod=ams +bootloadername= +bootloaderfile=/e200pa.bin +resolution=176x220x16 +manualname= +brand=Sandisk +usbid=0x07817423 +usberror=0x07810722 +configure_modelname=e200v2 +targetid=51 +encoder=rbspeex + + [mrobe100] name="m:robe100" buildserver_modelname=mrobe100 Index: rbutil/rbutilqt/rbutilqt.cpp =================================================================== --- rbutil/rbutilqt/rbutilqt.cpp (revision 21166) +++ rbutil/rbutilqt/rbutilqt.cpp (working copy) @@ -44,7 +44,9 @@ #include "bootloaderinstallipod.h" #include "bootloaderinstallsansa.h" #include "bootloaderinstallfile.h" +#include "bootloaderinstallams.h" + #if defined(Q_OS_LINUX) #include #endif @@ -646,6 +648,9 @@ else if(type == "file") { bl = new BootloaderInstallFile(this); } + else if(type == "ams") { + bl = new BootloaderInstallAms(this); + } else { logger->addItem(tr("No install method known."), LOGERROR); logger->setFinished(); Index: rbutil/rbutilqt/rbutilqt.pro =================================================================== --- rbutil/rbutilqt/rbutilqt.pro (revision 21166) +++ rbutil/rbutilqt/rbutilqt.pro (working copy) @@ -42,9 +42,17 @@ PRE_TARGETDEPS += lrelease } +#custum rules for libmkamsboot.a +libucl.commands = @$(MAKE) -C ../../tools/ucl/src libucl.a +QMAKE_EXTRA_TARGETS += libucl +PRE_TARGETDEPS += libucl +libmkamsboot.commands = @$(MAKE) -C ../mkamsboot libmkamsboot.a +QMAKE_EXTRA_TARGETS += libmkamsboot +PRE_TARGETDEPS += libmkamsboot + SOURCES += rbutilqt.cpp \ - main.cpp \ + main.cpp \ install.cpp \ base/httpget.cpp \ configure.cpp \ @@ -82,6 +90,7 @@ base/bootloaderinstallipod.cpp \ base/bootloaderinstallsansa.cpp \ base/bootloaderinstallfile.cpp \ + base/bootloaderinstallams.cpp \ ../../tools/mkboot.c \ ../../tools/iriver.c @@ -134,14 +143,15 @@ base/bootloaderinstallipod.h \ base/bootloaderinstallsansa.h \ base/bootloaderinstallfile.h \ + base/bootloaderinstallams.h \ ../../tools/mkboot.h \ - ../../tools/iriver.h - + ../../tools/iriver.h + # Needed by QT on Win INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools INCLUDEPATH += base -LIBS += -L../../tools/rbspeex -lrbspeex +LIBS += -L../../tools/rbspeex -lrbspeex -L../mkamsboot -lmkamsboot -L../../tools/ucl/src/ -lucl TEMPLATE = app dbg {