EM-X270: WinCE: Updater

From Compulab Mediawiki
Jump to: navigation, search

Introduction

The EM-X270 Updater Framework is based on general CompuLab Updater framework for Windows CE.

Updater Customization for EM-X270

Target Media Layout

The EM-X270 target media is composed from 1Mb NOR flash and 512Mb NAND flash.
The EM-X270 NOR flash includes:

  • U-Boot (hardware bootstrap)
  • U-Boot environment
  • Eboot (WinCE bootloader)
  • Splashscreen

The EM-X270 NAND Flash includes:

  • Eboot parameters (1 NAND block)
  • MBR
  • BINFS partition (for NK.bin)
  • TFAT partition for user data storage

Updater Flow

The EM-X270 Updater installation flow is slightly different from the generic Updater flow. The Updater application updates the NAND flash media only. The NOR flash media is updated by U-Boot script prior to Updater invocation. The EM-X270 Updater flow is summarized below:

  • Primary U-Boot update script is invoked by pressing and holding Sleep/Resume button immediately after the reset.
  • The primary U-Boot update script invokes WinCE NOR flash update script (update.img) from USB LiveDisk
  • The WinCE NOR flash update script performs the following actions:
    • Program Eboot
    • Program splashscreen
    • Update U-Boot environment variables required for WinCE auto-boot
    • Boot of Updater OS
  • On Updater OS boot completion the Updater application is automatically started
  • The Update application performs the following actions:
    • Reserve 1 NAND block for Eboot parameters
    • Erase existing partitions
    • Create MBR
    • Create BINFS partition for NK.bin storage
    • Create user data partition
    • Format user data partition with TFAT
    • Store NK.bin file into BINFS partition
    • Update Eboot parameters required for proper NK.bin boot

EM-X270 WinCE NOR Update Script

if usb start; then

   if fatload usb 0:1 a0010000 eboot.nb0; then
      echo ===== Update eboot.nb0 =====
      cp.b 70000 a0050000 1000
      protect off 70000 +40000
      erase 70000 +40000
      cp.b a0050000 70000 1000
      cp.b a0010000 71000 3f000
   fi

   if fatload usb 0:1 a0010000 splashscreen.bmp; then
      echo ===== Update splashscreen =====
      protect off b0000 +50000
      erase b0000 +50000
      cp.b a0010000 b0000 50000
   fi

   echo ===== Update Enviroment Variables =====
   setenv bootdelay 1
   setenv boot_mode wince
   setenv nand_mode off

   setenv boot_wince "cp.b 71000 a7e00000 3f000; go a7e00000"
   saveenv

   if fatload usb 0:1 a0001000 nk_updater.nb0; then
      echo ===== Launch WincCE Updater =====
      go a0002000
   fi
fi
usb stop

EM-X270 Generic Updater XML Script

<updater version="1.0">
 <source_storage>
   <access_information>
     <device_type>USB</device_type>
     <device_name>DSK2:</device_name>
     <mount_path>\Hard Disk</mount_path>
   </access_information>
   <logger_information>
     <updater_logger>
       <file_name>updater_log.txt</file_name>
       <append_log>false</append_log>
       <verbosity>debug</verbosity>       
     </updater_logger>
     <system_logger>
       <file_name>system_log.txt</file_name>
       <append_log>false</append_log>
     </system_logger>     
   </logger_information>
 </source_storage>

<target_storage>
  <device id="nand0">
    <config type="nand" chipid="0" sectorsize="0x800" blocksize="0x20000" length="detected"></config>
    <region id="boot_region">
      <config type="boot" start="0x0" alignment="blocksize"></config>
      <entity id="eboot_config">
        <config type ="raw" offset="0x0000" length="blocksize" alignment="blocksize"></config>        
	  </entity>     	  
    </region>
    <region id="os_region">
	    <config type="os" alignment="blocksize"></config>
        <source file="os_region.nb0" format="raw"></source>
      <entity  id="os_partition_table">
        <config type="partition_table"></config>
      </entity>
	    <entity id="partition_binfs">
        <config type="partition" name="binfs"  length="auto" reserve="10%" alignment="sectorsize"></config>
        <source file="nk.bin" format="bin"></source>
      </entity>
      <entity id="partition_system">
        <config type="partition" name="system" alignment="sectorsize"></config>        
      </entity>
    </region>
    <!-- Compensate for the bad blocks variance among differnt NAND chips -->
    <region id="reserve_region">
      <config type="reserve" length="blocksize" replication="10" alignment="blocksize"></config>
    </region>
  </device>
</target_storage>

<actions>  
  <action type="reserve">
    <target id="reserve_region" alignment="blocksize"></target>
    <params oem_attribute="reserved_readonly"></params>
  </action>    
  <action type="reserve">
    <target id="eboot_config" alignment="blocksize"></target>
    <params oem_attribute="reserved_readonly"></params>
  </action>        
  <action type="erase">
    <target id="os_region"></target>
  </action>  
  <action type="partition_create">
    <target id="partition_binfs"></target>
    <params part_type="binfs" part_active="true"></params>
  </action>
  <action type="partition_create">
    <target id="partition_system"></target>
    <params part_type="dos32_fat" part_active="false"></params>
  </action>
  <action type="partition_format">
    <target id="partition_system"></target>
  </action>    
  <action type="store" subtype="raw">
    <target id="partition_binfs"></target>
  </action>  
  <action type="update_parameter" subtype="offset">
    <target id="eboot_config"></target>
	<params param_offset="0" param_length="4" param_value="0xabcdef01" param_type="number"></params>
	<params param_offset="4" param_length="4" param_value="kernel_start" param_type="reserved" image_entity="partition_binfs"></params>
	<params param_offset="8" param_length="4" param_value="image_start" param_type="reserved" image_entity="partition_binfs"></params>
	<params param_offset="12" param_length="4" param_value="kernel_length" param_type="reserved" image_entity="partition_binfs"></params>
  </action>  
  <action type="reset" subtype="cold"></action>   
</actions> 
</updater>

See Also