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
|
#ifdef BOXMODEL_APOLLO
|
||||||
|
void CFlashExpert::addDevtableEntry(int fd_dev, const char *entry)
|
||||||
|
{
|
||||||
|
write(fd_dev, entry, strlen(entry));
|
||||||
|
}
|
||||||
|
|
||||||
void CFlashExpert::readmtdJFFS2(std::string &filename)
|
void CFlashExpert::readmtdJFFS2(std::string &filename)
|
||||||
{
|
{
|
||||||
int esize = CMTDInfo::getInstance()->getMTDEraseSize(CMTDInfo::getInstance()->findMTDsystem());
|
CProgressWindow progress;
|
||||||
CMkfsJFFS2 mkfs;
|
progress.setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
|
||||||
std::string path = "/";
|
progress.paint();
|
||||||
CProgressWindow *progress = new CProgressWindow;
|
|
||||||
progress->setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
|
std::string devTable = "/tmp/devtable.txt";
|
||||||
progress->paint();
|
int fd_dev = open(devTable.c_str(), O_WRONLY|O_CREAT|O_TRUNC);
|
||||||
mkfs.makeJffs2Image(path, filename, esize, 0, 0, __LITTLE_ENDIAN, true, true, progress);
|
if (fd_dev != -1) {
|
||||||
progress->hide();
|
addDevtableEntry(fd_dev, "/dev/console c 0600 0 0 5 1 0 0 0\n");
|
||||||
delete progress;
|
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];
|
char message[500];
|
||||||
sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str());
|
sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str());
|
||||||
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message);
|
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -78,6 +78,7 @@ class CFlashExpert : public CProgressWindow
|
|||||||
bool checkSize(int mtd, std::string &backupFile);
|
bool checkSize(int mtd, std::string &backupFile);
|
||||||
void readmtd(int readmtd);
|
void readmtd(int readmtd);
|
||||||
#ifdef BOXMODEL_APOLLO
|
#ifdef BOXMODEL_APOLLO
|
||||||
|
void addDevtableEntry(int fd_dev, const char *entry);
|
||||||
void readmtdJFFS2(std::string &filename);
|
void readmtdJFFS2(std::string &filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1174,7 +1174,6 @@ bool CMkfsJFFS2::makeJffs2Image(std::string& path,
|
|||||||
bool skipSpezialFolders/*=true*/,
|
bool skipSpezialFolders/*=true*/,
|
||||||
bool useSumtool/*=true*/,
|
bool useSumtool/*=true*/,
|
||||||
CProgressWindow *progress/*=NULL*/,
|
CProgressWindow *progress/*=NULL*/,
|
||||||
bool useDevTable/*=true*/,
|
|
||||||
std::string devTable/*=""*/)
|
std::string devTable/*=""*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1193,26 +1192,7 @@ bool CMkfsJFFS2::makeJffs2Image(std::string& path,
|
|||||||
progressBar = progress;
|
progressBar = progress;
|
||||||
hardlinks.rb_node = NULL;
|
hardlinks.rb_node = NULL;
|
||||||
|
|
||||||
/* if (progressBar != NULL) {
|
// printf("[%s] erase_block_size: 0x%X\n", __FUNCTION__, eraseBlockSize);
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
classInit();
|
classInit();
|
||||||
|
|
||||||
@@ -1250,6 +1230,8 @@ bool CMkfsJFFS2::makeJffs2Image(std::string& path,
|
|||||||
progressBar->showGlobalStatus(50);
|
progressBar->showGlobalStatus(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (devTable != "")
|
||||||
|
devtable = fopen(devTable.c_str(), "r");
|
||||||
if (devtable)
|
if (devtable)
|
||||||
parse_device_table(fse_root, devtable);
|
parse_device_table(fse_root, devtable);
|
||||||
|
|
||||||
|
@@ -107,7 +107,6 @@ class CMkfsJFFS2
|
|||||||
bool skipSpezialFolders=true,
|
bool skipSpezialFolders=true,
|
||||||
bool useSumtool=true,
|
bool useSumtool=true,
|
||||||
CProgressWindow *progress=NULL,
|
CProgressWindow *progress=NULL,
|
||||||
bool useDevTable=true,
|
|
||||||
std::string devTable="");
|
std::string devTable="");
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user