Thursday, February 19, 2015

http://bbs.zoopda.com/forum.php?mod=viewthread&action=printable&tid=337089
http://forums.webosnation.com/archive/index.php?t-327706.html

How to program eMMC images into blank flash with USB only in MSM7630

Ready the files before start
1.Here is the list of files that need to be placed into a single directory before
 starting the programming process.
 amss.mbn          - Main AMSS binary
 dbl.mbn           - Device boot loader
 eNPRG7500.hex     - eMMCPRG HEX binary, rename from MPROG7x30.hex
 emmc_appsboot.mbn - Apps boot loader
 loadpt.cmm        - Used by MSP.exe
 msp.exe           - Mass Storage Porgrammer
 osbl.mbn          - OS boot loader
 partition.bin     - Partition table, used by msp.exe
 partition.mbn     - Dummy file to make QPST happy, copy of partition.bin file is fine
 system.img.ext3   - Linux system image file
 userdata.img.ext3 - Linux user partition
2. power on the Power on the phone with blank flash,The phone will go into emergency download mode, so connect the USB cable to the phone and QPST will detect it, there will have Q/QCP-XXX display in QPST configuration
3.  Enter software download menu
  3.1 Select "options", "settings"
  3.2 Use the dropdown menu to select "MSM7500 (NAND Flash)"
  3.3 Go into the "multi image" tab, select the image location using the "Browse" button.
  3.4 Make sure the emergency host download box the checked and the boot system is set  to "sec boot 2.0"
  3.5 Next, use the "Advanced" button to select the files(dbl.mbn, osbl.mbn) to download
   When all done, close the window and hit Start to start download and wait until the download
   process completes.The phone won't come back up in Diag mode, so you can either let QPST 
   Software Download time out, or you can hit the "Abort" button at this point to continue 
   the process. The phone should enumerate as a USB mass storage device, and you can verify
   this either in Windows Explorer or in Device Manager under "Disk Drives".
4. Program Raw Image files
   4.1 Open a CMD window and change to the image directory.
   4.2 Enter the following commands:
    msp -d
     This will list all of the block devices in the system. Look for the one that reflects, the size of the eMMC card being used (usually 4GB or 8GB) - this will indicate the device that is used for the phone. It should be /dev/sdc or something similar.
    msp -r /dev/sdc partition.bin 0 (use the appropriate device)
           msp -w /dev/sdc loadpt.cmm ./ (use the appropriate device)
      Wait for the programming process to complete. Unplug the USB cable and reconnect it so that Windows recognizes the new partition layout.
 
5. Copy FAT Files
   In Windows Explorer, locate the drive letter for the phone. It should show up as a "Removable Disk". Double-click on the drive letter and click "Yes"  to format the drive ("Quick format" is fine). Make a folder on that drive called "image" and copy amss.mbn, emmc_appsboot.mbn and boot.img into the directory.

6  Reboot the phone
   The phone should boot to the Android UI.
 
7.Mass Storage Download Example

Example flow for reference:

  C:\emmc\1100_finsmoke>msp -d
      '/dev/sdb' -- Not in use
      '/dev/sdc' -- device with size of 7840 MB
      '/dev/sdd' -- Not in use
      '/dev/sde' -- Not in use
      '/dev/sdf' -- Not in use
      '/dev/sdg' -- Not in use
      '/dev/sdh' -- Not in use
      '/dev/sdi' -- Not in use
      '/dev/sdj' -- Not in use
      '/dev/sdk' -- Not in use
    
  C:\emmc\1100_finsmoke>msp -r /dev/sdc partition.bin 0
      Total disk size 16056320 blocks
      Fill in the curr_sec: c9040
      Fill in the curr_sec: e8c80
      Fill in the curr_sec: f86c0
      Fill in the curr_sec: f9f00
      Fill in the curr_sec: fb740
      Fill in the curr_sec: fe680
      Fill in the curr_sec: ffec0
      Fill in the curr_sec: 101700
      lastlast_size: e4e900
      Before writing, stat:
      start_loc: 9, ext_first_sec: c9000
      Write 22be60 to 133700.
      Write 22bc60 to 1016c0.
      Write 22ba60 to ffe80.
      Write 22b860 to fe640.
      Write 22b660 to fb700.
      Write 22b460 to f9ec0.
      Write 22b260 to f8680.
      Write 22b060 to e8c40.
      Write 22ae60 to c9000.
      Reaching the last extended partition. Done.
  
  C:\emmc\1100_finsmoke>msp -w /dev/sdc loadpt.cmm ./
      Writing dbl.mbn, total size 159248
      Finished.
      Writing osbl.mbn, total size 710464
      Finished.
      Writing adsp.mbn, total size 5365072
      Finished.
      Writing system.img.ext3, total size 100999168
      Finished.
      Writing userdata.img.ext3, total size 81920000
      Finished.
