mirror of
https://github.com/reactos/reactos.git
synced 2024-09-15 15:19:37 +00:00
- verify provided boot_cmd
- create also hdd images for manual boot cmds svn path=/trunk/; revision=28788
This commit is contained in:
parent
b57a996929
commit
ef3fd8d176
|
@ -135,7 +135,7 @@ namespace Sysreg_
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
bool RosBootTest::createDefaultHDDImage()
|
bool RosBootTest::createHDDImage(string image)
|
||||||
{
|
{
|
||||||
|
|
||||||
string qemuimgdir;
|
string qemuimgdir;
|
||||||
|
@ -168,9 +168,8 @@ namespace Sysreg_
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
getDefaultHDDImage(output);
|
|
||||||
options[0] = (TCHAR*)qemuimgdir.c_str();
|
options[0] = (TCHAR*)qemuimgdir.c_str();
|
||||||
options[2] = (TCHAR*)output.c_str();
|
options[2] = (TCHAR*)image.c_str();
|
||||||
|
|
||||||
cerr << "Creating HDD Image ..." << output << endl;
|
cerr << "Creating HDD Image ..." << output << endl;
|
||||||
if (OsSupport::createProcess ((TCHAR*)qemuimgdir.c_str(), 4, options, true))
|
if (OsSupport::createProcess ((TCHAR*)qemuimgdir.c_str(), 4, options, true))
|
||||||
|
@ -271,7 +270,7 @@ namespace Sysreg_
|
||||||
* on windows we can get pid as return of CreateProcess
|
* on windows we can get pid as return of CreateProcess
|
||||||
*/
|
*/
|
||||||
m_PidFile = _T("output-i386");
|
m_PidFile = _T("output-i386");
|
||||||
EnvironmentVariable::getValue(_T("ROS_OUTPUT"), pid);
|
EnvironmentVariable::getValue(_T("ROS_OUTPUT"), m_PidFile);
|
||||||
m_PidFile += _T("/pid.txt");
|
m_PidFile += _T("/pid.txt");
|
||||||
m_BootCmd += _T(" -pidfile ");
|
m_BootCmd += _T(" -pidfile ");
|
||||||
m_BootCmd += m_PidFile;
|
m_BootCmd += m_PidFile;
|
||||||
|
@ -334,34 +333,62 @@ namespace Sysreg_
|
||||||
if (m_HDDImage.length())
|
if (m_HDDImage.length())
|
||||||
{
|
{
|
||||||
/* check if ROS_HDD_IMAGE points to hdd image */
|
/* check if ROS_HDD_IMAGE points to hdd image */
|
||||||
return isFileExisting(m_HDDImage);
|
if (!isFileExisting(m_HDDImage))
|
||||||
}
|
|
||||||
|
|
||||||
if (isDefaultHDDImageExisting())
|
|
||||||
{
|
{
|
||||||
/* ROS_HDD_IMAGE is not set but theres
|
/* create it */
|
||||||
* a default existing image
|
return createHDDImage(m_HDDImage);
|
||||||
* to use */
|
}
|
||||||
getDefaultHDDImage(m_HDDImage);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (!m_BootCmd.length ())
|
||||||
if (!createDefaultHDDImage())
|
|
||||||
{
|
{
|
||||||
/* failed to create hdd image */
|
/* no hdd image provided
|
||||||
cerr << "Error: failed to create hdd image " << endl;
|
* but also no override by
|
||||||
|
* ROS_BOOT_CMD
|
||||||
|
*/
|
||||||
|
getDefaultHDDImage(m_HDDImage);
|
||||||
|
return createHDDImage(m_HDDImage);
|
||||||
|
}
|
||||||
|
bool hdaboot = false;
|
||||||
|
string::size_type pos = m_BootCmd.find (_T("-boot c"));
|
||||||
|
if (pos != string::npos)
|
||||||
|
{
|
||||||
|
hdaboot = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = m_BootCmd.find(_T("-hda "));
|
||||||
|
if (pos != string::npos)
|
||||||
|
{
|
||||||
|
string hdd = m_BootCmd.substr(pos + 5, m_BootCmd.length() - pos - 5);
|
||||||
|
if (!hdd.length ())
|
||||||
|
{
|
||||||
|
cerr << "Error: ROS_BOOT_CMD misses value of -hda option" << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
getDefaultHDDImage(m_HDDImage);
|
pos = m_BootCmd.find(" ");
|
||||||
return true;
|
if (pos != string::npos)
|
||||||
|
{
|
||||||
///
|
|
||||||
/// FIXME
|
/// FIXME
|
||||||
/// scan m_BootCmd if theres -hda param provided
|
/// sysreg assumes that the hdd image filename has no spaces
|
||||||
/// and check if it exists
|
///
|
||||||
|
hdd = hdd.substr(0, pos);
|
||||||
|
}
|
||||||
|
if (!isFileExisting(hdd))
|
||||||
|
{
|
||||||
|
if (hdaboot)
|
||||||
|
{
|
||||||
|
cerr << "Error: ROS_BOOT_CMD specifies booting from hda but no valid hdd image " << hdd << " provided" << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the file does not exist create it */
|
||||||
|
return createHDDImage(hdd);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
bool RosBootTest::configureCDImage()
|
bool RosBootTest::configureCDImage()
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace Sysreg_
|
||||||
void getDefaultHDDImage(string & img);
|
void getDefaultHDDImage(string & img);
|
||||||
bool isFileExisting(string filename);
|
bool isFileExisting(string filename);
|
||||||
bool isDefaultHDDImageExisting();
|
bool isDefaultHDDImageExisting();
|
||||||
bool createDefaultHDDImage();
|
bool createHDDImage(string filename);
|
||||||
bool isQemuPathValid();
|
bool isQemuPathValid();
|
||||||
bool getQemuDir(string &);
|
bool getQemuDir(string &);
|
||||||
bool createBootCmd();
|
bool createBootCmd();
|
||||||
|
|
Loading…
Reference in a new issue