Murtaza Amiji <Murtaza_Amiji@nmss.com> wrote:
I have two issues with flash filesystem on our board that i cannot find
answers to. Hopefully someone here can help me with them.
- We have a 1MB AMD flash memory on our PPC board. We would like to put
a flash filesystem on only the last 64K block of this 1MB part. I can do
that if I hack the driver code in two places:
- In the driver open function, Set the base address to 0xffff0000
and window size to 0x10000 (64K)
- In the driver identification database, hack the geometry of the
specific AMD flash devide we have on board and limit the number of
available blocks to only 1 64K block ({1, 2^16}).
You can use the flashctl utility to achieve what you want, and there should
be no need to modify the flash driver. You didn’t say what the part number
of your flash is, but presumably the physical erase block size is 64k.
The flashctl utility has options to specify an offset to begin erasing or
formatting at, and the size of the area.
By default, when you use flashctl to make a flash filesystem, one flash
block is allocated as an erase block, which is used as temporary storage
when it becomes necessary to reclaim unused space. Since you want to use
only one block, this means you will have no erase block, which is fine,
as long as you’re using it as a read-only filesystem.
So, after starting the flash driver, the entire 1M device appears as:
/dev/fs0
/dev/fs0p0
you want to create a flash filesystem in the last 64k, so:
flashctl -p/dev/fs0p0 -o960k -l64k -s0 -ef
this starts the erase / format operation at offset 960k of the flash,
for 64k, specifying that no erase (spare) block will be used.
After this, you should have a blank 64k flash filesystem.
Conversely, if you want to pre-generate your flash filesystem using the
mkefs command, the efs.build file should look like this:
[block_size=64k spare_blocks=0 min_size=64k max_size=64k]
…/root
then, combine the other pieces of your image (IPL, ROM Monitor, OS image,
etc.) together with the efs image file, so that the combined file is
exactly 1M, and burn it to the flash.
Be aware that the efs image must start on a block size boundary in order
for it to be recognized by the flash driver. So, if the other image
components come out to 1M - 100k, don’t place the 64k flash filesystem
at the 924k mark; instead, pad the other part out to 960k, then place
the efs image at the 960k mark.
hope this helps,
Dave
While the above works, this is not an elegant solution. There has to be
a way one can specify to the driver to only make use of a small portion
of the flash starting at some new base address. I thought by providing
via command line, a new address with -S and a window_size of 0x10000 will
do the trick but no luck. Any other suggestions ?
- When we burn our raw image to the flash, the image takes up all but
the last 100K bytes or so. I would like to use the last 64K as a flash
filesystem and have it pre-loaded with some apps such that I will only
need to mount the flash filesystem device and be able to access the apps
bundled with mkefs. Is this possible ? Will mkefs allow me to create a
64K formatted flash filesystem image that can be appended to the last 64K
block. If yes then how to do this.
I created a 64K flash filesystem image with mkefs and appended it at the
end of the boot image created with mkifs. When I dump it on the board,
the 64K flash block is not formatted hence it cannot be mounted. And
obviously, after issusing the format command, i can mount it but the
image built with mkefs is of no use anymore.
Thanks
–
Dave Green (dgreen@qnx.com)
QNX Software Systems Ltd.
http://www.qnx.com