Updating os image from application RRS feed

  • Question

  • Is it possible for an application to update an OS image on Flash memory?

    The situation should be: the board boots from SD with a minimal size, the OS loads the nedded devices and it should write the Flash with a file on the SD.

    Should i need a particular driver to access the Flash?

    How can i know the addresses of the start of the bootloader, os image and Flash storage ? They are detectable or must i fix them for the device ?


    Tuesday, September 28, 2010 1:55 PM


All replies

  • It is possible, but not necessarily easy.  You don't tell us what type of flash you have on your device, which can make a difference.  You will certainly need to understand how your flash works in detail.

    You will need a driver that can write raw to your flash, that is it needs to write to flash in the same way that your bootloader does.  As for the addresses, that is very device specific and are usually fixed addresses.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG

    Eurotech Inc.
    Tuesday, September 28, 2010 2:05 PM
  • Thanks Bruce,

    this is a Flash NAND memory for WinCE600R2.

    Where i can get hte Flash addresses? I started my BSP from the Freescale one and i didn't dig in deep.


    Tuesday, September 28, 2010 2:13 PM
  • Assume you are using MSFlash driver, update OS image is relative simple if the way it sores OS image meeting the following condition

    1. Run CE6
    2. create XIP partition type (type 22 and 23) and
    3. stored in raw format image (extracted or NK.NB0 format)

    And there is already another thread discussed about this

    Since bootloader is out of partition driver's management, so you need know the exactly sector (block) numbers.
    Once the block is determined, you can use IOCTL_FMD_RAW_WRITE_BLOCKS ( to access raw blocks directly.
    But be aware, some of the platforms may have more than one bootloader, and these bootlaoders may reside in the same block.

    • Marked as answer by SteMMo Friday, October 1, 2010 9:09 AM
    Tuesday, September 28, 2010 6:00 PM
  • Thanks,

    1. Yes, WinCE600R2

    2. I don't remember to have created any partition! I wrote the bootloader (eBoot) by ATK (Freescale) and then i wrote the OS image by the bootloader. I had not defined any partition, that's why i'm in a trouble to get the block numbers !!

    3. no problem: i have both nk.bin and nk.nb0

    If i need to call the DeviceIoCtrl (IOCTL_FMD_RAW_WRITE_BLOCKS ) then i need to open the flash driver with CreateFile( which? ): which name i can use to point that driver? I guess this is "DSK1:", read on the registry under


    Prefix = "DSK"



    Friday, October 1, 2010 9:27 AM
  • It can be DSK1: but it depends on the "Index" settings or the loaded sequence
    Another way is to use FindFirstStore and FindNextStore API to find out the Device Name.

    Friday, October 8, 2010 5:04 AM
  • Hi,

    In most cases I have seen, using a commercially available board, with a BSP & bootloader provided by the vendor, the scheme for having & maintaining OS-image(s) on the system is already figured out by the vendor.
    Usually some fail-safe method is used with 2 images in flash, where if updating one fails, your system is not crippled.
    In such a case, just writing the image is not enough, but you also need to "switch image" after the write succeeded.

    If such a scheme is in place, the vendor (BSP/bootloader provider) usually also has tooling that updates an image.
    In several cases I was able to get a tool from them including sourcecode, from which I could then build a commandline tool "Updater.exe" which would automatically update an OS-image. (the tool provided is often UI operated)

    I am just saying, donot re-invent the wheel if it's not neccessary.

    Kind regards,




    Friday, October 8, 2010 7:13 AM
  • Hi,

    I think I am one of these vendor developers. We already have a solution to update non XIP-Images. We use direct flash access to update image and it is working properly so far.

    It also works for XIP kernel images generally, but in this case we have the problem, that WindowsCE maybe needs to load some moduls dynamically from NANDIMAGE region. This leads into malfuntion. Unfortunatly we cannot establish two XIP partitions to "switch" between them due to hw restrictions (64MB flash only). Therefore we are currently looking for an alternative solution.

    Does someone have an idea how to resolve this situation? Any input would be appreciated.

    By unmounting the BINFS partition before overwriting the kernel image update programm at least can be finished with success. But after closing update programm system seems to hang. I suppose this also is caused when WinCE tries to access some modules within BINFS partition.

    Might the paging registry setting in BINFS resolve this situation?

    Tuesday, September 13, 2011 8:58 AM