Custom board - First time flash with QFIL (no SD)

Hello,

I am building my custom board based on Linaro linux 17.06.1 without SD card.
To flash the firmware the first time, I plan to use QFIL tool. This tool requires programmer path and XML build file. I am not sure what those files are. Should I use the bootloader_emmc_linux bootloader files given here? What about the XML file?

Thanks in advance for any help,

Hello,

My question is still open.
Specifically, flashing with QFIL tool requires files such as “prog_emmc_firehose_8x16.mbn” and other XML files. Should I get those from Qualcomm or can I use the bootloader files given on Linaro website (if so, how?)

Thank you for any help

the latest bootloader release from QCOM now includes the firehose programmer, you should be able to use it.

but we are not releasing the XML files yet. We are planning to add them soon, so that DB410c can be recovered with USB flashing tool, but for now you need to get them from QCOM or your board vendor.

Thank you @anon91830841. I am still in need of the XML files; no update on this?

hi,

still not available… it will be done, but it’s not in the high priority bucket , so it keeps being pushed back… sorry about that.

Hello @anon91830841,
Thank you for your answers,

Could you please correct me if I’m wrong:
To obtain the firehose programmer, I downloaded the QCOM bootloader at git://codeaurora.org/kernel/lk.git; then I compile it (as described there: https://developer.qualcomm.com/download/db410c/little-kernel-boot-loader-overview.pdf) and the resulting emmc_appsboot.mbn is the firehose programmer? If not, where exactly can I find it?

For the XML I asked QCOM and am still waiting to get it.

Thank you

hi,

no. this programmer file is included in the QCOM proprietary release that we publish here:

http://builds.96boards.org/releases/dragonboard410c/qualcomm/firmware/linux-board-support-package-r1032.1.1.zip

And the file is prog_emmc_firehose_8916.mbn

cheers.

Hello @anon91830841,

I want to flash the processor with QFIL (USB);
I noticed that “rawprogram.xml” is available here, thank you for that.

I have a problem when flashing the rawprogram.xml with QFIL: it tells me "XML is not formatted correctly. Could not find closing />

I suspect that this could be due to the variable NUM_DISK_SECTORS in the XML.
For information, I use a custom board with 4GB emmc.

Thank you very much for your help,

Regards

Maybe a more specific question is: the rawprogram.xml given requires bootloader files and boot.img as well.
What is the bootloader version that I am supposed to use ?

As it requires files such as “sec.dat”, “sbc_1.0_8016.bin”, “gpt_backup0.bin”, … and all of these files are not present in the latest bootloader version.

Thank you,

hi,

can you please try the emmc bootloader package from http://snapshots.linaro.org/96boards/dragonboard410c/linaro/rescue/99/

We added the xml files there. You should be able to run qdl after unzipping it.

You can ignore the missing files (boot.img, sec.dat, … )

@Vix Maybe this is also useful to you… I managed to flash a Dragonboard 410c with the contents of dragonboard-410c-bootloader-emmc-linux-99.zip. Console log and used commands are here.

@anon91830841 However, the subsequent boot from emmc stops at

B -    502609 - Error code 3039 at boot_elf_loader.c Line 1432

Full boot log is here, I would have expected to get at least some output from LK. Am I missing something?

PS: Sorry for cross-posting to IRC. Found this thread right after posting there.

hmm. it becomes interesting… have you kept the QDL tool log when you ran it? is it reproducible?

Yes, I have tried it several times now, always looks the same.
Log from qdl: https://gist.github.com/jakob-tsd/a8ac6dba6fe5f1d1123d84409b63884b

ok, thanks. and if you ‘rescue’ with SD card and flashall, does it work?

i tested #99 when it was released, and it worked for me. we really need to fix this issue. i am traveling this week, and cannot test right now… but definitely need to look into that…

Just tested, with the rescue sd card + flashall I get a working LK

[...PBL...]
Android Bootloader - UART_DM Initialized!!!
[0] [0] BUILD_VERSION=dragonboard410c-LA_BR_1_2_7-03810-8x16_0-linaro2
[0] [0] BUILD_DATE=19:02:28 - Apr 18 2018
[0] [0] welcome to lk
[...]
[850] [850] fastboot: processing commands

Edit: Just to be clear, the output above is booted from the emmc (with the sd card removed)

