Please remember to add a category to the bottom of each page that you create.
See categories help for further details, but most will probably be [[Category:HTC ModelName]].

Talk:Nvflash

From XDA-Developers
Jump to: navigation, search

Usage

The following usage information is issued by nvflash v1.5.66719. It's posted here in Talk, for reference, instead of in the main page because of unknown copyright status. It is posted here in the same spirit in which nvflash (from which this text is derived) is re-posted by the Androidroot.mobi crew.

--help
displays all supported nvflash commands with usage and description
--cmdhelp
command usage: nvflash --cmdhelp <cmd>
used to display usage and description about a particular command cmd
--resume
command usage: nvflash --resume --read <part id> <filename> --bl <bootloader> --go
must be first option in command line, used when device is looping in 3pserver which is achieved when a command of nvflash is executed either without sync or go or both, can be used with all nvflash commands
--create
command usage: nvflash --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --bl <bootloader> --go
used to do full initialization of the target device using the config file cfg start from creating all partitions, formatting them all, download images to their respective partitions and syncing bct at end
--setboot
command usage: nvflash --setboot N --bl <bootloader> --go
used to set partition N as bootable to already flashed device so that next time on coldboot, device will boot from bootloader at partition N
must be used only for bootloader partitions
--format_partition
command usage: nvflash --format_partition N --bl <bootloader> --go
used to format partition N in already flashed device making it empty
--verifypart
command usage: nvflash --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --verifypart N --bl <bootloader> --go
used to verify contents of partition N in device, hash is calculated and stored while downloading the data in partition and after all images are downloaded, content is read back from partition N calculating hash and matching it with stored hash, use N=-1 for verifying all partitions
must be used with --create command
--download
command usage:
  1. nvflash --download N <filename> --bl <bootloader> --go (in nvprod mode)
  2. nvflash --blob <blob> --setblhash <bct> --configfile <cfg> --download N <filename> --bl <bootloader> --go (in odm secure mode)
used to download filename in partition N into already flashed device
command 2 is used only for downloading the bootloader in secure mode, it gets encrypted bct from sbktool containing hash of updated bootloader to be downloaded. This bct is flashed to IRAM and update the system bct with new hash of updated bootloader. In all other cases command 1 is used Partition number N can be found from cfg file used for flash earlier
--read
command usage: nvflash --read N <filename> --bl <bootloader> --go
used to read partition N from already flashed device into filename
Partition number N can be found from configuration file used while flash
--rawdevicewrite
command usage: nvflash --rawdevicewrite S N <filename> --bl <bootloader> --go
used to write filename into N sectors of media starting from sector S to already flashed device
--rawdeviceread
command usage: nvflash --rawdeviceread S N <filename> --bl <bootloader> --go
used to read N sectors of media starting from sector S from already flashed device into filename
--getpartitiontable
command usage: nvflash --getpartitiontable <filename> --bl <bootloader> --go
used to read partition table in text from already flashed device into filename
--updatebct
command usage: nvflash --bct <bct> --updatebct <bctsection> --bl <bootloader> --go
used to update some section of system bct(bctsection) from bct specified
this command is run in 3pserver. As of now, bctsection can be SDRAM which updates SdramParams and NumSdramSets field of bct, DEVPARAM updates DevParams, DevType and NumParamSets fields and BOOTDEVINFO updates BlockSizeLog2, PageSizeLog2 and PartitionSize fields of system bct
--setblhash
command usage: nvflash --blob <blob> --setblhash <bct> --configfile <cfg> --download N <filename> --bl <bootloader> --go (in odm secure mode)
used to download bootloader in secure mode into already flashed device
it updates the hash value of updated bootloader to be downloaded, from encrypted bct got from sbktool, into system bct in miniloader
--setbct
command usage: as in full fledged nvflash command
used to download bct to IRAM, must be used with --sync command to update it in mass storage.
--getbct
command usage: nvflash --bct <filename> --getbct --bl <bootloader> --go
used to read back the BCT from already flashed device to user specified filename, read in clear form whether device is secure or non-secure
--getbit
command usage: nvflash --getbit <filename> --bl <bootloader> --go
used to read back the bit table to filename in binary form in miniloader
--dumpbit
command usage: nvflash --dumpbit --bl <bootloader> --go
used to display the bit table read from device in text form on user terminal. Also gives info about bct and various bootloaders present in media, normally used for debugging cold boot failures
--odm
command usage: nvflash --odm CMD data --bl <bootloader> --go
used to do some special diagnostics like sdram validation, fuelgauge etc.
each CMD has data associated with it
--go
command usage: as in full fledged nvflash command
used to boot bootloader after nvflash completes instead of looping in 3pserver in resume mode, however sync command is also required to get out of resume mode, can be used with all nvflash commands
--obliterate
command usage: nvflash --configfile <cfg> --obliterate --bl <bootloader> --go
used to erase all partitions and bad blocks in already flashed device using partition info from configuration file cfg used in nvflash earlier
--configfile
command usage: as in full fledged nvflash command
used to specify configuration file containing info about various partitions to be made into device, their sizes, name and other attributes
--bct
command usage: as in full fledged nvflash command
used to specify bct file containing device specific parametrs like SDRAM configs, boot device configs etc. This is again modified by device to include info about bootloader, partition table etc.
--blob
command usage: nvflash --blob <blob> --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --bl <bootloader> --go
used for nvflash in odm secure devices, can be used with any nvflash commands
blob contains encrypted and signed RCM messages for communication b/w nvflash and bootrom at start, encrypted hash of encrypted bootloader (used with --bl option) for it's validation by miniloader and nvsbktool version info
--bl
command usage: as in full fledged nvflash command
used to specify bootloader which will run 3pserver on device side after it is downloaded by miniloader in SDRAM, normally used with all commands
--odmdata
command usage: as in full fledged nvflash command
specifies a 32-bit integer used to select particular instance of UART
determine SDRAM size to be used etc. Also used for some platform specific operations, it is stored in bct by miniloader
--deviceid
command usage: nvflash --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --deviceid <devid> --transport <transport_mode> --bl <bootloader> --go
used to set the device id of target in fpga emulation or simulation mode
depending on chip, can be hex or dec, only used with --transport option
--transport
command usage: nvflash --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --deviceid <devid> --transport <transport_mode> --bl <bootloader> --go
used to specify the means of communication between host and target
USB, JTAG and Simulation are three modes supported as of now. JTAG is for fpga emulation, Simulation is for nvflash in simulation mode and default is USB, used in normal cases while interaction with device
--devparams
command usage: nvflash --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --deviceid <devid> --transport <transport_mode> --devparams <pagesize> <blocksize> <totalblocks> --bl <bootloader> --go
used to pass logical pagesize, erase block unit size and total number of blocks for nvflash in simulation mode. As of this write, pagesize = 4K, blocksize = 2M, and totalblocks = media_size/blocksize. These values can be obtained using NvDdkBlockDevGetDeviceInfo API, a wrapper of SdGetDeviceInfo API in block driver, used only for nvflash in simulation mode
--setbootdevtype
command usage: nvflash --setbootdevtype S --bl <bootloader> --go
used to set boot device type fuse to S which tells boot media to boot from
used only in miniloader since cold boot uses bootrom and all settings get reset at that time. Unlike miniloader, BL/kernel uses pinmuxes not fuses
S can be emmc, nand_x8, spi etc.
--setbootdevconfig
command usage: nvflash --setbootdevconfig N --bl <bootloader> --go
used to set boot device config fuse to N which tells slot of boot device to boot from, used only in miniloader since cold boot uses bootrom and all settings get reset at that time. BL/kernel uses pinmuxes not fuses
N is 33 for sdmmc4 pop slot and 17 for sdmmc4 planar slot of whistler
--diskimgopt
command usage: nvflash --bct <bct> --setbct --configfile <cfg> --create --diskimgopt <N> --odmdata <N> --bl <bootloader> --go
used to convert .dio or a .store.bin file to the new format (dio2) by inserting the required compaction blocks of size N, can be used with any nvflash commands which downloads an image to device
--quiet
command usage: nvflash --quiet --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --bl <bootloader> --go
used to suppress the exccessive console output like status info while send or recieve data b/w host and device, can be used with all nvflash commands
--wait
command usage: nvflash --wait --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --bl <bootloader> --go
used to wait for USB cable connection before start executing any command
can be used with any commands of nvflash
--format_all
command usage: nvflash --delete_all/--format_all --bl <bootloader> --go
used to format/delete all existing partitions on already flashed device