"eMMC Partition tools usage for msm7x30/msm8x60"
(A repost from Anyclub...)

In the eMMC boot, there are some changes in eMMC partitioning.


Code:
partition.xml           - Everything begins with this file, which describes the number of 
                          partitions desired, and how many sectors each one should be.
PartitioningTool.py     - translates partition.xml into binary partitions
msp.exe                 - writes binary partitions to SD/eMMC cards using card reader
mjsdload.cmm            - writes binary partitions to SD/eMMC cards using Trace32
msp.py                  - writes binary partitions to a single image file
QPST                    - writes binary partitions to SD/eMMC cards on Target
Helper /Debug Tools:
Code:
parseBinaryPartitionFile.pl     - Decodes MBR partition tables. Run: 
                                  "Perl parseBinaryPartitionFile.pl partition.bin" 
                                  to generate the partition information
parseGPT.pl                     - Decodes GPT partition tables
partition.xml

These are the property entries that can be added in new partiton.xml to specify the configuration.
Code:
<parser_instructions>
  WRITE_PROTECT_BOUNDARY_IN_KB                = 0
  GROW_LAST_PARTITION_TO_FILL_DISK            = false
  ALIGN_ALL_LOGICAL_PARTITIONS_TO_WP_BOUNDARY = false
</parser_instructions>
WRITE_PROTECT_BOUNDARY_IN_KB: Typical boundaries are 64MB, i.e. 65536 KB. This
means that a 256MB eMMC card has 4 write protect boundaries. Any or all of
them can be marked as read-only. Different vendors allow for different sized
boundaries.

GROW_LAST_PARTITION_TO_FILL_DISK: In partition.xml the size of each partition
is specified. If this field is TRUE, then the last partition size is ignored
and set to 0. Then during patching this size is updated such that the last
partition extends to use all remaining space.

ALIGN_ALL_LOGICAL_PARTITIONS_TO_WP_BOUNDARY: To allow total flexibility, it
could be that a partition that is currently writeable might need to be marked
as read-only. This can only happen *if* that partition begins on a write
protect boundary (i.e. 64MB). Thus if this field is TRUE, then all logical
partitions are positioned such that they begin on a write protect boundary.


PartitioningTool.py

Is a new tool used to generate the the partition.xml
When run, it will output following 5 files:

1. emmc_lock_regions.xml

This hold the sector ranges that need to be marked as read-only by the
operating system (this is from readonly="true" in partition.xml) i.e. modem
code and boot images are typically on read-only partitions Typical
Write-Protect boundary is 64MB = 131072 sectors = 0x20000 sectors. The file
below is protecting the very first 64MB region of the card,

Boundary #0
Starting at sector 0
Ending at sector 131071 (for a total of 131072 sectors
)

code:
<?xml version="1.0" ?>
<protect>
  <!-- NOTE: This is an ** Autogenerated file ** -->
  <!-- NOTE: Sector size is 512bytes, WRITE_PROTECT_BOUNDARY_IN_KB=0,   WRITE_PROTECT_BOUNDARY_IN_SECTORS=0 -->
  <!-- NOTE: "num_sectors" in HEX "start_sector" in HEX, i.e. 10 really equals 16 !! -->
  <program boundary_num="0" num_boundaries_covered="1" 
       num_sectors="20000" num_sectors_dec="131072" physical_partition_number="0"  
       start_sector="0"    start_sector_dec="0"/>
  <information WRITE_PROTECT_BOUNDARY_IN_KB="0"/>
</protect>
 2. partition0.bin

This holds the partition tables, i.e. MBR followed by all EBRs. This is the
partition table in binary format. It is copied over to the storage device in a
1 to 1 manner. I.e. how it looks in partition0.bin is exactly how the
partition table will look on the storage device. partition0.bin is a "generic"
file meant to fit on *any* size SD/eMMC card, as a result, there are 0's that
need to be patched,such as EXT partition and last partition size.

3. patch0.xml

Contain the patching instructions to tailor each partition table
"partition0.bin" to a specific SD/eMMC card. I.e. the partition0.bin
partition tables can be applied to any size storage device As a result,
there are empty values (zeros) in the partition tables that must be filled
in with a specific cards sector size

There are two ways to apply this patch:
a) (patch before) When you patch the "zeros" in the partition tables held in the file partition0.bin, and then write it to the card
b) (patch after) When you write partition0.bin to the card (which still has "zeros" in it), and then patch the cards partition tables directly