@jakob-tsd Thank you for your help. I come up with the same problem as you
B - 406351 - Error code 3039 at boot_elf_loader.c Line 1432

Will see if I can solve this

have you signed LK image ?
seems your LK image not properly signed ,please check the release notes for more information
https://developer.qualcomm.com/download/db410c/linux-embedded-release-notes.pdf .

Please do not discuss about Qualcomm proprietary tools like QFIL in the forum .

the LK images we released are signed, so it is likely not the problem.

I checked the content of the package, and it looks like we might have released a wrong rawprogram.xml file… i cannot really explain how it happened… but when i rebuild this file it is slightly different. the difference in rawprogram.xml can explain the problem you are seeing…

can you please update your rawprogram.xml file and apply this change:

diff --git a/dragonboard410c/linux/rawprogram.xml b/dragonboard410c/linux/rawprogram.xml
index 7ad6fd2..f301c52 100644
--- a/dragonboard410c/linux/rawprogram.xml
+++ b/dragonboard410c/linux/rawprogram.xml
@@ -3,9 +3,9 @@
   <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="rpm.mbn" label="rpm" num_partition_sectors="1024" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="512.0" sparse="false" start_byte_hex="0x8080000" start_sector="26316>
   <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="tz.mbn" label="tz" num_partition_sectors="2048" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="1024.0" sparse="false" start_byte_hex="0x8100000" start_sector="264192>
   <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="hyp.mbn" label="hyp" num_partition_sectors="1024" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="512.0" sparse="false" start_byte_hex="0x8200000" start_sector="26624>
-  <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="sec.dat" label="sec" num_partition_sectors="32" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="16.0" sparse="false" start_byte_hex="0xc000000" start_sector="393216" >
-  <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="emmc_appsboot.mbn" label="aboot" num_partition_sectors="2048" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="1024.0" sparse="false" start_byte_hex="0xc004000" start_>
-  <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="boot.img" label="boot" num_partition_sectors="131072" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="65536.0" sparse="false" start_byte_hex="0xc104000" start_sector=>
+  <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="sec.dat" label="sec" num_partition_sectors="32" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="16.0" sparse="false" start_byte_hex="0x8280000" start_sector="267264" >
+  <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="emmc_appsboot.mbn" label="aboot" num_partition_sectors="2048" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="1024.0" sparse="false" start_byte_hex="0x8284000" start_>
+  <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="boot.img" label="boot" num_partition_sectors="131072" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="65536.0" sparse="false" start_byte_hex="0x8384000" start_sector=>
   <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="gpt_main0.bin" label="PrimaryGPT" num_partition_sectors="34" partofsingleimage="true" physical_partition_number="0" readbackverify="false" size_in_KB="17.0" sparse="false" start_byte_hex="0x0" start_sector="0">
   <program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="gpt_backup0.bin" label="BackupGPT" num_partition_sectors="33" partofsingleimage="true" physical_partition_number="0" readbackverify="false" size_in_KB="16.5" sparse="false" start_byte_hex="(512*NUM_DISK_SECTOR>
 </data>

Basically it’s the “start_sector” filed for 3 partitions which is wrong in the file we released… if you confirm it’s working with this change, i can spin off a new build with this fix…

Hello,

I applied your patch but unfortunately the error at boot is still there (exactly the same as before)
Error code 3039 at boot_elf_loader.c Line 1432

@anon91830841 It looks like the patch is truncated on the right and the new start_sector values have been cropped off because the lines were too long. If this is a Discourse limitation, can you maybe post it as an attachment?

...alse" start_byte_hex="0x8080000" start_sector="26316>
...lse" start_byte_hex="0x8100000" start_sector="264192>
...alse" start_byte_hex="0x8200000" start_sector="26624>
...e" start_byte_hex="0xc000000" start_sector="393216" >
....0" sparse="false" start_byte_hex="0xc004000" start_>
...rse="false" start_byte_hex="0xc104000" start_sector=>
...e" start_byte_hex="0x8280000" start_sector="267264" >
....0" sparse="false" start_byte_hex="0x8284000" start_>
...rse="false" start_byte_hex="0x8384000" start_sector=>
...sparse="false" start_byte_hex="0x0" start_sector="0">
... sparse="false" start_byte_hex="(512*NUM_DISK_SECTOR>