summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-12-25 22:31:04 -0600
committerTom Rini <[email protected]>2024-12-25 22:31:04 -0600
commit5cfbf8c3644cc95c3c8b5d2541ed7f32136c0da1 (patch)
tree3acd513189d5a8ba449a6e213a57c53f3fb2cdfb /boot
parent2c366eb1cd7ecad7b1d955b54219ba1447e2a47d (diff)
parent3391587e3fe22db6c71882f652e13543a4501694 (diff)
Merge tag 'v2025.01-rc5' into next
Prepare v2025.01-rc5
Diffstat (limited to 'boot')
-rw-r--r--boot/Makefile2
-rw-r--r--boot/image-android.c34
-rw-r--r--boot/image-fdt.c2
3 files changed, 21 insertions, 17 deletions
diff --git a/boot/Makefile b/boot/Makefile
index 43def7c33d7..a24fd90c510 100644
--- a/boot/Makefile
+++ b/boot/Makefile
@@ -60,7 +60,7 @@ obj-$(CONFIG_$(PHASE_)LOAD_FIT) += common_fit.o
obj-$(CONFIG_$(PHASE_)EXPO) += expo.o scene.o expo_build.o
obj-$(CONFIG_$(PHASE_)EXPO) += scene_menu.o scene_textline.o
ifdef CONFIG_COREBOOT_SYSINFO
-obj-$(CONFIG_$(SPL_TPL_)EXPO) += expo_build_cb.o
+obj-$(CONFIG_$(PHASE_)EXPO) += expo_build_cb.o
endif
obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE) += vbe.o
diff --git a/boot/image-android.c b/boot/image-android.c
index 93b54bf8d79..60a422dfb74 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -332,41 +332,45 @@ int android_image_get_kernel(const void *hdr,
kernel_addr, DIV_ROUND_UP(img_data.kernel_size, 1024));
int len = 0;
+ char *bootargs = env_get("bootargs");
+
+ if (bootargs)
+ len += strlen(bootargs);
+
if (*img_data.kcmdline) {
printf("Kernel command line: %s\n", img_data.kcmdline);
- len += strlen(img_data.kcmdline);
+ len += strlen(img_data.kcmdline) + (len ? 1 : 0); /* +1 for extra space */
}
- if (img_data.kcmdline_extra) {
+ if (*img_data.kcmdline_extra) {
printf("Kernel extra command line: %s\n", img_data.kcmdline_extra);
- len += strlen(img_data.kcmdline_extra);
+ len += strlen(img_data.kcmdline_extra) + (len ? 1 : 0); /* +1 for extra space */
}
- char *bootargs = env_get("bootargs");
- if (bootargs)
- len += strlen(bootargs);
-
- char *newbootargs = malloc(len + 2);
+ char *newbootargs = malloc(len + 1); /* +1 for the '\0' */
if (!newbootargs) {
puts("Error: malloc in android_image_get_kernel failed!\n");
return -ENOMEM;
}
- *newbootargs = '\0';
+ *newbootargs = '\0'; /* set to Null in case no components below are present */
- if (bootargs) {
+ if (bootargs)
strcpy(newbootargs, bootargs);
- strcat(newbootargs, " ");
- }
- if (*img_data.kcmdline)
+ 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_extra) {
- strcat(newbootargs, " ");
+ if (*img_data.kcmdline_extra) {
+ if (*newbootargs) /* If there is something in newbootargs, a space is needed */
+ strcat(newbootargs, " ");
strcat(newbootargs, img_data.kcmdline_extra);
}
env_set("bootargs", newbootargs);
+ free(newbootargs);
if (os_data) {
if (image_get_magic(ihdr) == IH_MAGIC) {
diff --git a/boot/image-fdt.c b/boot/image-fdt.c
index 3d5b6f9e2dc..73c43c30684 100644
--- a/boot/image-fdt.c
+++ b/boot/image-fdt.c
@@ -77,7 +77,7 @@ static void boot_fdt_reserve_region(u64 addr, u64 size, enum lmb_flags flags)
debug(" reserving fdt memory region: addr=%llx size=%llx flags=%x\n",
(unsigned long long)addr,
(unsigned long long)size, flags);
- } else {
+ } else if (ret != -EEXIST) {
puts("ERROR: reserving fdt memory region failed ");
printf("(addr=%llx size=%llx flags=%x)\n",
(unsigned long long)addr,