4. rawprogram0.xml

precise sector details of all partitions and what files (if any) need to
be placed there. In addition to writing partition tables onto a device,
often times it is desired to write one or more files into the partition
area as well, The File has partition name (i.e. label), where it begins
(start_sector) and how big it is (num_partition_sectors). It also
describes what file(s) to write to this partition, as well as any
offsets.

Example:


Code:
<program file_sector_offset="0" filename="partition0.bin" label="MBR" 
       num_partition_sectors="1" physical_partition_number="0" 
       size_in_KB="0.5" start_sector="0"/>

<program file_sector_offset="1" filename="partition0.bin " label="EXT" 
       num_partition_sectors="2"  physical_partition_number="0" 
       size_in_KB="1.0" start_sector="779"/>
The 1st line describes taking the 1st sector from partition0.bin, and writing it to sector 0 of the card.
The 2nd line describes taking the 2nd and 3rd sector from partition0.bin and writing it to sector 779 of the card.
I.e. file_sector_offset = 2 and num_partition_sectors=2

5. loadpt.cmm

This is used by the mjsdload.cmm to flash the image.


msp.exe

This is used to apply the patches

This program will program a memory card (SD/eMMC) attached to the PC as USB mass storage device
Use -d to detect the path of the memory card if you are unsure what to do first

Commands list:

Code:
-h      (Print this help message)                                               Ex. msp -h
-d      (Detect which storage device ID is active)                              Ex. msp -d
-p      (Print partition information)                                           Ex. msp -p /dev/sdb
-pp     (Print partition information - DETAILED)                                Ex. msp -pp /dev/sdb
-x      (Write files as outlined in rawprogram.xml)                             Ex. msp -x rawprogram.xml /dev/sdb
-xx     (Write files as outlined in rawprogram.xml - DETAILED)                  Ex. msp -xx rawprogram.xml /dev/sdb
-s      (Write SINGLE IMAGE "singleimage.bin" as outlined in rawprogram.xml)    Ex. msp -s rawprogram.xml 8192
-v      (Verify file written correctly as outlined in rawprogram.xml)           Ex. msp -v rawprogram.xml boot.img /dev/sdb
-f      (Program single file as outlined in rawprogram.xml)                     Ex. msp -f rawprogram.xml boot.img /dev/sdb
To program the SD/eMMC with msp.exe in mass storage mode:

Code:
STEPS                           Complete example (patch after)
-------------------------------------------------------------
parse partition.xml             python PartitioningTool.py partition.xml 
Detect your device              msp -d
Program your device             msp -x rawprogram0.xml /dev/sdb
Patch your device               msp -xx patch0.xml /dev/sdb


STEPS                           Complete example (patch before)
-------------------------------------------------------------
parse partition.xml             python PartitioningTool.py partition.xml 
Detect your device              msp -d
Patch your files                msp xx  patch0.xml 15758336 (patch the 8GB card offline,this will change the partition0.bin)
Program your device             msp x   rawprogram0.xml /dev/sdb
The msp.py program can also used to patch the files.

For example:
python msp.py patch0.xml 15758336

This will patch the 8GB card offline, and change the partition0.bin.
 How to Install Microsoft .NET Framework 3.5 Offline in Windows 8 and Later without Internet Connection?
1.open Command Prompt as Administrator
Dism /online /enable-feature /featurename:NetFx3 /All /Source:F:\sources\sxs /LimitAccess

Friday, February 13, 2015


attrib -H -S /D /S
That will remove the hidden and system attributes from all the files/folders inside of your current directory.

attrib -r -s -h /S /D
this command will remove attrubutes for all files folders and subfolders:
-read only -system file -is hidden -Processes matching files and all subfolders. -Processes folders as well

just type
attrib -h -r -s /s /d j:*.*
where j is the drive letter... unlocks all the locked stuff in j drive
if u want to make it specific..then go to a specific location using cmd and then type
attrib -h -r -s /s /d "foldername"
it can also be used to lock drives or folders just alter "-" with "+"
attrib +h +r +s /s /d "foldername"

To launch command prompt in administrator mode
  1. Type cmd in Search and hold Crtl+Shift
  2. Type attrib -h -r -s /s /d "location of the drive letter:" \*.*

To make a batch file for its current directory and sub directories:
cd %~dp0
attrib -h -r -s /s /d /l *.*

For example folder named new under E: drive
type the command:
e:\cd new

e:\new\attrib *.* -s -h /s /d
and all the files and folders are un-hidden