Merge remote-tracking branch 'uncool/cst-next'

This need buildfixes and some functional updates...
This commit is contained in:
Stefan Seyfried
2015-12-13 17:41:55 +01:00
320 changed files with 21291 additions and 13199 deletions

View File

@@ -100,7 +100,7 @@ int pinghost (const std::string &hostname, std::string *ip = NULL);
CFlashUpdate::CFlashUpdate()
:CProgressWindow()
{
width = w_max (40, 10);
width = 40;
setTitle(LOCALE_FLASHUPDATE_HEAD);
sysfs = CMTDInfo::getInstance()->findMTDsystem();
if (sysfs.empty())
@@ -196,7 +196,7 @@ bool CFlashUpdate::selectHttpImage(void)
std::string md5;
std::vector<std::string> updates_lists, urls, names, versions, descriptions, md5s;
char fileTypes[128];
int selected = -1, listWidth = w_max (80, 10);
int selected = -1, listWidth = 80;
int curVer, newVer, newfound = 0;
CConfigFile _configfile('\t');
@@ -415,18 +415,18 @@ printf("[update] mode is %d\n", softupdate_mode);
UpdatesBrowser.Filter = &UpdatesFilter;
CFile * CFileSelected = NULL;
CFile * file_selected = NULL;
if (!(UpdatesBrowser.exec(g_settings.update_dir.c_str()))) {
menu_ret = UpdatesBrowser.getMenuRet();
return false;
}
CFileSelected = UpdatesBrowser.getSelectedFile();
file_selected = UpdatesBrowser.getSelectedFile();
if (CFileSelected == NULL)
if (file_selected == NULL)
return false;
filename = CFileSelected->Name;
filename = file_selected->Name;
FILE* fd = fopen(filename.c_str(), "r");
if(fd)
@@ -600,7 +600,7 @@ CFlashExpert::CFlashExpert()
:CProgressWindow()
{
selectedMTD = -1;
width = w_max (40, 10);
width = 40;
#ifdef BOXMODEL_APOLLO
forceOtherFilename = false;
otherFilename = "";
@@ -702,38 +702,44 @@ bool CFlashExpert::readDevtableFile(std::string &devtableFile, CMkfsJFFS2::v_dev
return true;
}
void CFlashExpert::readmtdJFFS2(std::string &filename)
void CFlashExpert::readmtdJFFS2(std::string &filename, std::string title/*=""*/, std::string path/*="/"*/, bool makeDevTable/*=true*/)
{
if (!checkSize(-1, filename))
return;
CProgressWindow progress;
progress.setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
if (title == "")
progress.setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
else
progress.setTitle(g_Locale->getText(LOCALE_FLASHUPDATE_TITLEREADFLASH) + title);
progress.paint();
bool devtableFileIO = false;
CMkfsJFFS2::v_devtable_t v_devtable;
std::string devtableFile = (std::string)CONFIGDIR + "/devtable.txt";
if (file_exists(devtableFile.c_str())) {
if (readDevtableFile(devtableFile, v_devtable))
devtableFileIO = true;
}
if ((!devtableFileIO) || (v_devtable.empty())) {
v_devtable.push_back("/dev/console c 0600 0 0 5 1 0 0 0");
v_devtable.push_back("/dev/null c 0666 0 0 1 3 0 0 0");
}
std::string path = "/";
int eSize = CMTDInfo::getInstance()->getMTDEraseSize(CMTDInfo::getInstance()->findMTDsystem());
if (createimage_other == 1) {
if (eSize == 0x40000) eSize = 0x20000;
else if (eSize == 0x20000) eSize = 0x40000;
}
CMkfsJFFS2 mkfs;
mkfs.makeJffs2Image(path, filename, eSize, 0, 0, __LITTLE_ENDIAN, true, true, &progress, &v_devtable);
if (makeDevTable) {
CMkfsJFFS2::v_devtable_t v_devtable;
bool devtableFileIO = false;
std::string devtableFile = (std::string)CONFIGDIR + "/devtable.txt";
if (file_exists(devtableFile.c_str())) {
if (readDevtableFile(devtableFile, v_devtable))
devtableFileIO = true;
}
if (!devtableFileIO || v_devtable.empty()) {
v_devtable.push_back("/dev/console c 0600 0 0 5 1 0 0 0");
v_devtable.push_back("/dev/null c 0666 0 0 1 3 0 0 0");
}
mkfs.makeJffs2Image(path, filename, eSize, 0, 0, __LITTLE_ENDIAN, true, true, &progress, &v_devtable);
}
else
mkfs.makeJffs2Image(path, filename, eSize, 0, 0, __LITTLE_ENDIAN, true, true, &progress);
progress.hide();
char message[500];
sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str());
snprintf(message, sizeof(message)-1, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str());
ShowHint(LOCALE_MESSAGEBOX_INFO, message);
}
#endif
@@ -768,8 +774,20 @@ void CFlashExpert::readmtd(int preadmtd)
filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd) + timeStr + tankStr + ".img";
#ifdef BOXMODEL_APOLLO
std::string title = " (" + CMTDInfo::getInstance()->getMTDName(preadmtd) + ")";
std::string mountp = getJFFS2MountPoint(preadmtd);
if (preadmtd == 0) {
readmtdJFFS2(filename);
readmtdJFFS2(filename, title);
return;
}
if (preadmtd == 1) {
if (mountp != "")
readmtdJFFS2(filename, title, mountp.c_str(), false);
return;
}
if (preadmtd == 2) {
if (mountp != "")
readmtdJFFS2(filename, title, mountp.c_str(), false);
return;
}
#endif
@@ -875,12 +893,15 @@ int CFlashExpert::showMTDSelector(const std::string & actionkey)
lx == mtdInfo->findMTDNumberFromName("uldr") ||
lx == mtdInfo->findMTDNumberFromName("env")))
enabled = false;
// build jffs2 image from root0
if ((actionkey == "readmtd") && (lx == mtdInfo->findMTDNumberFromName("root0"))) {
CMenuForwarder *mf = new CMenuDForwarder("root0", true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(shortcut++));
mtdselector->addItem(mf);
continue;
if (actionkey == "readmtd") {
// Enabled when file system is mounted
if (lx == mtdInfo->findMTDNumberFromName("var"))
enabled = (getJFFS2MountPoint(lx) == "") ? false : true;
else if (lx == mtdInfo->findMTDNumberFromName("root1"))
enabled = (getJFFS2MountPoint(lx) == "") ? false : true;
}
if (lx == 3)
mtdselector->addItem(GenericMenuSeparatorLine);
#else
// disable write uboot
if ((actionkey == "writemtd") && (lx == mtdInfo->findMTDNumberFromName("U-Boot")))
@@ -986,7 +1007,7 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey)
#ifdef BOXMODEL_APOLLO
CFlashExpertSetup::CFlashExpertSetup()
{
width = w_max (40, 10);
width = 40;
}
void CFlashExpertSetup::readMTDPart(int mtd, const std::string &fileName)
@@ -1044,6 +1065,12 @@ int CFlashExpertSetup::exec(CMenuTarget* parent, const std::string &actionKey)
cfe->forceOtherFilename = false;
cfe->otherFilename = "";
if (g_settings.flashupdate_createimage_add_var == 1)
cfe->readmtd(1);
if (g_settings.flashupdate_createimage_add_root1 == 1)
cfe->readmtd(2);
cfe->readmtd(0);
if (g_settings.flashupdate_createimage_add_uldr == 1)
@@ -1064,7 +1091,7 @@ int CFlashExpertSetup::exec(CMenuTarget* parent, const std::string &actionKey)
}
cfe->createimage_other = 0;
return menu_return::RETURN_EXIT_ALL;
return menu_return::RETURN_REPAINT;
}
return showMenu();
}
@@ -1077,6 +1104,18 @@ int CFlashExpertSetup::showMenu()
CMenuSeparator *s1 = new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_FLASHUPDATE_CREATEIMAGE_OPTIONS);
CMenuForwarder *m1 = new CMenuForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE, true, NULL, this, "readmtd0", CRCInput::convertDigitToKey(0));
bool isMountVar = (getJFFS2MountPoint(1) == "") ? false : true;
CMenuOptionChooser *m8=NULL;
if (isMountVar)
m8 = new CMenuOptionChooser(LOCALE_FLASHUPDATE_CREATEIMAGE_ADD_VAR, &g_settings.flashupdate_createimage_add_var,
MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true);
bool isMountRoot1 = (getJFFS2MountPoint(2) == "") ? false : true;
CMenuOptionChooser *m9=NULL;
if (isMountRoot1)
m9 = new CMenuOptionChooser(LOCALE_FLASHUPDATE_CREATEIMAGE_ADD_ROOT1, &g_settings.flashupdate_createimage_add_root1,
MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true);
CMenuOptionChooser *m2 = new CMenuOptionChooser(LOCALE_FLASHUPDATE_CREATEIMAGE_ADD_ULDR, &g_settings.flashupdate_createimage_add_uldr,
MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true);
#ifndef UBOOT_BIN
@@ -1101,6 +1140,10 @@ g_settings.flashupdate_createimage_add_spare = 0;
rootfsSetup->addItem(m1); // create image
rootfsSetup->addItem(s1);
if (isMountVar)
rootfsSetup->addItem(m8); // include var
if (isMountRoot1)
rootfsSetup->addItem(m9); // include root1
rootfsSetup->addItem(m2); // include uldr
#ifdef UBOOT_BIN
rootfsSetup->addItem(m3); // include u-boot