Commit 5570b424 authored by Bhupesh Sharma's avatar Bhupesh Sharma Committed by Simon Horman
Browse files

kexec/dt-ops.c: Fix adding '/chosen' node for cases where it is not available...


kexec/dt-ops.c: Fix adding '/chosen' node for cases where it is not available in dtb passed via --dtb option

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

Reported-by: default avatarVicente Bergas <vicencb@gmail.com>
Signed-off-by: default avatarBhupesh Sharma <bhsharma@redhat.com>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 9dcf363f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment