From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Thu, 23 Aug 2012 11:28:34 +0200 Subject: [U-Boot] [PATCH] SPL: do not use fix value for u-boot size In-Reply-To: <5035F68A.4080503@denx.de> References: <1345711214-11969-1-git-send-email-sbabic@denx.de> <5035EF12.4020505@gmail.com> <5035F68A.4080503@denx.de> Message-ID: <5035F7C2.9060907@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Stefano, On 08/23/2012 11:23 AM, Stefano Babic wrote: >>> diff --git a/common/spl/spl.c b/common/spl/spl.c >>> index 7d15460..827ff1c 100644 >>> --- a/common/spl/spl.c >>> +++ b/common/spl/spl.c >>> @@ -100,7 +100,11 @@ void spl_parse_image_header(const struct image_header *header) >>> debug("mkimage signature not found - ih_magic = %x\n", >>> header->ih_magic); >>> /* Let's assume U-Boot will not be more than 200 KB */ >>> +#ifdef CONFIG_SYS_MONITOR_LEN >>> + spl_image.size = CONFIG_SYS_MONITOR_LEN; >>> +#else >>> spl_image.size = 200 * 1024; >>> +#endif >> >> Yes, I noticed this 200 KiB setting as well. But it seems that this >> ".size" variable is not referenced at all. Or am I missing something? > > Your are missing something: > > drivers/mmc/spl_mmc.c: > > 55 /* convert size to sectors - round up */ > 56 image_size_sectors = (spl_image.size + MMCSD_SECTOR_SIZE - 1) / > 57 MMCSD_SECTOR_SIZE; > > And I have an example where only a part of u-boot is copied. Ahh, I see. Thanks. I would prefer the following approach then, to move the #ifdef out of the C code: #ifndef CONFIG_SYS_MONITOR_LEN #define CONFIG_SYS_MONITOR_LEN (200 * 1024) #endif and then use CONFIG_SYS_MONITOR_LEN unconditionally. Thanks, Stefan