Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
End Users
Pocket PCActiveSyncMultimediaEBooksWirelessSmartPhones
Developers
Windows MobileSmartPhonesWinCE ProgrammingVB for WinCEVC++ for WinCEPlatform BuilderTest Tools
PocketPC DirectoryFree SoftwareWeb Resources
Related Topics
PalmMobile PhonesMore Topics ...

Pocket PC Forum / Developers / Platform Builder / July 2007

Tip: Looking for answers? Try searching our database.

BinFS + Multiple XIP

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Oren - 25 Jun 2007 21:16 GMT
Hello all,
I have read all previous threads regarding that issue and still could
not understand one point.
Please help:

My system includes PXA320, which has a nand controller.
In order to save RAM i made a BINFS partition in my bootloader and i
would like to download nk.bin + apps.bin + chain.bin to the nand.
At bootup, i am extracting the nk.bin from NAND, parse it to RAM, and
i would like the OS load all other necessary DLLs on demand. I have
included all necessary BinFS + blockdriver registry settings.

The Bin files which i am downloading are chunks of memory with RAM
addresses/lengths.
I am putting all those Bin Files one after the other in NAND as
downloaded from PB(as is).

My questions are:
1. How does the OS extract the DLL list which resides
in those Bin files? i mean there is not even one continuous file
there, only a large number of memory chunks which should be put in
ram.

2. The BinFs registry settings. Should they be put in the boot hive
or
in system hive.

Thanks for your help.
Oren.
sooly0120@gmail.com - 26 Jun 2007 05:26 GMT
i think:
In the function OEMinit, a structure which contains the romchain
information will be returned to kernel. I guess this tells the kernel
where to load the bin files.
To enable the demand paging, Binfs should be included in nk.bin.
And because binfs is loaded during boot phase 0, the registry setting
should be in the boot registry.

Hope it helps.
Ryan

> Hello all,
> I have read all previous threads regarding that issue and still could
[quoted text clipped - 25 lines]
> Thanks for your help.
> Oren.
Oren - 26 Jun 2007 08:11 GMT
Hi Ryan,

I am not positive, but i think the RomChain has nothing to do with it.
RomChain helps in cases of RAM XIP chains or XIP ROM. in my case,
which is NAND flash the RomChain cann't help. The BinFS should read
the Bin Files and determine which DLLs they contain by itself.

Thanks for you help.
Oren.
ryan - 26 Jun 2007 17:37 GMT
ok, i misunderstood your post. It is beyond my knowledge.
can't help...

Ryan
Oren - 26 Jun 2007 20:24 GMT
Thanks anyway...
Anyone ? any help would be appreciated.
K. S. Huang - 26 Jun 2007 22:58 GMT
Basically OS or filesys.exe for more specific only got the file lists in
nk.bin but nothing about the files in BinFS.
In general we will shadow the \Windows folder with BinFS by MountAsROM
mounting setting, so that whenever the filesys try to access the file in
\Windows folder it will access the file via BinFS.
The BinFS will parse the Image chunk from the Disk Storage and for more
detail you could refer the source blow...

The source for BINFS could be found under
$(_WINCEROOT)PRIVATE\WINCEOS\COREOS\FSD\BINFS\

For registry setting, it will be a good idea to put them in boot hive while
we would like the BINFS be mounted in very early phase, further more, the
nk.bin should contain enough modules (driver, filesystem, storage manager,
WINCE.NLS when devmgr loaded in boot phase 0 and etc) for mounting the BinFS
properly. You may want to start from a huge NK.BIN with a tiny BINFS and
then try to move file back and forth for finding a minimum nk.

After that you may want to start on fine tuning the performance of BinFS
while files are loaded from Flash on-demand but not at once, if RAM is
plenty on your device try to enlarge the cbNKPagingPoolSize value in OAL
could improve the overall performance. In most case, having a 4 to 5 MB
should get a significant improvement.

> Hello all,
> I have read all previous threads regarding that issue and still could
[quoted text clipped - 25 lines]
> Thanks for your help.
> Oren.
Oren - 27 Jun 2007 19:49 GMT
Huang, Thanks alot for your answer. it helped me a lot.
I would appreciate if you can clarify 2 more points for me:

I am downloading the files one by one through PB using the chain.lst.

I put them exactly as they arrive to the NAND flash. So they will lay
one followed by the other. I even leave the 7 character header (in HEX
it is "BOOOF.."). So I have 4 files concatenated, exactly as in my PC
release dir.

When launching my system, I start reading the first file from the
binfs, and parse it to memory. Than the OS runs and loads the rest?

My questions are:

1. The binFS that the OS loads. How can it find the DLLs which reside
in the Bin files which have no file-system format? After all they are
still in their raw format as they would be in my PC in the workspaces
\myproject\realesedir.

2. Should I omit the 7 characet header in the bin files in the nand?
or the binfs knows how to ignore them?

Another point is the relocation table in the NAND:

The bootloader can create a relocation table.

When it does that all the NAND blocks are mapped.

The bootloader bootpart.c. function BP_CreatePartiion format the nand
again, and make a binfs partition which has nothing to do with the
relocation table. It writes linear data, so it just skips bad blocks
to the one after it.

When loading the OS afterwards, my fmd loads, and trys to read the
relocation table. But now after the BinFS owns his own blocks, it is
irrelevant.

Can you explain me that issue?

Thanks a lot for your help!

Oren
K. S. Huang - 28 Jun 2007 00:23 GMT
I think you could just download the xip.bin which is already composted from
all of the .bin file including the chain.bin but no need to download the
.bin file separately.
While the BIN file dose contain a TOC inside which will let one could
address every MODULES/FILES inside by walking through the TOC and that's how
the BinFS to locate the files inside.
Basically, you should downlaod the xip.bin file and a BinFS aware EBoot
should parse it and then write the extracted chunks into NAND Flash (usually
with creating a PART_RAMIMAGE type partition for storing the BINFS type
image). And when booting the EBoot will also walk through the Partition for
relocating the nk region into SDRAM.

> Huang, Thanks alot for your answer. it helped me a lot.
> I would appreciate if you can clarify 2 more points for me:
[quoted text clipped - 39 lines]
>
> Oren
Oren - 01 Jul 2007 09:45 GMT
Thanks very much for your help. i will try that!
Oren - 03 Jul 2007 16:26 GMT
Hi Huang!
While working with the bootloader, i have seen that it creates a
relocation table of the blocks of the NAND flash.
The BINFS works around that mechanism, and searches by itself for good
blocks, and just linearly writes the data, while skipping bad blocks.
My question is regarding the PART_EXTENDED partition which should be
used by FatFS or the PART_BINFS which will be used by the O.S.(not the
bootloader this time)
Both the FAT fs and the BinFS will be using the FMD of the o.s. which
tries to locate a relocation table to translate logical block to
physical block.
so whenever the FatFS or BinFS using the flash media driver are trying
to access a block with BOOL FMD_ReadSector. the FMD will try and look
for relocation table. but we went around it in the bootlaoder when
working with BinFS. and that table is no longer relevant.

How do we solve that conflict?

Thanks a lot,
Oren.
K. S. Huang - 03 Jul 2007 19:14 GMT
Basically, in OS context, the FMD driver layer is NOT the complete but just
the part of the Flash FMD driver which containing a upper layer FAL for
managing the flash blocks.
If you got the Shared Source installed for CE6, you could find the source of
FAL under $(_WINCEROOT)\PRIVATE\WINCEOS\DRIVERS\MSFLASH\SRC\ just take a
look at it and you will realize how the FAL rebuild the BAD block and
translation table.

> Hi Huang!
> While working with the bootloader, i have seen that it creates a
[quoted text clipped - 16 lines]
> Thanks a lot,
> Oren.
Oren - 11 Jul 2007 20:38 GMT
Hello Huang again. i can use your help with my last stage.
I partially succeeded to create a BINFS partition, but I still can't
manage to load an image from NAND. It seem I am very close but
something is missing. I would appreciate if you can help me realize
the missing part.

My situation is as follows
As I previously elaborated. I am making a multi bin image.
Nk.bin apps.bin shell.bin chain.bin

1.I am downloading (flattening ) the bin files to RAM
2. I create a binfs partition at the size of all of the whole image in
ram and I copy the ram content to nand. So now I have  a mirror of the
ram in the nand.

My config.bib is as follows:

MEMORY

;   Name     Start     Size      Type
;   -------  --------  --------  ----
   ARGS     80060000  00001000  RESERVED
   NK       800B0000  02000000  RAMIMAGE
   SHELL    820B0000  00100000   NANDIMAGE
   APPS     821B0000  00100000   NANDIMAGE
   CHAIN    822B0000  00002000   RESERVED ; XIP chain info
   RAM      822B2000  04D4E000  RAM
   pdwXIPLoc   00000000   822B0000   FIXUPVAR   ; XIP pTOC

CONFIG

   PROFILE=OFF
    RAM_AUTOSIZE=OFF
   AUTOSIZE=ON
   KERNELFIXUPS=ON
 COMPRESSION=ON
 XIPSCHAIN=822B0000
 DLLADDR_AUTOSIZE=ON
 ROMFLAGS=0
   ROMSTART=800B0000
   ROMWIDTH=32
   ROMSIZE=22B2000
   ROM_AUTOSIZE=OFF

AUTOSIZE_ROMGAP=10000
AUTOSIZE_DLLADDRGAP=0
AUTOSIZE_DLLDATAADDRGAP=0
AUTOSIZE_DLLCODEADDRGAP=0

In OemInit() I deleted the InitRomChain().
In my bootloader I load the nk.bin content (which i flattened) by
myself from Nand, and I expect that when the o.s. launches it will
find the binfs, recognize the rest of the dll which is there, and use
it in demand page. But it doesn't' work.

Am I right to eliminate the chain? I was thinking that if I put
NANDIMAGE type in the APPS region, the chain will actually become
empty, because there are no realy sdram content but it will use this
space to load dlls from the binfs.
So I tried something else:
Same config.bib but:

   NK       800B0000  02000000  RAMIMAGE
   SHELL    820B0000  00100000   RAMIMAGE
   APPS     821B0000  00100000   RAMIMAGE

I downloaded all files again, wrote the flattened image to nand. And
added the initromchain()
Now ofcourse the image loads, and I can see the binfs partition which
includes the content of apps.bin only (nothing from the nk.bin!)
Why is that? The binfs partition actually contain all system dlls. Why
do I see only the ones from apps.bin.

So please, how can I make the first configuration work?
In terms of initromchain(), what is the right way do with binfs?
Anything else missing?

Thanks a lot!
Oren.

by the way :
my reg files is:
all part of the boothive.

; Profile entry for flash driver
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Nand]
   "Dll"="NandFlsh.DLL"             ; Name of block driver dll
   "Order"=dword:2
   "Prefix"="DSK"                  ; Prefix for device name, not
needed??
   "Profile"="Nand"              ; Name of profile, FAL returns this
from IOCTL_DISK_DEVICE_INFO
;    "IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"
   "BlockSize"=dword:4000
   "SectorSize"=dword:200
;    "MemBase"=dword:1EFC000
;    "MemLen"=dword:100000
;   "Flags"=dword:1000        ; If loading in Boot phase 0 is required.

;orenr begin
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash]
   "DefaultFileSystem"="BINFS"
   "PartitionDriver"="mspart.dll"
;    "MountHidden"=dword:1
   "MountAsROM"=dword:1
   "Folder"="Storage"      ; Specify folder name
   "Name"= "FLASH Disk Block Device"
   "AutoMount"=dword:1
   "AutoPart"=dword:1
   "AutoFormat"=dword:1

[HKEY_LOCAL_MACHINE\System\StorageManager\BinFS]
   "FriendlyName"="BIN Filesystem"
   "Dll"="binfs.dll"
   "Paging"=dword:1
   "MountAsROM"=dword:1

[HKEY_LOCAL_MACHINE\System\StorageManager\PartitionTable]
  "20"="BOOT"
  "21"="BINFS"

;orenr end
K. S. Huang - 12 Jul 2007 01:41 GMT
Firstly, were you downloading the xip.bin or you just downlaod each bin file
sperately?
It is strongly recommending that use xip.bin for download is a better
solution.
And how is your EBoot load the nk.bin from flash into SDRAM?
Having NANDIMAGE rather than RAMIMAGE is a right way for BINFS solution
while multiple RAMIMAGE should be used in Multi-XIP.
I will suggest you to enable the Debug mode for getting more info and also
suggest to take a look at the source for EBoot of CEPC in CE6 to realize how
a bootloader will deal with mutilple region BIN file.

And for the registry setting, while your Flash driver's registry assigned
the "Profile" as "Nand", so that you should confirm there is a
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\Nand] in your registry
and contain the data simialr to
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash] key.

> Hello Huang again. i can use your help with my last stage.
> I partially succeeded to create a BINFS partition, but I still can't
[quoted text clipped - 118 lines]
>
> ;orenr end
Oren - 12 Jul 2007 03:55 GMT
I indeed downloaded mutli bin files adn not the xip, why does it
matter.?
when i download the nk.bin i take it addresses(start, and length) and
i write those to my bootargs partition. and than i know what part of
the "mirroed" image to load to ram at boot up.
I did take a loot at cepc of wince6. and i think i quite followed
everyting over there. it deals with multiple bin files as well.

I wonder, if i dowlnoad xip.bin, doesn't it include the chain?
I pretty much sure my reg is ok. that is because, if i download the
whole image from PB and run it, i can clearly see the binfs partition
is working, both through the partition manager and if i "unhidden it"
i can see the files inside. even though only part of them

once again, can you please clarify: if i am using NANDIMAGE, the chain
infomation is not relevant?

Thanks a lot!
Oren - 12 Jul 2007 14:02 GMT
Huang, thanks alot for you help.
I finally managed to make it work.
it seems i had some wrong registry setting. the autoload of the nand
driver was wrong, plus the filesys.exe was exluded from the build.
I managed to save 20mg of ram and boot time is down to 8secs from 30.
The chain.bin is redundant ofcourse.

Thanks again.
Orenl.
K. S. Huang - 12 Jul 2007 21:17 GMT
Oh it is great to head that, and next step you may want to fine tune your
cbNKPagingPoolSize which may increase the overall performance.
Increasing the cbNKPagingPoolSize will reduce the FREE memory size but could
help enhance performance by reducing page missed rate. Have a initial value
from 2MB and then increasing 0.5MB per step to figure out a trade off for
performance and memory footprint.

And I think you did use the NANDIMAGE instead of RAMIMAGE (except to the NK
section of course), right?
NANDIMAGE will bit consume any memory but freeing up more RAM for the
system, as the whole idea, BinFS will access the proper data to kernel when
accessing the modules in these section.

> Huang, thanks alot for you help.
> I finally managed to make it work.
[quoted text clipped - 5 lines]
> Thanks again.
> Orenl.
Oren - 18 Jul 2007 15:48 GMT
Hi Huang.
Thanks for the tip. infact i made sure that i don't declare this Pool
at all. As i understood this will make the O.S. use as much pool as it
needs. without page fault at all.
As out system is very performance sensitive, i will give all weight to
performance.

I did use the NANDIMAGE instead of RAMIMAGE.
Thanks
Oren.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.