Index: rbutil/rbutilqt/rbutil.ini
===================================================================
--- rbutil/rbutilqt/rbutil.ini	(révision 31403)
+++ rbutil/rbutilqt/rbutil.ini	(copie de travail)
@@ -501,7 +503,7 @@
 [sansafuzeplus]
 name="Sansa Fuze+"
 buildserver_modelname=sansafuzeplus
-bootloadermethod=none ; no bootloader for now
+bootloadermethod=imx
 bootloadername=/sandisk-sansa/fuzeplus/bootloader-fuzeplus.sansa
 bootloaderfile=/firmware.sb
 manualname=
@@ -510,7 +512,6 @@
 usberror=
 configure_modelname=sansafuzeplus
 encoder=rbspeex
-status=disabled
 
 [sansam200v4]
 name="Sansa m200v4"
Index: rbutil/rbutilqt/rbutilqt.pri
===================================================================
--- rbutil/rbutilqt/rbutilqt.pri	(révision 31403)
+++ rbutil/rbutilqt/rbutilqt.pri	(copie de travail)
@@ -60,6 +60,7 @@
  base/bootloaderinstallams.cpp \
  base/bootloaderinstalltcc.cpp \
  base/bootloaderinstallmpio.cpp \
+ base/bootloaderinstallimx.cpp \
  base/rockboxinfo.cpp \
  ../../tools/mkboot.c \
  ../../tools/iriver.c \
@@ -121,6 +122,7 @@
  base/bootloaderinstallams.h \
  base/bootloaderinstalltcc.h \
  base/bootloaderinstallmpio.h \
+ base/bootloaderinstallimx.h \
  base/rockboxinfo.h \
  ../../tools/mkboot.h \
  ../../tools/iriver.h \
Index: rbutil/rbutilqt/rbutilqt.pro
===================================================================
--- rbutil/rbutilqt/rbutilqt.pro	(révision 31403)
+++ rbutil/rbutilqt/rbutilqt.pro	(copie de travail)
@@ -119,10 +119,15 @@
         APPVERSION=\"rbutil\" \
         libchinachippatcher$$RBLIBPOSTFIX \
         CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
+libmkimxboot.commands = @$(MAKE) -s \
+        TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkimxboot \
+        APPVERSION=\"rbutil\" \
+        libmkimxboot$$RBLIBPOSTFIX \
+        CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
 # Note: order is important for RBLIBS! The libs are appended to the linker
 # flags in this order, put libucl at the end.
 RBLIBS = librbspeex libipodpatcher libsansapatcher libmkamsboot libmktccboot \
-         libmkmpioboot libchinachippatcher libucl
+         libmkmpioboot libchinachippatcher libmkimxboot libucl
 QMAKE_EXTRA_TARGETS += $$RBLIBS
 PRE_TARGETDEPS += $$RBLIBS
 
Index: rbutil/rbutilqt/base/bootloaderinstallimx.h
===================================================================
--- rbutil/rbutilqt/base/bootloaderinstallimx.h	(révision 0)
+++ rbutil/rbutilqt/base/bootloaderinstallimx.h	(révision 0)
@@ -0,0 +1,42 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ *
+ *   Copyright (C) 2011 by Jean-Louis Biasini
+ *
+ * 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 BOOTLOADERINSTALLIMX_H
+#define BOOTLOADERINSTALLIMX_H
+
+#include <QtCore>
+#include "bootloaderinstallbase.h"
+
+//! bootloader installation class for devices handled by mkimxboot.
+class BootloaderInstallImx : public BootloaderInstallBase
+{
+    Q_OBJECT
+    public:
+        BootloaderInstallImx(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/base/bootloaderinstallimx.cpp
===================================================================
--- rbutil/rbutilqt/base/bootloaderinstallimx.cpp	(révision 0)
+++ rbutil/rbutilqt/base/bootloaderinstallimx.cpp	(révision 0)
@@ -0,0 +1,150 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ *
+ *   Copyright (C) 2011 by Jean-Louis Biasini
+ *
+ * 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 <QtCore>
+#include <QtDebug>
+#include <string>
+#include "bootloaderinstallbase.h"
+#include "bootloaderinstallimx.h"
+#include "../mkimxboot/mkimxboot.h"
+
+BootloaderInstallImx::BootloaderInstallImx(QObject *parent)
+        : BootloaderInstallBase(parent)
+{
+}
+
+QString BootloaderInstallImx::ofHint()
+{
+    return tr("Bootloader installation requires you to provide "
+              "a copy of the original Sandisk firmware (sb file). "
+              "This firmware file will be patched and then installed to your "
+              "player along with the rockbox bootloader. "
+              "You need to download this file yourself due to legal "
+              "reasons. Please browse the "
+              "<a href='http://forums.sandisk.com/sansa/'>Sansa Forums'</a> "
+              "or refer to "
+              "<a href= 'http://www.rockbox.org/wiki/SansaFuzePlus.html'>Rockbox Fuze+</a> "
+              "wiki page on how to obtain this file.<br/>"
+              "Press Ok to continue and browse your computer for the firmware "
+              "file.");
+}
+
+
+/** Start bootloader installation.
+ */
+bool BootloaderInstallImx::install(void)
+{
+    if(m_offile.isEmpty())
+    {
+        qDebug() << "[BootloaderInstallImx] OF file not found";
+        return false;
+    }
+
+    qDebug() << "[BootloaderInstallImx] downloading bootloader";
+    //download firmware from server
+    emit logItem(tr("Downloading bootloader file"), LOGINFO);
+    connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
+    downloadBlStart(m_blurl);
+}
+
+void BootloaderInstallImx::installStage2(void)
+{
+    qDebug() << "[BootloaderInstallImx] patching file...";
+
+    m_tempfile.open();
+    QString downloadedFile = m_tempfile.fileName();
+    m_tempfile.close();
+        
+    //Qstringlist used to extract the basename of the file to put on the device
+    QStringList ofFilePath = m_blfile.split("/"); 
+    const char *outfile = ofFilePath.last().toLocal8Bit();
+    const char *bootfile = downloadedFile.toLocal8Bit();
+    struct imx_option_t opt;
+    opt.debug = true;
+    opt.output = IMX_DUALBOOT;
+    
+    enum imx_error_t err = mkimxboot(m_offile.toLocal8Bit(), \
+                                     bootfile, \
+                                     outfile, \
+                                     opt);
+    qDebug() << err;
+
+    //if the patch failed 
+    if (err != IMX_SUCCESS)
+    {
+        qDebug() << "[BootloaderInstallImx] Could not patch OF file";
+        emit logItem(tr("Could not patch OF file"),LOGERROR);
+        emit done(true);
+        return;
+    }
+    else
+    {
+        qDebug() << "[BootloaderInstallImx] OF succesfully patched";
+    }
+
+    qDebug() << "[BootloaderInstallImx] installing the file in the target's"
+                                                               " folder...";
+    // if an old bootloader is present move it out of the way.
+    QString fwfile(m_blfile.toLocal8Bit());
+    if(!fwfile.isEmpty())
+    {
+        QString moved = m_blfile.toLocal8Bit() + ".ORIG";
+        qDebug() << "[BootloaderInstallFile] renaming" << fwfile << "to" 
+                                                                     << moved;
+        QFile::rename(fwfile, moved);
+    }
+
+    // place (new) bootloader
+    QFile patchedBootFile(outfile);
+    qDebug() << "[BootloaderInstallFile] movind the patched bootloader to"
+                                                                     << fwfile;
+    if(patchedBootFile.rename(fwfile))
+    {
+        emit logItem(tr("Bootloader successful installed"), LOGOK);
+        logInstall(LogAdd);
+        emit done(false);
+
+    }
+    else
+    {
+        emit logItem(tr("Patched booloader could not be installed"), LOGERROR);
+        emit done(true);
+    } 
+    patchedBootFile.flush();
+    patchedBootFile.close();
+    return;
+
+}
+
+bool BootloaderInstallImx::uninstall(void)
+{
+    emit logItem(tr("To uninstall, perform a normal upgrade with an unmodified "
+                    "original firmware from Sansa Forum"), LOGINFO);
+    logInstall(LogRemove);
+    return false;
+}
+
+BootloaderInstallBase::BootloaderType BootloaderInstallImx::installed(void)
+{
+    return BootloaderUnknown;
+}
+
+BootloaderInstallBase::Capabilities BootloaderInstallImx::capabilities(void)
+{
+    return (Install | NeedsOf);
+}
Index: rbutil/rbutilqt/base/bootloaderinstallbase.cpp
===================================================================
--- rbutil/rbutilqt/base/bootloaderinstallbase.cpp	(révision 31403)
+++ rbutil/rbutilqt/base/bootloaderinstallbase.cpp	(copie de travail)
@@ -29,6 +29,7 @@
 #include "bootloaderinstallams.h"
 #include "bootloaderinstalltcc.h"
 #include "bootloaderinstallmpio.h"
+#include "bootloaderinstallimx.h"
 #include "utils.h"
 
 #if defined(Q_OS_MACX)
@@ -67,6 +68,9 @@
     else if(type == "mpio") {
         return new BootloaderInstallMpio(parent);
     }
+    else if(type == "imx") {
+        return new BootloaderInstallImx(parent);
+    }
     else {
         return NULL;
     }
