mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
src/system/mtdutils: Creation devtable moved to update.cpp
This commit is contained in:
@@ -586,23 +586,35 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
|
||||
}
|
||||
|
||||
#ifdef BOXMODEL_APOLLO
|
||||
void CFlashExpert::addDevtableEntry(int fd_dev, const char *entry)
|
||||
{
|
||||
write(fd_dev, entry, strlen(entry));
|
||||
}
|
||||
|
||||
void CFlashExpert::readmtdJFFS2(std::string &filename)
|
||||
{
|
||||
int esize = CMTDInfo::getInstance()->getMTDEraseSize(CMTDInfo::getInstance()->findMTDsystem());
|
||||
CMkfsJFFS2 mkfs;
|
||||
std::string path = "/";
|
||||
CProgressWindow *progress = new CProgressWindow;
|
||||
progress->setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
|
||||
progress->paint();
|
||||
mkfs.makeJffs2Image(path, filename, esize, 0, 0, __LITTLE_ENDIAN, true, true, progress);
|
||||
progress->hide();
|
||||
delete progress;
|
||||
CProgressWindow progress;
|
||||
progress.setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
|
||||
progress.paint();
|
||||
|
||||
std::string devTable = "/tmp/devtable.txt";
|
||||
int fd_dev = open(devTable.c_str(), O_WRONLY|O_CREAT|O_TRUNC);
|
||||
if (fd_dev != -1) {
|
||||
addDevtableEntry(fd_dev, "/dev/console c 0600 0 0 5 1 0 0 0\n");
|
||||
addDevtableEntry(fd_dev, "/dev/null c 0666 0 0 1 3 0 0 0\n");
|
||||
close(fd_dev);
|
||||
}
|
||||
std::string path = "/";
|
||||
CMTDInfo *MTDInfo = CMTDInfo::getInstance();
|
||||
int esize = MTDInfo->getMTDEraseSize(MTDInfo->findMTDsystem());
|
||||
CMkfsJFFS2 mkfs;
|
||||
mkfs.makeJffs2Image(path, filename, esize, 0, 0, __LITTLE_ENDIAN, true, true, &progress, devTable);
|
||||
progress.hide();
|
||||
unlink(devTable.c_str());
|
||||
|
||||
sleep(1);
|
||||
char message[500];
|
||||
sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str());
|
||||
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -78,6 +78,7 @@ class CFlashExpert : public CProgressWindow
|
||||
bool checkSize(int mtd, std::string &backupFile);
|
||||
void readmtd(int readmtd);
|
||||
#ifdef BOXMODEL_APOLLO
|
||||
void addDevtableEntry(int fd_dev, const char *entry);
|
||||
void readmtdJFFS2(std::string &filename);
|
||||
#endif
|
||||
|
||||
|
@@ -1174,7 +1174,6 @@ bool CMkfsJFFS2::makeJffs2Image(std::string& path,
|
||||
bool skipSpezialFolders/*=true*/,
|
||||
bool useSumtool/*=true*/,
|
||||
CProgressWindow *progress/*=NULL*/,
|
||||
bool useDevTable/*=true*/,
|
||||
std::string devTable/*=""*/)
|
||||
{
|
||||
|
||||
@@ -1193,26 +1192,7 @@ bool CMkfsJFFS2::makeJffs2Image(std::string& path,
|
||||
progressBar = progress;
|
||||
hardlinks.rb_node = NULL;
|
||||
|
||||
/* if (progressBar != NULL) {
|
||||
progressBar->setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
|
||||
progressBar->paint();
|
||||
}*/
|
||||
|
||||
printf("[%s] erase_block_size: 0x%X\n", __FUNCTION__, eraseBlockSize);
|
||||
if (useDevTable) {
|
||||
if (devTable == "") {
|
||||
devTable = "/tmp/devtable.txt";
|
||||
devtable = fopen(devTable.c_str(), "w+");
|
||||
if (devtable) {
|
||||
std::string dev = "/dev/console c 0600 0 0 5 1 0 0 0\n";
|
||||
fwrite(dev.c_str(), dev.length(), 1, devtable);
|
||||
dev = "/dev/null c 0666 0 0 1 3 0 0 0\n";
|
||||
fwrite(dev.c_str(), dev.length(), 1, devtable);
|
||||
fclose(devtable);
|
||||
}
|
||||
}
|
||||
devtable = fopen(devTable.c_str(), "r");
|
||||
}
|
||||
// printf("[%s] erase_block_size: 0x%X\n", __FUNCTION__, eraseBlockSize);
|
||||
|
||||
classInit();
|
||||
|
||||
@@ -1250,6 +1230,8 @@ bool CMkfsJFFS2::makeJffs2Image(std::string& path,
|
||||
progressBar->showGlobalStatus(50);
|
||||
}
|
||||
|
||||
if (devTable != "")
|
||||
devtable = fopen(devTable.c_str(), "r");
|
||||
if (devtable)
|
||||
parse_device_table(fse_root, devtable);
|
||||
|
||||
|
@@ -107,7 +107,6 @@ class CMkfsJFFS2
|
||||
bool skipSpezialFolders=true,
|
||||
bool useSumtool=true,
|
||||
CProgressWindow *progress=NULL,
|
||||
bool useDevTable=true,
|
||||
std::string devTable="");
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user