[PATCH 2/2] kexec: pass initrd position in dtb

Dave Young dyoung at redhat.com
Thu Mar 20 01:37:28 EDT 2014


On 03/20/14 at 11:57am, Wang Nan wrote:
> On 2014/3/20 11:34, Dave Young wrote:
> > On 03/20/14 at 11:26am, Dave Young wrote:
> >> On 03/20/14 at 10:36am, Wang Nan wrote:
> >>> This patch append the position of initrd to dtb when loading arm kernel
> >>> and initrd without using atag.
> >>>
> >>> Signed-off-by: Wang Nan <wangnan0 at huawei.com>
> >>> Cc: Simon Horman <horms at verge.net.au>
> >>> Cc: Dave Young <dyoung at redhat.com>
> >>> Cc: Geng Hui <hui.geng at huawei.com>
> >>> ---
> >>>  kexec/arch/arm/kexec-zImage-arm.c | 84 +++++++++++++++++++++++++++------------
> >>>  1 file changed, 59 insertions(+), 25 deletions(-)
> >>>
> >>> diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
> >>> index 8a35018..15d8829 100644
> >>> --- a/kexec/arch/arm/kexec-zImage-arm.c
> >>> +++ b/kexec/arch/arm/kexec-zImage-arm.c
> >>> @@ -20,6 +20,7 @@
> >>>  #include "kexec-arm.h"
> >>>  #include "../../fs2dt.h"
> >>>  #include "crashdump-arm.h"
> >>> +#include "libfdt_internal.h"
> >>
> >> I guess it's for the FDT_TAGALIGN and FDT_TAGSIZE?
> >> libfdt_internal.h should be used as internal header for libfdt, a better way is
> >> adding another patch which move these 2 macros to fdt.h
> > 
> > Or moving your new function setup_dtb_prop to libfdt, I'm not sure if it works on
> > other arch though.
> > 
> >> Thanks
> >> Dave
> 
> 
> What about following midification (FDT_TAGSIZE is in fdt.h)?
> I'll send it formally if you agree this one.
> 
> diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
> index 15d8829..1cd4ed0 100644
> --- a/kexec/arch/arm/kexec-zImage-arm.c
> +++ b/kexec/arch/arm/kexec-zImage-arm.c
> @@ -20,7 +20,6 @@
>  #include "kexec-arm.h"
>  #include "../../fs2dt.h"
>  #include "crashdump-arm.h"
> -#include "libfdt_internal.h"
> 
>  #define BOOT_PARAMS_SIZE 1536
> 
> @@ -229,8 +228,8 @@ static int setup_dtb_prop(char **bufp, off_t *sizep, const char *node_name,
>         dtb_buf = *bufp;
> 
>         *sizep = fdt_totalsize(*bufp) + FDT_TAGSIZE + len +
> -               FDT_TAGALIGN(strlen(node_name) + 1) +
> -               FDT_TAGALIGN(strlen(prop_name) + 1) +
> +               _ALIGN(strlen(node_name) + 1, FDT_TAGSIZE) +
> +               _ALIGN(strlen(prop_name) + 1, FDT_TAGSIZE) +
>                 sizeof(struct fdt_property);
> 
>         dtb_buf = xrealloc(dtb_buf, *sizep);
> 

Looks good...

Thanks
Dave



More information about the kexec mailing list