mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
rbutil: add ams sansa targets. (FS#10185)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22317 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2ae585273e
commit
a66dfa4ab7
7 changed files with 324 additions and 8 deletions
|
|
@ -216,6 +216,11 @@ static struct md5sums sansasums[] = {
|
|||
|
||||
#define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0]))
|
||||
|
||||
int firmware_revision(int model)
|
||||
{
|
||||
return fw_revisions[model];
|
||||
}
|
||||
|
||||
static off_t filesize(int fd)
|
||||
{
|
||||
struct stat buf;
|
||||
|
|
|
|||
|
|
@ -139,4 +139,17 @@ void patch_firmware(
|
|||
|
||||
int total_size(int model, int rb_packedsize, int of_packedsize);
|
||||
|
||||
/* firmware_revision()
|
||||
*
|
||||
* returns the firmware revision for a particular model
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* model : firmware model (MODEL_XXX)
|
||||
*
|
||||
* RETURN VALUE
|
||||
* firmware version
|
||||
*/
|
||||
int firmware_revision(int model);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
176
rbutil/rbutilqt/base/bootloaderinstallams.cpp
Normal file
176
rbutil/rbutilqt/base/bootloaderinstallams.cpp
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2008 by Dominik Wenger
|
||||
* $Id$
|
||||
*
|
||||
* 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 "bootloaderinstallbase.h"
|
||||
#include "bootloaderinstallams.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../mkamsboot/mkamsboot.h"
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
|
||||
downloadBlStart(m_blurl);
|
||||
|
||||
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;
|
||||
struct md5sums sum;
|
||||
char md5sum[33]; /* 32 hex digits, plus terminating zero */
|
||||
int n;
|
||||
int firmware_size;
|
||||
int bootloader_size;
|
||||
int totalsize;
|
||||
char errstr[200];
|
||||
|
||||
sum.md5 = md5sum;
|
||||
|
||||
m_tempfile.open();
|
||||
QString bootfile = m_tempfile.fileName();
|
||||
m_tempfile.close();
|
||||
|
||||
/* Load original firmware file */
|
||||
buf = load_of_file(m_offile.toLocal8Bit().data(), &len,&sum,&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(), sum.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(sum.model,rb_packedsize,of_packedsize);
|
||||
if (totalsize > firmware_size)
|
||||
{
|
||||
emit logItem("No room to insert bootloader, try another firmware version",LOGERROR);
|
||||
free(buf);
|
||||
free(of_packed);
|
||||
free(rb_packed);
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
/* patch the firmware */
|
||||
emit logItem(tr("Patching Firmware..."), LOGINFO);
|
||||
|
||||
patch_firmware(sum.model,firmware_revision(sum.model),firmware_size,buf,len,of_packed,of_packedsize,rb_packed,rb_packedsize);
|
||||
|
||||
/* construct path for write out. combine path of m_blfile with filename from of */
|
||||
QString outfilename = QFileInfo(m_blfile).absolutePath() + "/" +QFileInfo(m_offile).fileName();
|
||||
/* write out file*/
|
||||
QFile out(outfilename);
|
||||
|
||||
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("To uninstall, perform a normal upgrade with an unmodified original firmware", LOGINFO);
|
||||
logInstall(LogRemove);
|
||||
return false;
|
||||
}
|
||||
|
||||
BootloaderInstallBase::BootloaderType BootloaderInstallAms::installed(void)
|
||||
{
|
||||
return BootloaderUnknown;
|
||||
}
|
||||
|
||||
BootloaderInstallBase::Capabilities BootloaderInstallAms::capabilities(void)
|
||||
{
|
||||
return (Install | NeedsOf);
|
||||
}
|
||||
43
rbutil/rbutilqt/base/bootloaderinstallams.h
Normal file
43
rbutil/rbutilqt/base/bootloaderinstallams.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2008 by Dominik Wenger
|
||||
* $Id$
|
||||
*
|
||||
* 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 <QtCore>
|
||||
#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
|
||||
|
|
@ -45,11 +45,14 @@ platform33=iaudiom3
|
|||
platform40=gigabeatf
|
||||
platform50=sansae200
|
||||
platform51=sansac200
|
||||
platform57=smsgyh820
|
||||
platform58=smsgyh920
|
||||
platform59=smsgyh925
|
||||
platform52=sansae200v2
|
||||
platform53=sansafuze
|
||||
platform54=sansam200v4
|
||||
platform55=sansaclip
|
||||
platform60=mrobe100
|
||||
|
||||
platform70=smsgyh820
|
||||
platform71=smsgyh920
|
||||
platform72=smsgyh925
|
||||
|
||||
|
||||
[player]
|
||||
|
|
@ -441,6 +444,67 @@ configure_modelname=c200
|
|||
targetid=30
|
||||
encoder=rbspeex
|
||||
|
||||
[sansae200v2]
|
||||
name="Sansa e200v2 series"
|
||||
buildserver_modelname=sansae200v2
|
||||
bootloadermethod=ams
|
||||
bootloadername=/sandisk-sansa/e200v2/bootloader-e200v2.sansa
|
||||
bootloaderfile=/e200pa.bin
|
||||
resolution=176x220x16
|
||||
manualname=
|
||||
brand=Sandisk
|
||||
usbid=0x078174c1
|
||||
usberror=0x07810722
|
||||
configure_modelname=e200v2
|
||||
targetid=51
|
||||
encoder=rbspeex
|
||||
|
||||
[sansafuze]
|
||||
name="Sansa Fuze"
|
||||
buildserver_modelname=sansafuze
|
||||
bootloadermethod=ams
|
||||
bootloadername=/sandisk-sansa/fuze/bootloader-fuze.sansa
|
||||
bootloaderfile=/fuzea.bin
|
||||
resolution=220x176x16
|
||||
manualname=
|
||||
brand=Sandisk
|
||||
usbid=0x07817423
|
||||
usberror=0x078174c0
|
||||
configure_modelname=fuze
|
||||
targetid=53
|
||||
encoder=rbspeex
|
||||
|
||||
[sansam200v4]
|
||||
name="Sansa m200v4"
|
||||
buildserver_modelname=sansam200v4
|
||||
bootloadermethod=ams
|
||||
bootloadername=/sandisk-sansa/m200v4/bootloader-m200v4.sansa
|
||||
bootloaderfile=/m200a.bin
|
||||
resolution=128x64x1
|
||||
manualname=
|
||||
brand=Sandisk
|
||||
usbid=
|
||||
usberror=
|
||||
configure_modelname=m200v4
|
||||
targetid=52
|
||||
encoder=rbspeex
|
||||
|
||||
[sansaclip]
|
||||
name="Sansa Clip"
|
||||
buildserver_modelname=sansaclip
|
||||
bootloadermethod=ams
|
||||
bootloadername=/sandisk-sansa/clip/bootloader-clip.sansa
|
||||
bootloaderfile=/m300a.bin
|
||||
resolution=128x64x1
|
||||
manualname=
|
||||
brand=Sandisk
|
||||
usbid=0x07817433
|
||||
usberror=0x07817432
|
||||
configure_modelname=clip
|
||||
targetid=50
|
||||
encoder=rbspeex
|
||||
|
||||
|
||||
[mrobe100]
|
||||
name="m:robe100"
|
||||
buildserver_modelname=mrobe100
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@
|
|||
#include "bootloaderinstallipod.h"
|
||||
#include "bootloaderinstallsansa.h"
|
||||
#include "bootloaderinstallfile.h"
|
||||
#include "bootloaderinstallams.h"
|
||||
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
#include <stdio.h>
|
||||
|
|
@ -650,6 +652,9 @@ void RbUtilQt::installBootloader()
|
|||
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();
|
||||
|
|
|
|||
|
|
@ -42,9 +42,17 @@ QMAKE_EXTRA_TARGETS += lrelease
|
|||
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 \
|
||||
|
|
@ -83,6 +91,7 @@ SOURCES += rbutilqt.cpp \
|
|||
base/bootloaderinstallipod.cpp \
|
||||
base/bootloaderinstallsansa.cpp \
|
||||
base/bootloaderinstallfile.cpp \
|
||||
base/bootloaderinstallams.cpp \
|
||||
../../tools/mkboot.c \
|
||||
../../tools/iriver.c
|
||||
|
||||
|
|
@ -136,6 +145,7 @@ HEADERS += rbutilqt.h \
|
|||
base/bootloaderinstallipod.h \
|
||||
base/bootloaderinstallsansa.h \
|
||||
base/bootloaderinstallfile.h \
|
||||
base/bootloaderinstallams.h \
|
||||
../../tools/mkboot.h \
|
||||
../../tools/iriver.h
|
||||
|
||||
|
|
@ -143,7 +153,7 @@ HEADERS += rbutilqt.h \
|
|||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue