Showing posts with label qpst. Show all posts
Showing posts with label qpst. Show all posts

6/22/2012

How OEM can set own PID for dload mode in qualcomm msm7x27/7x30?

Many OEM wants to use their own download tool rather than QPST, and does not want to show Qualcomm PID to Host PC in download mode.



In AMSS mode, the way to change PID, VID is in solution # 5814(How to change vid, pid and some string in descriptor)

Here is the simple way to set OEM PID in dload mode.



So, what OEM can do is calling hsu_al_dload_init_ex() function with setting boolean variable, use_amss_product_id as false, which means using different product ID compared to the one in AMSS code. This hsu_al_dload_init_ex() function calls hsu_al_dload_armprog_start_stack_ex(), and checking the boolean variable, and assign PID to HSU_PRODUCT_ID_NON_AMSS which is defined in hsu_conf_sel_comp_utils.h file


Here is the code change that you can do.

1. Modify hsu_al_dload.c file like this:
From:
void hsu_al_dload_init(void)
{
hsu_al_dload_init_ex(TRUE);
}
To:
void hsu_al_dload_init(void)
{
hsu_al_dload_init_ex(FALSE);
}

2. Modify hsu_conf_sel_comp_utils.h file:
From:
/*
* A product ID used for download into RAM in the U2 target.
* This is intended to ensure that the device gets a different
* port number when performing download into RAM than when running
* AMSS.
* This product ID always uses the single interface configuration.
*/
#define HSU_PRODUCT_ID_NON_AMSS 0x9008

To
#define HSU_PRODUCT_ID_NON_AMSS 0x1234 //Customer defined PID.

Connecting QPST over uart1dm in qualcomm android code

IN order to connect QPST over uart1dm please make the following changes


make the following changes.

1) in \build\cust\custsio.h
comment out
//#define RDM_USB_SER1_INIT_SRVC RDM_DIAG_SRVC
and add
#define RDM_UART1_INIT_SRVC RDM_DIAG_SRVC

2) in drivers\sio\rdevmap.c
add UART1DM_BM to diag compatible ports.
rdm_srv_dev_compat_tab[RDM_DIAG_SRVC] = (RDM_NULL_DEV_BM
#ifndef FEATURE_BT_SOC_UART_TL
| RDM_UART1_BM

5/10/2012

How do I generate the mibib.mbn image


Some targets and software releases do not have the feature for generating the MIBIB.MBN file which is used with QFIT to create a Factory Image. You can use the method below to merge in the build\ms files inorder to create the mibib.mbn
In dmss_rules.min 



jnand_exe: 
ifeq ($(IMAGE), MODEM_PROC) 
@echo ------------------------------------------------------------------------ 
@echo Building mjnand.exe 
@$(BUILD_JNAND_EXE_CMD) 
@echo ------------------------------------------------------------------------ 
endif 


genmibib: 
@echo ------------------------------------------------------------------------ 
@echo Building mibib.mbn 
@pwd 
$(BUILD_MIBIB_CMD) 
@echo ------------------------------------------------------------------------ 




In armtools.min 


.. 
BUILD_JNAND_EXE_CMD= $(MAKE) -C $(JNAND) -f jnand.mak CUSTNAME=$(BUILD) genexe 
.. 


ifeq ($(IMAGE), APPS_PROC) 
MIBIB_DEST_PATH = $(WM_MBNPATH) 
else 
MIBIB_DEST_PATH = ../../build/ms/$(MBNPATH) 
endif 


BUILD_MIBIB_CMD = $(JNAND)/mjnand.exe -fp $(NAND_PAGE_SIZE) -fb $(NAND_BLK_SIZE) -fd $(NAND_DEVICE_SIZE) \ 
-u partition.mbn -q qcsblhd_cfgdata.mbn -ah amsshd.mbn -m mibib.mbn -oh oemsblhd.mbn \ 
-wh appshd.mbn -bh appsboothd.mbn -p $(MIBIB_DEST_PATH)

QPST-Software Download to the SD card


Loading the hex image to an SD card
Loading the hex image to an SD card can be done with newer devices that use a mass storage chip like eMMC or SD card in place of NOR or NAND flash. If you use QPST 2.7.368 and newer we released new MPRG7x30.hex files.  However, these files have not been picked up in a lot of the builds yet. 




Getting error 852 while trying to load the image to the card
Error 852 means: "Could not open downloader in eMMC USER mode".  Basically this means your flash programmer (PRG7x30_SDC4.hex) doesn't support the new way (USER mode) of writing the boot loader (7x30_msimage.mbn) to the SD device.  


If you are getting this error instead of the string it means you are still using a version of QPST prior to 2.7.368 so you should be okay using MPRG7x30.hex from your build.




Loading the image on the SD card on a SURF
From what we know, the SD slot on SURFs is not properly wired to power up on reset so you cannot use SDC4 on SURF. If you have a blue wired FFA or Fluid then you can use uSD (micro SD) card and use MPRG7x30_SDC4.hex. For SURF you should always use eMMC plugged in SDC2 or wee card plugged in just above SDC2 slot. For that you need to use MPRG7x30.hex instead of MPRG7x30_SDC4.hex.




Including the QCN with the binary image created by the eMMC Software Download agent
The QCN file is never copied to a phone.  The file is just a container for NV items for Qualcomm PC-based applications. The QCN file contains NV items (which become item files on the target device) and item files.


We have no tools to alter a eMMC factory image.  When creating an eMMC factory image you would have to create file system partitions (FAT, ext3, or any other format) and find a way to populate these partitions with files that have the values and names of the NV items.

QPST-Emergency Download Support

What is this feature?
The QPST Software Download app shows an option called "Use Emerg. Host D/L". This option was introduced in QPST 2.7.335 and higher. When enabled, it makes QPST look for a flash programmer named eNPRGxxxx.hex. If that file isn't present in the AMSS build then the download will fail. The only implementation in QPST for the Emergency Boot Loader is to prefix an "e" to the flash programmer name if the user selects "Use Emerg. Host D/L".  See document 80-VP758-1 (Emergency Download Feature).

Once the flash has been altered, you may have damaged any recovery code that is part of the AMSS image. To get around this, the emergency downloader is actually part of the MSM itself, resident in a ROM along with the primary boot loader (PBL). It can't be overwritten. This should even allow you to enter download mode if you have a blank flash. The secure boot architecture has validation code that checks the digital signature of the next block of code. If it doesn't match (either because of a corrupted, hacked, or blank image) it would activate the emergency downloader.At this stage, using QPST's Emergency Download option couldbe selected and the ehostdl binary could be downloaded to the IMEM. This wouldfacilitate the download of entire AMSS image through the ehostdl downloadmechanism. Ifthere is any error seen in accessing flash or any error seen in PBL, then thephone would go to download mode in PBL. Hence the entire boot, AMSS images canbe re-flashed or downloaded using this emergency download feature.


Some targets, such as the 8650 or M9k based ones, do not support the "Emergency Download" through USB, even though the USB function is supported. The selection of USB or UART for Emergency Download has already been made in the Boot ROM of the chip, and cannot be changed without a new chip revision. All chips released in 2009 and beyond will support USB.



Which targets support this feature?
Please refer to 80-VJ116-1 (Secure Boot 2.0 Architecture) to see which targets support emergency download ePRGxxx.hex using which serial interface (UART2, UART1, HS-USB) for those targets which uses Secure Boot 2.0. 
  • QSC6195 using HS-USB
  • QSC6295 using HS-USB
  • QSC6240 using UART2 at 115 kbps.
  • QSC6270 using UART2 at 115 kbps.
  • MSM6246 using UART2. (Tested on SURF only)
  • MSM6290 using UART2. (Tested on SURF only)
  • MSM7x30 using HS-USB.
  • MDM8200 (No eNPRFxxx.hex as of 1/16/2009)
  • MDM8900 (No eNPRFxxx.hex as of 1/16/2009)
  • FRB has recently (1/2009) approved supporting it on QSD8650 using UART1.
  • FRB has recently (1/2009) approved supporting it on QSD8250 using UART1.
  • All others need JTAG recovery.

Secure Boot 2.0 Architecture is supported on the following targets:
  • QSC6195™
  • QSC6240™
  • QSC6246™
  • QSC6270™
  • QSC6295™
  • QSC1100™
  • MSM7x30
  • MDM8200™/MDM8900™
  • QSD8250™/QSD8650™
  • All future chipsets will have it as default boot mechanism
Emergency download mode in PBL is supported on the following targets:
  • MSM6246™ (UART2)
  • MSM6290™ (UART2)
  • QSC6195™ (HS-USB)
  • QSC6295™ (HS-USB)
  • QSC6240™ (UART2)
  • QSC6270™ (UART2)
  • QSC7x30 (HS-USB)
  • MDM8200™/MDM8900™ (No eNPRGxxx.hex at this point 01/16/09)
  • QSD8650™ (UART1)


What about targets that support Secure Boot 1.0?
MSM6290 uses Secure boot 1.0 and is not covered by 80-VJ116-1 (Secure Boot 2.0 Architecture). We do not have any other document listing all the targets supporting emergency download. However, the MSM6290 also supports ePRGxxx.hex.


How does a customer implement this feature in their PST like tool?
The only implementation in QPST for the Emergency Boot Loader is to prefix an "e" to the flash programmer name if the user selects "Use Emerg. Host D/L".

The emergency downloader has to be created by the AMSS build.


Automating the emergency download feature
Starting with QPST version 2.7.362 there will be an example of how to automate this feature.  The example Perl script is "swdl_DownloadBySettings.pl".

We have support for blank flash programming of partition 0 using rawprogram0.xml and patch0.xml.  We don't have support for meta builds or other partitions at this time. The download support is independent of the device (MSM8960), but is dependent on the flash programmer that is built during the AMSS build process for a device.


The emergency download a second time on the same device.
You cannot use this feature twice consecutevly on one device.  This feature is for use with blank flash when the device is running in the PBL.  Once the eNPRGxxx.hex file was loaded once, you need to use the normal download mode (uncheck 'use emerg...' box).


Secure Boot 3.0 support
Secure Boot 3.0 is only supported by eMMC flash devices and not used on NAND flash. For eMMC the download is controlled by the XML document produced by the AMSS build. In this case the images used by SB 3.0 are just loaded into partitions on the eMMC device like other AMSS images.

You need to use emmcswdownload.exe to download to devices that use eMMC flash devices. However the current version of QPST does not completely support the 8660 eMMC device.

There is no automation support for Secure Boot 3.0 via the QPST automation interface.  The "swdl_DownloadBySettings.pl" script does not support Secure Boot 3.0 therefore it will not work with devices that have this type of boot.


Document error on element type "root" and name/value"<image> tag no longer supported" error
This type of programming, using partition.xml, is no longer supported. Start with version 2.7.370 and going forward, QPST only supports rawprogram0.xml format. You will have to modify your build process to create the new XML file.

If you still cannot load the rawprogram0.xml file, verify there are no lines that have sparse="true" value.  Sparse file format is not supported by QPST. You either have to convert the file to a non-sparse format or skip these items entirely.

Please note that in our builds we do not arbitrarily create this sparse tag. The sparse tag is needed because Android targets use "sparse" files that are meant to be loaded via fastboot.  In a nutshell the sparse tag saves you from accidentally loading a "sparse" file that fastboot needs to uncompress first.