aboutsummaryrefslogtreecommitdiffstats
path: root/boot
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2022-10-28 11:01:18 +0200
committerTom Rini <trini@konsulko.com>2022-12-12 14:03:12 -0500
commitf723c2778cf883c5714aa942b4500846dc09f8f3 (patch)
tree6c60d9c4661d911e64812b7e2709f3337ca31633 /boot
parent4c56d75117341103388f001818a0a1f8f6c449f1 (diff)
downloadu-boot-f723c2778cf883c5714aa942b4500846dc09f8f3.tar.gz
cmd: pxe: reorder kernel treatment in label_boot
Reorder kernel treatment in label_boot at the beginning of the function. This patch doesn't change the pxe command behavior, it is only a preliminary step for next patch, build kernel_addr before parsing the label initrd and fdt to build the next bootm arguments. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Diffstat (limited to 'boot')
-rw-r--r--boot/pxe_utils.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 8133006875f..fc453bd5397 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -521,6 +521,27 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
return 1;
}
+ if (get_relfile_envaddr(ctx, label->kernel, "kernel_addr_r",
+ NULL) < 0) {
+ printf("Skipping %s for failure retrieving kernel\n",
+ label->name);
+ return 1;
+ }
+
+ kernel_addr = env_get("kernel_addr_r");
+ /* for FIT, append the configuration identifier */
+ if (label->config) {
+ int len = strlen(kernel_addr) + strlen(label->config) + 1;
+
+ fit_addr = malloc(len);
+ if (!fit_addr) {
+ printf("malloc fail (FIT address)\n");
+ return 1;
+ }
+ snprintf(fit_addr, len, "%s%s", kernel_addr, label->config);
+ kernel_addr = fit_addr;
+ }
+
if (label->initrd) {
ulong size;
@@ -528,21 +549,14 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
&size) < 0) {
printf("Skipping %s for failure retrieving initrd\n",
label->name);
- return 1;
+ goto cleanup;
}
initrd_addr_str = env_get("ramdisk_addr_r");
size = snprintf(initrd_str, sizeof(initrd_str), "%s:%lx",
initrd_addr_str, size);
if (size >= sizeof(initrd_str))
- return 1;
- }
-
- if (get_relfile_envaddr(ctx, label->kernel, "kernel_addr_r",
- NULL) < 0) {
- printf("Skipping %s for failure retrieving kernel\n",
- label->name);
- return 1;
+ goto cleanup;
}
if (label->ipappend & 0x1) {
@@ -572,7 +586,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
strlen(label->append ?: ""),
strlen(ip_str), strlen(mac_str),
sizeof(bootargs));
- return 1;
+ goto cleanup;
}
if (label->append)
@@ -587,21 +601,6 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
printf("append: %s\n", finalbootargs);
}
- kernel_addr = env_get("kernel_addr_r");
-
- /* for FIT, append the configuration identifier */
- if (label->config) {
- int len = strlen(kernel_addr) + strlen(label->config) + 1;
-
- fit_addr = malloc(len);
- if (!fit_addr) {
- printf("malloc fail (FIT address)\n");
- return 1;
- }
- snprintf(fit_addr, len, "%s%s", kernel_addr, label->config);
- kernel_addr = fit_addr;
- }
-
/*
* fdt usage is optional:
* It handles the following scenarios.