kexex: arm: create ATAGS_MEM tag from devicetree memory node
Subsystems (2)
PATCH v2 1/1 kexex: arm: create ATAGS_MEM tag from devicetree memory node
booting a non-devicetree kernel from a devicetree kernel failed, since the memory layout wasn't passed.
Signed-off-by Andreas Fenkart <[email protected]>
--- kexec/arch/arm/kexec-zImage-arm.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
kexec/arch/arm/kexec-zImage-arm.c +38 -0
@@ -139,6 +139,38 @@ struct tag * atag_read_tags(void)return (struct tag *) buf; } +static +int create_mem32_tag (struct tag_mem32 *tag_mem32) +{ +const char fn[]="/proc/device-tree/memory/reg" ; +uint32_t tmp[2 ]; +FILE *fp; + + fp =fopen (fn,"r" ); +if (!fp) { +fprintf (stderr,"Cannot open %s: %m\n" , fn); +return -1 ; + } + +if (fread (tmp,sizeof (tmp[0 ]),2 , fp) !=2 ) { +fprintf (stderr,"Short read %s\n" , fn); +fclose (fp); +return -1 ; + } + +if (ferror (fp)) { +fprintf (stderr,"Cannot read %s: %m\n" , fn); +fclose (fp); +return -1 ; + } + +/* atags_mem32 has base/size fields reversed! */ + tag_mem32->size =be32_to_cpu (tmp[1 ]); + tag_mem32->start =be32_to_cpu (tmp[0 ]); + +fclose (fp); +return 0 ; +} static int atag_arm_load(struct kexec_info *info, unsigned long base,
@@ -182,6 +214,12 @@ int atag_arm_load(struct kexec_info *info, unsigned long base, params->hdr.size =2 ; params->hdr.tag =ATAG_CORE ; params =tag_next (params); + +if (!create_mem32_tag (¶ms->u.mem)) { + params->hdr.size =4 ; + params->hdr.tag =ATAG_MEM ; + params =tag_next (params); + } }if (initrd) {
Signature · 7 lines
2.6.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedQuoted 7 lines · Andreas Fenkart
booting a non-devicetree kernel from a devicetree kernel failed, since the memory layout wasn't passed.
Signed-off-by Andreas Fenkart <[email protected]>--- kexec/arch/arm/kexec-zImage-arm.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
Thanks, applied.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec