From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Thu, 24 Feb 2011 09:07:03 +0100 Subject: [U-Boot] ARM: Incorrect ROM protection range? In-Reply-To: References: <4D660030.409@free.fr> <4D6609C5.3040203@denx.de> Message-ID: <4D6611A7.5050802@free.fr> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Le 24/02/2011 08:40, Po-Yu Chuang a ?crit : > Hi Heiko, > > On Thu, Feb 24, 2011 at 3:33 PM, Heiko Schocher wrote: >> Albert ARIBAUD wrote: >> The bin length is calculated in arch/arm/lib/board.c, but it seems >> to me not correct ... :-( >> >> in board_init_f(): >> >> gd->mon_len = _bss_end_ofs; >> >> that seems correct to me, but later in board_init_r() >> >> monitor_flash_len = _bss_start_ofs; >> >> which is used for example in ./drivers/mtd/cfi_flash.c for protecting >> the flash sectors ... so this should be fixed. Correct. >>> In the U-Boot image itself, knowing the image size could be achieved in >>> ARM by using a general _end symbol that would be set after the last >>> image output section, so _end-_start would equal the image size. >> >> we have such a "_end" in u-boot.lds files. I *knew* this name did not pop up in my mind without a reason. :) Apologies for not having checked. > I guess we need a __dynsym_end in all u-boot.lds files. I'd rather go for "_end", which does not tie the solution to dynsym being the last section in the image -- imagine for some reason we move dynsym inside the image rather than at the end, end the image size will be wrong again. With _end, and a suitable comment in the LD file... this will be averted where-ever dynsym ends up. After all, the bug you uncovered was due to using the wrong symbol, a BSS related one rather than an image-related one, in the first place; so let's try and learn from past mistakes. > best regards, > Po-Yu Chuang Amicalement, -- Albert.