While calling 'kexec -l', in case we are passed a .dtb using --dtb option which doesn't contain a '/chosen' node, we try to create the '/chosen' node and add bootargs to this node. Currently the 'dt-ops.c' code is buggy as it passes '-FDT_ERR_NOTFOUND' to 'fdt_add_subnode()', which leads to the following error: # kexec -d --load Image --append 'debug' --dtb rk3399-sapphire.dtb <..snip..> dtb_set_property: fdt_add_subnode failed: FDT_ERR_NOTFOUND kexec: Set device tree bootargs failed. get_cells_size: #address-cells:2 #size-cells:2 cells_size_fitted: 0-0 cells_size_fitted: 0-0 setup_2nd_dtb: no kaslr-seed found This patch passes the correct nodeoffset value to 'fdt_add_subnode()', which fixes this issue: # kexec -d -l Image --append 'debug' --dtb rk3399-sapphire.dtb <..snip..> get_cells_size: #address-cells:2 #size-cells:2 cells_size_fitted: 0-0 cells_size_fitted: 0-0 setup_2nd_dtb: no kaslr-seed found Cc: Simon Horman <horms@xxxxxxxxxxxx> Cc: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx> Reported-by: Vicente Bergas <vicencb@xxxxxxxxx> Signed-off-by: Bhupesh Sharma <bhsharma@xxxxxxxxxx> --- kexec/dt-ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kexec/dt-ops.c b/kexec/dt-ops.c index f15174c3c74e..bdc16dc87642 100644 --- a/kexec/dt-ops.c +++ b/kexec/dt-ops.c @@ -80,15 +80,16 @@ int dtb_set_property(char **dtb, off_t *dtb_size, const char *node, } nodeoffset = fdt_path_offset(new_dtb, node); - + if (nodeoffset == -FDT_ERR_NOTFOUND) { - result = fdt_add_subnode(new_dtb, nodeoffset, node); + result = fdt_add_subnode(new_dtb, 0, node); if (result < 0) { dbgprintf("%s: fdt_add_subnode failed: %s\n", __func__, fdt_strerror(result)); goto on_error; } + nodeoffset = result; } else if (nodeoffset < 0) { dbgprintf("%s: fdt_path_offset failed: %s\n", __func__, fdt_strerror(nodeoffset)); -- 2.7.4 _______________________________________________ kexec mailing list kexec@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/kexec