bootarg check

This commit is contained in:
Nick Chan committed 2023-01-27 22:06:43 +08:00
1 parent fd59da4487
commit 2c5997cd28
3 files changed
+17 -9

No files matched your search

+6 -5
View File
@@ -4,19 +4,20 @@
<p align="center">
<a href="#">
<img src="https://img.shields.io/badge/made%20with-love-E760A4.svg" alt="Made with love">
<img src="https://img.shields.io/badge/made%20with-love-E760A4.svg" alt="Made with love"></img>
</a>
<a href="https://github.com/palera1n/palera1n-c/blob/main/LICENSE" target="_blank">
<img src="https://img.shields.io/github/license/palera1n/palera1n-c.svg" alt="License">
<img src="https://img.shields.io/github/license/palera1n/palera1n-c.svg" alt="License"></img>
</a>
<a href="https://github.com/palera1n/palera1n-c/graphs/contributors" target="_blank">
<img src="https://img.shields.io/github/contributors/palera1n/palera1n-c.svg" alt="Contributors">
<img src="https://img.shields.io/github/contributors/palera1n/palera1n-c.svg" alt="Contributors"></img>
</a>
<a href="https://github.com/palera1n/palera1n-c/commits/main" target="_blank">
<img src="https://img.shields.io/github/commit-activity/w/palera1n/palera1n-c.svg" alt="Commits">
<img src="https://img.shields.io/github/commit-activity/w/palera1n/palera1n-c.svg" alt="Commits"></img>
</a>
<img src="https://img.shields.io/github/search/palera1n/palera1n-c/goto.svg" alt="goto counter"></img>
<a href="https://dsc.gg/palera1n" target="_blank">
<img src="https://img.shields.io/discord/1028398973452570725?label=discord" alt="Discord">
<img src="https://img.shields.io/discord/1028398973452570725?label=discord" alt="Discord"></img>
</a>
</p>
+5
View File
@@ -136,6 +136,7 @@ void *pongo_usb_callback(void *arg)
found_pongo = 1;
LOG(LOG_INFO, "Found PongoOS USB Device");
usb_device_handle_t handle = *(usb_device_handle_t *)arg;
issue_pongo_command(handle, NULL);
issue_pongo_command(handle, "fuse lock");
issue_pongo_command(handle, "sep auto");
upload_pongo_file(handle, **kpf_to_upload, checkra1n_kpf_pongo_len);
@@ -304,6 +305,10 @@ int main(int argc, char *argv[])
kpf_flags |= checkrain_option_verbose_boot;
break;
case 'e':
if (strstr(optarg, "rootdev=") != NULL) {
LOG(LOG_FATAL, "The boot arg rootdev= is already used by palera1n and cannot be overriden");
return -1;
}
snprintf(xargs_cmd, sizeof(xargs_cmd), "xargs %s", optarg);
break;
case 'f':
+6 -4
View File
@@ -325,6 +325,10 @@ static void write_stdout(char *buf, uint32_t len)
int issue_pongo_command(usb_device_handle_t handle, char *command)
{
uint32_t outpos = 0;
uint32_t outlen = 0;
uint8_t in_progress = 1;
if (command == NULL) goto fetch_output;
int ret;
size_t len = strlen(command);
char command_buf[512];
@@ -341,9 +345,7 @@ int issue_pongo_command(usb_device_handle_t handle, char *command)
if (ret)
goto bad;
ret = USBControlTransfer(handle, 0x21, 3, 0, 0, (uint32_t)len, command_buf, NULL);
uint32_t outpos = 0;
uint32_t outlen = 0;
uint8_t in_progress = 1;
fetch_output:
while (in_progress) {
ret = USBControlTransfer(handle, 0xa1, 2, 0, 0, (uint32_t)sizeof(in_progress), &in_progress, NULL);
if (ret == USB_RET_SUCCESS)
@@ -370,7 +372,7 @@ bad:
{
if (ret == USB_RET_NOT_RESPONDING)
return 0;
if (!strncmp("boot", command, 4) && ret == USB_RET_IO)
if (command != NULL && (!strncmp("boot", command, 4) && ret == USB_RET_IO))
return 0;
LOG(LOG_ERROR, "USB error: %s", usb_strerror(ret));
return ret;