News:

Re-organized the forum to more cleanly delineate the development section, as the end user support side appears to have taken a life of its own!

Author Topic: Relating bootloader image number to flash sector?  (Read 4993 times)

  • *****
April 26, 2011, 05:11:36 pm
I have been reading spec sheets for Spansion S29AL016D flash memory (4MB) and using my hex calculator until my brain hurts.  Maybe someone here can help me understand how the bootloader image blocks relate to the  Spansion S29AL016D flash memory sectors. As I understand it, the S29AL016D has eight sectors of 8kB each at its lowest addresses, identified as SA0 through SA7, followed by sixty-three sectors of 64kB each, identified as SA8 through SA70. This totals 4,194,304 bytes, the size of the  S29AL016D. Thus, there are a total of 64 sectors of 65,536 bytes in the  S29AL016D, of which the first sector is reserved as a boot sector.

Now, the camera's bootloader reports the flash images as follows:

Foscam with a 2MB flash looks like this:
Image: 0 name:BOOT INFO base:0x7F010000 size:0×00000038 exec:0x7F010000 -af
Image: 7 name:linux.bin base:0x7F020000 size:0x000BB334 exec:0×00008000 -acxz
Image: 6 name:romfs.img base:0x7F0E0000 size:0x0008D000 exec:0x7F0E0000 -a

How do the image numbers reported by the bootloader relate to the Spansion S29AL016D flash memory's sectors?

  • *****
April 27, 2011, 11:03:21 pm
I was fiddling with a hex calculator, looking at the 56 byte BOOT-INFO image, wondering if it was a vector table. I came up with nothing there but then wondered - (1) why image 0, 6, 7 & 8 (webui)? What happened to 1 through 5? Why does image 7 have a base address that is lower than image 6? There must be a reason for this stuff?

April 28, 2011, 02:20:19 am
I don't think so. When creating an image, you seem to be able to assign it whatever number you want. It is possible that the bootloader expects certain image numbers to be certain things, but that seems unlikely (given the available flags).

  • *****
April 28, 2011, 08:44:25 am
Disassembling the bootloader could prove useful for determining such information. I assume that the bootloader is in flash that is internal to the cpu?

April 28, 2011, 09:03:20 am
Actually, I believe it resides at 0x7F000000 to 0x7F00FFFF, give or take a bit (mine ends at 0x7F00F4C).

Why do you want to disassemble it?

  • *****
April 28, 2011, 10:36:30 am
Nocturnal, you have obviously poked around in the memory more than I have. Unless you have the source for the boot program what other choice is there for examining the code other than disassembly? I would like to understand more about what is going on in the boot process and what needs to be stored where. For example, to my knowledge, the image "BOOT INFO" remains a mystery.

Given that you have delved into the memory more than most readers of this site, would you be willing to post a memory map of your findings?

April 28, 2011, 11:43:54 am
:-) I wouldn't say I spent much time poking around in the memory, only about 20 minutes or so looking through the dump of the flash memory I did while looking for the WebUI. I do happen to have an approximate memory map.

7f000000 bootloader
7f020000 linux
7f0e0000 romfs
7f1e0000 Blank
7f1f0000 User Settings
7f1f8000 Factory Settings
7f200000 WebUI files
7f28e9f0 End webui
7f400000 end

The settings blocks appear to be broken down into sub block, with headers similar to the one used with the WebUI, but I haven't taken a close look.

I'm just curious what your end goal is. The only time I have ever decompiled a bootloader was because I needed to replicate its function to replace it.

  • *****
April 28, 2011, 07:45:33 pm
My end goal is to understand more about the current system and hardware. One of my faults is to want to more than is necessary to accomplish a task. I always want to know why? I felt that I could see the boot source code that some mysteries would be revealed, like what is the "ROM INFO" image used for?

Also, while images 0, 6,7 & 8 are listed in the bootloader's "ls" command, I notice that other images are read during boot (see below) - what are they used for? There are too many puzzles for me to be happy.

Processing image 2 ...
Processing image 3 ...
Processing image 4 ...
Processing image 5 ...
Processing image 6 ...
Processing image 7 ...
Unzip image 7 ...
Executing image 7 ...
Linux version 2.4.20-uc0 (root@maverick-linux) (gcc version 3.0) #1453 �һ 12�� 6 08:30:46 CST 2010


  • No avatar
  • *****
May 12, 2011, 09:49:17 pm
All the info on this is in the files section.

Read the W745N documentation, and the uBoot documentation.

The source code for all this is in there too.