From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from kirsty.vergenet.net ([202.4.237.240]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQU0q-0001lh-Kl for kexec@lists.infradead.org; Thu, 20 Mar 2014 03:51:25 +0000 Date: Thu, 20 Mar 2014 12:51:02 +0900 From: Simon Horman Subject: Re: [PATCH 1/2] kexec: align initrd when no --image-size passed Message-ID: <20140320035102.GD10601@verge.net.au> References: <1395282993-37549-1-git-send-email-wangnan0@huawei.com> <1395282993-37549-2-git-send-email-wangnan0@huawei.com> <20140320032506.GA4722@dhcp-16-126.nay.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140320032506.GA4722@dhcp-16-126.nay.redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=twosheds.infradead.org@lists.infradead.org To: Dave Young Cc: Wang Nan , kexec@lists.infradead.org, Geng Hui On Thu, Mar 20, 2014 at 11:25:07AM +0800, Dave Young wrote: > On 03/20/14 at 10:36am, Wang Nan wrote: > > Before this patch, when no --image-size passed, initrd_base is caculated using > > base + len * 4, which is unaligned, and unable to pass check in > > add_segment_phys_virt(): > > > > if (base & (pagesize -1)) { > > die("Base address: 0x%lx is not page aligned\n", base); > > } > > > > This patch also uses getpagesize() instead of hard encoded 4096. > > > > Signed-off-by: Wang Nan > > Cc: Simon Horman > > Cc: Dave Young > > Cc: Geng Hui > > --- > > kexec/arch/arm/kexec-zImage-arm.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c > > index 792187a..8a35018 100644 > > --- a/kexec/arch/arm/kexec-zImage-arm.c > > +++ b/kexec/arch/arm/kexec-zImage-arm.c > > @@ -347,11 +347,11 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len, > > /* If the image size was passed as command line argument, > > * use that value for determining the address for initrd, > > * atags and dtb images. page-align the given length.*/ > > - initrd_base = base + _ALIGN(kexec_arm_image_size, 4096); > > + initrd_base = base + _ALIGN(kexec_arm_image_size, getpagesize()); > > } else { > > /* Otherwise, assume the maximum kernel compression ratio > > * is 4, and just to be safe, place ramdisk after that */ > > - initrd_base = base + len * 4; > > + initrd_base = base + _ALIGN(len * 4, getpagesize()); > > } > > > > if (use_atags) { > > -- > > 1.8.4 > > > > Acked-by: Dave Young Thanks, applied. _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec