aboutsummaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/bootm_os.c5
-rw-r--r--boot/fdt_region.c43
-rw-r--r--boot/image-fit.c4
-rw-r--r--boot/pxe_utils.c8
4 files changed, 47 insertions, 13 deletions
diff --git a/boot/bootm_os.c b/boot/bootm_os.c
index e635c72709..f31820cd07 100644
--- a/boot/bootm_os.c
+++ b/boot/bootm_os.c
@@ -26,12 +26,9 @@ DECLARE_GLOBAL_DATA_PTR;
static int do_bootm_standalone(int flag, int argc, char *const argv[],
bootm_headers_t *images)
{
- char *s;
int (*appl)(int, char *const[]);
- /* Don't start if "autostart" is set to "no" */
- s = env_get("autostart");
- if ((s != NULL) && !strcmp(s, "no")) {
+ if (!env_get_autostart()) {
env_set_hex("filesize", images->os.image_len);
return 0;
}
diff --git a/boot/fdt_region.c b/boot/fdt_region.c
index e4ef0ca770..bac5559329 100644
--- a/boot/fdt_region.c
+++ b/boot/fdt_region.c
@@ -185,6 +185,8 @@ static int fdt_add_region(struct fdt_region_state *info, int offset, int size)
reg++;
reg->offset = offset;
reg->size = size;
+ if (!(offset - fdt_off_dt_struct(info->fdt)))
+ info->have_node = true;
}
} else {
return -1;
@@ -342,13 +344,19 @@ static int fdt_include_supernodes(struct fdt_region_state *info, int depth)
return 0;
}
+/*
+ * Tracks the progress through the device tree. Everything fdt_next_region() is
+ * called it picks up at the same state as last time, looks at info->start and
+ * decides what region to add next
+ */
enum {
- FDT_DONE_NOTHING,
- FDT_DONE_MEM_RSVMAP,
- FDT_DONE_STRUCT,
- FDT_DONE_END,
- FDT_DONE_STRINGS,
- FDT_DONE_ALL,
+ FDT_DONE_NOTHING, /* Starting */
+ FDT_DONE_MEM_RSVMAP, /* Completed mem_rsvmap region */
+ FDT_DONE_STRUCT, /* Completed struct region */
+ FDT_DONE_EMPTY, /* Completed checking for empty struct region */
+ FDT_DONE_END, /* Completed the FDT_END tag */
+ FDT_DONE_STRINGS, /* Completed the strings */
+ FDT_DONE_ALL, /* All done */
};
int fdt_first_region(const void *fdt,
@@ -365,6 +373,7 @@ int fdt_first_region(const void *fdt,
info->can_merge = 1;
info->max_regions = 1;
info->start = -1;
+ info->have_node = false;
p->want = WANT_NOTHING;
p->end = path;
*p->end = '\0';
@@ -633,6 +642,8 @@ int fdt_next_region(const void *fdt,
* region.
*/
if (!include && info->start != -1) {
+ if (!info->start)
+ info->have_node = true;
if (fdt_add_region(info, base + info->start,
stop_at - info->start))
return 0;
@@ -644,11 +655,31 @@ int fdt_next_region(const void *fdt,
info->ptrs = p;
}
+ if (info->ptrs.done < FDT_DONE_EMPTY) {
+ /*
+ * Handle a special case where no nodes have been written. Write
+ * the first { so we have at least something, since
+ * FDT_REG_SUPERNODES means that a valid tree is required. A
+ * tree with no nodes is not valid
+ */
+ if ((flags & FDT_REG_SUPERNODES) && !info->have_node &&
+ info->start) {
+ /* Output the FDT_BEGIN_NODE and the empty name */
+ if (fdt_add_region(info, base, 8))
+ return 0;
+ }
+ info->ptrs.done++;
+ }
+
/* Add a region for the END tag and a separate one for string table */
if (info->ptrs.done < FDT_DONE_END) {
if (info->ptrs.nextoffset != fdt_size_dt_struct(fdt))
return -FDT_ERR_BADSTRUCTURE;
+ /* Output the } before the end tag to finish it off */
+ if (info->start == fdt_size_dt_struct(fdt) - 4)
+ info->start -= 4;
+
if (fdt_add_region(info, base + info->start,
info->ptrs.nextoffset - info->start))
return 0;
diff --git a/boot/image-fit.c b/boot/image-fit.c
index 33b4a46028..b629339f4e 100644
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -1202,7 +1202,7 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp)
* calculate_hash - calculate and return hash for provided input data
* @data: pointer to the input data
* @data_len: data length
- * @algo: requested hash algorithm
+ * @name: requested hash algorithm name
* @value: pointer to the char, will hold hash value data (caller must
* allocate enough free space)
* value_len: length of the calculated hash
@@ -1230,7 +1230,7 @@ int calculate_hash(const void *data, int data_len, const char *name,
return -1;
}
- hash_algo = hash_algo_lookup_by_name(algo);
+ hash_algo = hash_algo_lookup_by_name(name);
if (hash_algo == HASH_ALGO_INVALID) {
debug("Unsupported hash algorithm\n");
return -1;
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index a7a84f26c1..a32acca8ee 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -550,7 +550,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
* Scenario 2: If there is an fdt_addr specified, pass it along to
* bootm, and adjust argc appropriately.
*
- * Scenario 3: fdt blob is not available.
+ * Scenario 3: If there is an fdtcontroladdr specified, pass it along to
+ * bootm, and adjust argc appropriately.
+ *
+ * Scenario 4: fdt blob is not available.
*/
bootm_argv[3] = env_get("fdt_addr_r");
@@ -652,6 +655,9 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
if (!bootm_argv[3])
bootm_argv[3] = env_get("fdt_addr");
+ if (!bootm_argv[3])
+ bootm_argv[3] = env_get("fdtcontroladdr");
+
if (bootm_argv[3]) {
if (!bootm_argv[2])
bootm_argv[2] = "-";