1
0
Fork 0
mirror of https://github.com/eliboa/TegraRcmGUI.git synced 2024-11-24 19:22:04 +00:00

Bug fixes

Added script to download compiled Linux kernel from SoulCypher repo
This commit is contained in:
eliboa 2018-05-11 20:40:03 +02:00
parent dfbd89b6a2
commit 942af16489
5 changed files with 125 additions and 6 deletions

Binary file not shown.

View file

@ -55,7 +55,8 @@ void CTegraRcmGUIDlg::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, RCM_PIC_1, RCM_BITMAP1);
DDX_Control(pDX, RCM_PIC_2, RCM_BITMAP2);
DDX_Control(pDX, RCM_PIC_3, RCM_BITMAP3);
DDX_Control(pDX, RCM_PIC_4, RCM_BITMAP0);
DDX_Control(pDX, RCM_PIC_4, RCM_BITMAP0);
DDX_Control(pDX, PAYLOAD_PATH, m_EditBrowse);
}
BEGIN_MESSAGE_MAP(CTegraRcmGUIDlg, CDialog)
@ -79,6 +80,7 @@ BOOL CTegraRcmGUIDlg::OnInitDialog()
RCM_BITMAP1.SetBitmap(RCM_NOT_DETECTED);
RCM_BITMAP2.SetBitmap(DRIVER_KO);
RCM_BITMAP3.SetBitmap(RCM_DETECTED);
SendMessage(PAYLOAD_PATH, BM_CLICK, 0);
// Add "About..." menu item to system menu.
@ -249,11 +251,21 @@ void CTegraRcmGUIDlg::OnBnClickedButton()
TCHAR* args[2];
args[0] = TEXT("");
args[1] = PAYLOAD_FILE;
string s;
if (PAYLOAD_FILE == nullptr) {
s = "No file selected !";
CA2T wt(s.c_str());
CTegraRcmGUIDlg::SetDlgItemText(INFO_LABEL, wt);
LOOP_WAIT = 0;
return;
}
TegraRcmSmash device;
int rc = device.SmashMain(2, args);
string s;
if (rc >= 0)
{
s = "Payload injected !";
@ -282,11 +294,39 @@ void CTegraRcmGUIDlg::OnBnClickedShofel2()
csPath.Empty();
}
CString COREBOOT = _T("CBFS+") + csPath + _T("\\shofel2\\coreboot\\coreboot.rom");
string s;
CString COREBOOT_FILE = csPath + _T("\\shofel2\\coreboot\\coreboot.rom");
CString COREBOOT = _T("CBFS+") + COREBOOT_FILE;
CString PAYLOAD = csPath + _T("\\shofel2\\coreboot\\cbfs.bin");
std::ifstream infile(COREBOOT_FILE);
BOOL coreboot_exists = infile.good();
std::ifstream infile2(PAYLOAD);
BOOL payload_exists = infile2.good();
if (!coreboot_exists || !payload_exists) {
s = "Linux kernel found not found in \\shofel2 dir";
CA2T wt(s.c_str());
CTegraRcmGUIDlg::SetDlgItemText(INFO_LABEL, wt);
CString message = _T("Kernel not found in shofel2 directory. Do you want to automatically download arch linux kernel from SoulCipher repo ?");
const int result = MessageBox(message, _T("Kernel not found"), MB_YESNOCANCEL | MB_ICONQUESTION);
if (result == IDYES)
{
PROCESS_INFORMATION pif;
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
CString download_script = csPath + _T("\\shofel2\\download.bat");
BOOL bRet = CreateProcess(download_script, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pif);
}
LOOP_WAIT = 0;
return;
}
TCHAR* payload_f = _tcsdup(PAYLOAD);
TCHAR* coreboot_f = _tcsdup(COREBOOT);
string s;
TCHAR* args[5];
args[0] = TEXT("");
args[1] = TEXT("-w");

View file

@ -14,7 +14,7 @@ public:
CBitmapPicture RCM_BITMAP1;
CBitmapPicture RCM_BITMAP2;
CBitmapPicture RCM_BITMAP3;
CMFCEditBrowseCtrl m_EditBrowse;
// Dialog Data
#ifdef AFX_DESIGN_TIME
@ -29,7 +29,7 @@ public:
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnIdle();
afx_msg void OnShowWindow();
@ -44,4 +44,5 @@ public:
afx_msg void OnEnChangePath();
afx_msg void OnBnClickedButton();
afx_msg void OnBnClickedShofel2();
};

Binary file not shown.

78
shofel2/download.bat Normal file
View file

@ -0,0 +1,78 @@
@Echo OFF
if exist shofel2 (
cd shofel2
)
::
:: CONTROLS
::
set USE_GIT=0
git --help > NUL 2> NUL
if errorlevel 1 (
if not exist C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe (
echo Neither Powershell nor Git are installed on this computer.
echo Please download https://github.com/SoulCipher/shofel2_linux/archive/master.zip manually
echo Waiting 10s before closing...
ping 127.0.0.1 -n 11 > nul
exit
)
) else (
set USE_GIT=1
)
if not exist conf\imx_usb.conf set MISSING=1
if not exist conf\switch.conf set MISSING=1
if not exist coreboot\cbfs.bin set MISSING=1
if not exist coreboot\coreboot.rom set MISSING=1
if not exist dtb\tegra210-nintendo-switch.dtb set MISSING=1
if not exist image\switch.scr.img set MISSING=1
if not exist kernel\Image.gz set MISSING=1
if not defined MISSING (
echo All needed files already at the right place !
echo You should be able to boot Linux from TegraRcmGUI
echo If not, verify read access permission. file already open in another program ?
echo Waiting 10s before closing...
ping 127.0.0.1 -n 11 > nul
exit
)
if exist conf\ RMDIR /S /Q conf
if exist coreboot\ RMDIR /S /Q coreboot
if exist dtb\ RMDIR /S /Q dtb
if exist image\ RMDIR /S /Q image
if exist kernel\ RMDIR /S /Q kernel
::
:: PROCEDURE
::
if %USE_GIT% equ 1 (
echo Downloading linux kernel from SoulCipher repo
git clone https://github.com/SoulCipher/shofel2_linux
echo Moving needed files
move shofel2_linux\conf .\
move shofel2_linux\coreboot .\
move shofel2_linux\dtb .\
move shofel2_linux\image .\
move shofel2_linux\kernel .\
echo Removing unnecessary files
RMDIR /S /Q shofel2_linux
echo Completed. You should be able to boot Linux from TegraRcmGUI.
) else (
SetLocal EnableDelayedExpansion
if exist shofel2.zip del shofel2.zip
echo Downloading linux kernel from SoulCipher repo
echo https://github.com/SoulCipher/shofel2_linux/archive/master.zip
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11, tls'; Invoke-WebRequest -Uri https://github.com/SoulCipher/shofel2_linux/archive/master.zip -OutFile shofel2.zip"
echo Unzipping package
powershell -Command "Expand-Archive -Path shofel2.zip"
echo Moving needed files
move shofel2\shofel2_linux-master\conf .\
move shofel2\shofel2_linux-master\coreboot .\
move shofel2\shofel2_linux-master\dtb .\
move shofel2\shofel2_linux-master\image .\
move shofel2\shofel2_linux-master\kernel .\
echo Removing unnecessary files
del shofel2.zip
RMDIR /S /Q shofel2
echo Completed. You should be able to boot Linux from TegraRcmGUI.
)
echo Waiting 5s before closing...
ping 127.0.0.1 -n 6 > nul
exit