Compare commits
4 Commits
cherry-a8f
...
cherry-53a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb0c51ab3b | ||
|
|
ec6fc4e514 | ||
|
|
ec3cca0ae1 | ||
|
|
e342e46bb7 |
@@ -332,41 +332,45 @@ int android_image_get_kernel(const void *hdr,
|
|||||||
kernel_addr, DIV_ROUND_UP(img_data.kernel_size, 1024));
|
kernel_addr, DIV_ROUND_UP(img_data.kernel_size, 1024));
|
||||||
|
|
||||||
int len = 0;
|
int len = 0;
|
||||||
if (*img_data.kcmdline) {
|
|
||||||
printf("Kernel command line: %s\n", img_data.kcmdline);
|
|
||||||
len += strlen(img_data.kcmdline);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (img_data.kcmdline_extra) {
|
|
||||||
printf("Kernel extra command line: %s\n", img_data.kcmdline_extra);
|
|
||||||
len += strlen(img_data.kcmdline_extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *bootargs = env_get("bootargs");
|
char *bootargs = env_get("bootargs");
|
||||||
|
|
||||||
if (bootargs)
|
if (bootargs)
|
||||||
len += strlen(bootargs);
|
len += strlen(bootargs);
|
||||||
|
|
||||||
char *newbootargs = malloc(len + 2);
|
if (*img_data.kcmdline) {
|
||||||
|
printf("Kernel command line: %s\n", img_data.kcmdline);
|
||||||
|
len += strlen(img_data.kcmdline) + (len ? 1 : 0); /* +1 for extra space */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*img_data.kcmdline_extra) {
|
||||||
|
printf("Kernel extra command line: %s\n", img_data.kcmdline_extra);
|
||||||
|
len += strlen(img_data.kcmdline_extra) + (len ? 1 : 0); /* +1 for extra space */
|
||||||
|
}
|
||||||
|
|
||||||
|
char *newbootargs = malloc(len + 1); /* +1 for the '\0' */
|
||||||
if (!newbootargs) {
|
if (!newbootargs) {
|
||||||
puts("Error: malloc in android_image_get_kernel failed!\n");
|
puts("Error: malloc in android_image_get_kernel failed!\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
*newbootargs = '\0';
|
*newbootargs = '\0'; /* set to Null in case no components below are present */
|
||||||
|
|
||||||
if (bootargs) {
|
if (bootargs)
|
||||||
strcpy(newbootargs, bootargs);
|
strcpy(newbootargs, bootargs);
|
||||||
strcat(newbootargs, " ");
|
|
||||||
|
if (*img_data.kcmdline) {
|
||||||
|
if (*newbootargs) /* If there is something in newbootargs, a space is needed */
|
||||||
|
strcat(newbootargs, " ");
|
||||||
|
strcat(newbootargs, img_data.kcmdline);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*img_data.kcmdline)
|
if (*img_data.kcmdline_extra) {
|
||||||
strcat(newbootargs, img_data.kcmdline);
|
if (*newbootargs) /* If there is something in newbootargs, a space is needed */
|
||||||
|
strcat(newbootargs, " ");
|
||||||
if (img_data.kcmdline_extra) {
|
|
||||||
strcat(newbootargs, " ");
|
|
||||||
strcat(newbootargs, img_data.kcmdline_extra);
|
strcat(newbootargs, img_data.kcmdline_extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
env_set("bootargs", newbootargs);
|
env_set("bootargs", newbootargs);
|
||||||
|
free(newbootargs);
|
||||||
|
|
||||||
if (os_data) {
|
if (os_data) {
|
||||||
if (image_get_magic(ihdr) == IH_MAGIC) {
|
if (image_get_magic(ihdr) == IH_MAGIC) {
|
||||||
|
|||||||
Reference in New Issue
Block a user