grub-core/lib/fdt.c: correctly update size_dt_struct in add_subnode()
This commit is contained in:
parent
e5ed2f6947
commit
bbeee1c4a3
2 changed files with 6 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-12-05 Leif Lindholm <leif.lindholm@linaro.org>
|
||||||
|
|
||||||
|
* grub-core/kern/fdt.c: Update struct size when adding node.
|
||||||
|
|
||||||
2013-12-05 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-12-05 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Handle unaligned .bss on sparc64.
|
Handle unaligned .bss on sparc64.
|
||||||
|
|
|
@ -132,6 +132,7 @@ static int add_subnode (void *fdt, int parentoffset, const char *name)
|
||||||
+ parentoffset);
|
+ parentoffset);
|
||||||
grub_uint32_t *end = (void *) struct_end (fdt);
|
grub_uint32_t *end = (void *) struct_end (fdt);
|
||||||
unsigned int entry_size = node_entry_size (name);
|
unsigned int entry_size = node_entry_size (name);
|
||||||
|
unsigned int struct_size = grub_fdt_get_size_dt_struct(fdt);
|
||||||
char *node_name;
|
char *node_name;
|
||||||
|
|
||||||
SKIP_NODE_NAME(node_name, token, end);
|
SKIP_NODE_NAME(node_name, token, end);
|
||||||
|
@ -167,6 +168,7 @@ insert:
|
||||||
token[entry_size / sizeof(*token) - 2] = 0; /* padding bytes */
|
token[entry_size / sizeof(*token) - 2] = 0; /* padding bytes */
|
||||||
grub_strcpy((char *) (token + 1), name);
|
grub_strcpy((char *) (token + 1), name);
|
||||||
token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE);
|
token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE);
|
||||||
|
grub_fdt_set_size_dt_struct (fdt, struct_size + entry_size);
|
||||||
return ((grub_addr_t) token - (grub_addr_t) fdt
|
return ((grub_addr_t) token - (grub_addr_t) fdt
|
||||||
- grub_fdt_get_off_dt_struct(fdt));
|
- grub_fdt_get_off_dt_struct(fdt));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue