linux-msm / qdl

BSD 3-Clause "New" or "Revised" License
225 stars 79 forks source link

Extend to support the "kickstart" flow #36

Closed quic-jhugo closed 1 year ago

quic-jhugo commented 1 year ago

QDL implements the sahara protocol which is a core piece of the "kickstart" flow. Kickstart typically doesn't use USB, nor will it use firehose, so the qdl application isn't quite what the kickstart flow needs. Qualcomm Cloud AI 100 is one such device that uses the kickstart flow and would benefit from this support.

bmx666 commented 1 year ago

this PR breaks old way of using QDL

qdl prod_firehose_ddr.elf ... Can not open (null) ...

quic-jhugo commented 1 year ago

I don't see how, but clearly you are having an issue. Can you provide any additional information? What hardware are you using? Where is firehose coming from? Have you done any debugging?

bmx666 commented 1 year ago

Hi @quic-jhugo

I'm using QDL, QFIL and QPST to flash QCS605, SA8165P and SA8195P Qualcomm boards. All used images like prod_firehose_lite.elf and prod_firehose_ddr.elf are building from QCOM sources.

You mention about "no USB" and usage of socket /dev/mhi0_QAIC_SAHARA, but that is too specific for Qualcomm Cloud AI 100 only. In my case I have no any sockets like /dev/mhi0_QAIC_SAHARA

quic-jhugo commented 1 year ago

@bmx666 Can you post the exact qdl command you are using? Is the only output you get "Can not open (null) "? I'm unable to replicate any kind of issue with the qdl binary. The comments on no usb and /dev/sahara only apply to kickstart, which is not applicable to you as I understand it.

bmx666 commented 1 year ago

@quic-jhugo

nothing special in QDL commands

qdl --debug --storage ufs \
    --include /path/to/images/ \
    /path/to/images/prog_firehose_ddr.mbn \
    /path/to/images/rawprogram_unsparse0.xml \
    /path/to/images/patch0.xml \
    /path/to/images/rawprogram1.xml \
    /path/to/images/patch1.xml \
    ...

qdl --debug --storage emmc \
    --include /path/to/images/ \
    /path/to/images/prog_firehose_ddr.mbn \
    /path/to/images/rawprogram0.xml \
    /path/to/images/patch0.xml

I will add output with PR and without PR tomorrow

bmx666 commented 1 year ago

Hi @quic-jhugo

Output with this PR

HELLO version: 0x2 compatible: 0x1 max_len: 1024 mode: 0
READ64 image: 13 offset: 0x0 length: 0x40
Can not open (null): Bad address
END OF IMAGE image: 13 status: 8
received non-successful result

Output without this PR

HELLO version: 0x2 compatible: 0x1 max_len: 1024 mode: 0
READ64 image: 13 offset: 0x0 length: 0x40
READ64 image: 13 offset: 0x40 length: 0x380
READ64 image: 13 offset: 0x1000 length: 0x1000
READ64 image: 13 offset: 0x2000 length: 0xca8
READ64 image: 13 offset: 0x3000 length: 0x1000
READ64 image: 13 offset: 0x4000 length: 0x1000
READ64 image: 13 offset: 0x5000 length: 0x1000
READ64 image: 13 offset: 0x6000 length: 0x1000
READ64 image: 13 offset: 0x7000 length: 0x1000
READ64 image: 13 offset: 0x8000 length: 0x1000
READ64 image: 13 offset: 0x9000 length: 0x1000
READ64 image: 13 offset: 0xa000 length: 0x1000
READ64 image: 13 offset: 0xb000 length: 0x1000
READ64 image: 13 offset: 0xc000 length: 0x1000
READ64 image: 13 offset: 0xd000 length: 0x1000
READ64 image: 13 offset: 0xe000 length: 0x1000
READ64 image: 13 offset: 0xf000 length: 0x1000
READ64 image: 13 offset: 0x10000 length: 0x1000
READ64 image: 13 offset: 0x11000 length: 0x1000
READ64 image: 13 offset: 0x12000 length: 0x1000
READ64 image: 13 offset: 0x13000 length: 0x1000
READ64 image: 13 offset: 0x14000 length: 0x1000
READ64 image: 13 offset: 0x15000 length: 0x1000
READ64 image: 13 offset: 0x16000 length: 0x1000
READ64 image: 13 offset: 0x17000 length: 0x1000
READ64 image: 13 offset: 0x18000 length: 0x1000
READ64 image: 13 offset: 0x19000 length: 0x1000
READ64 image: 13 offset: 0x1a000 length: 0x1000
READ64 image: 13 offset: 0x1b000 length: 0x1000
READ64 image: 13 offset: 0x1c000 length: 0x1000
READ64 image: 13 offset: 0x1d000 length: 0x1000
READ64 image: 13 offset: 0x1e000 length: 0x1000
READ64 image: 13 offset: 0x1f000 length: 0x1000
READ64 image: 13 offset: 0x20000 length: 0x1000
READ64 image: 13 offset: 0x21000 length: 0x1000
READ64 image: 13 offset: 0x22000 length: 0x1000
READ64 image: 13 offset: 0x23000 length: 0x1000
READ64 image: 13 offset: 0x24000 length: 0x1000
READ64 image: 13 offset: 0x25000 length: 0x1000
READ64 image: 13 offset: 0x26000 length: 0x1000
READ64 image: 13 offset: 0x27000 length: 0x1000
READ64 image: 13 offset: 0x28000 length: 0x1000
READ64 image: 13 offset: 0x29000 length: 0x1000
READ64 image: 13 offset: 0x2a000 length: 0x1000
READ64 image: 13 offset: 0x2b000 length: 0x1000
READ64 image: 13 offset: 0x2c000 length: 0x1000
READ64 image: 13 offset: 0x2d000 length: 0x1000
READ64 image: 13 offset: 0x2e000 length: 0x1000
READ64 image: 13 offset: 0x2f000 length: 0x1000
READ64 image: 13 offset: 0x30000 length: 0x1000
READ64 image: 13 offset: 0x31000 length: 0x1000
READ64 image: 13 offset: 0x32000 length: 0x1000
READ64 image: 13 offset: 0x33000 length: 0x1000
READ64 image: 13 offset: 0x34000 length: 0x1000
READ64 image: 13 offset: 0x35000 length: 0x1000
READ64 image: 13 offset: 0x36000 length: 0x1000
READ64 image: 13 offset: 0x37000 length: 0x1000
READ64 image: 13 offset: 0x38000 length: 0x1000
READ64 image: 13 offset: 0x39000 length: 0x1000
READ64 image: 13 offset: 0x3a000 length: 0x1000
READ64 image: 13 offset: 0x3b000 length: 0x1000
READ64 image: 13 offset: 0x3c000 length: 0x1000
READ64 image: 13 offset: 0x3d000 length: 0x1000
READ64 image: 13 offset: 0x3e000 length: 0x1000
READ64 image: 13 offset: 0x3f000 length: 0x1000
READ64 image: 13 offset: 0x40000 length: 0x1000
READ64 image: 13 offset: 0x41000 length: 0x1000
READ64 image: 13 offset: 0x42000 length: 0x1000
READ64 image: 13 offset: 0x43000 length: 0x1000
READ64 image: 13 offset: 0x44000 length: 0x1000
READ64 image: 13 offset: 0x45000 length: 0x1000
READ64 image: 13 offset: 0x46000 length: 0x1000
READ64 image: 13 offset: 0x47000 length: 0x1000
READ64 image: 13 offset: 0x48000 length: 0x1000
READ64 image: 13 offset: 0x49000 length: 0x1000
READ64 image: 13 offset: 0x4a000 length: 0x1000
READ64 image: 13 offset: 0x4b000 length: 0x1000
READ64 image: 13 offset: 0x4c000 length: 0x1000
READ64 image: 13 offset: 0x4d000 length: 0x1000
READ64 image: 13 offset: 0x4e000 length: 0x484
READ64 image: 13 offset: 0x4e490 length: 0x1000
READ64 image: 13 offset: 0x4f490 length: 0x1000
READ64 image: 13 offset: 0x50490 length: 0x1000
READ64 image: 13 offset: 0x51490 length: 0x1000
READ64 image: 13 offset: 0x52490 length: 0x1000
READ64 image: 13 offset: 0x53490 length: 0x1000
READ64 image: 13 offset: 0x54490 length: 0x1000
READ64 image: 13 offset: 0x55490 length: 0x1000
READ64 image: 13 offset: 0x56490 length: 0x670
READ64 image: 13 offset: 0x56b00 length: 0x1000
READ64 image: 13 offset: 0x57b00 length: 0xfac
READ64 image: 13 offset: 0x58ab0 length: 0x36c
READ64 image: 13 offset: 0x58e20 length: 0x1000
READ64 image: 13 offset: 0x59e20 length: 0x1000
READ64 image: 13 offset: 0x5ae20 length: 0x1000
READ64 image: 13 offset: 0x5be20 length: 0x1000
READ64 image: 13 offset: 0x5ce20 length: 0x1000
READ64 image: 13 offset: 0x5de20 length: 0x1000
READ64 image: 13 offset: 0x5ee20 length: 0x1000
READ64 image: 13 offset: 0x5fe20 length: 0x1000
READ64 image: 13 offset: 0x60e20 length: 0x1000
READ64 image: 13 offset: 0x61e20 length: 0x1000
READ64 image: 13 offset: 0x62e20 length: 0x1000
READ64 image: 13 offset: 0x63e20 length: 0x1000
READ64 image: 13 offset: 0x64e20 length: 0x1000
READ64 image: 13 offset: 0x65e20 length: 0x1000
READ64 image: 13 offset: 0x66e20 length: 0x1000
READ64 image: 13 offset: 0x67e20 length: 0x1000
READ64 image: 13 offset: 0x68e20 length: 0x1000
READ64 image: 13 offset: 0x69e20 length: 0x1000
READ64 image: 13 offset: 0x6ae20 length: 0x1000
READ64 image: 13 offset: 0x6be20 length: 0x1000
READ64 image: 13 offset: 0x6ce20 length: 0x1000
READ64 image: 13 offset: 0x6de20 length: 0x1000
READ64 image: 13 offset: 0x6ee20 length: 0x1000
READ64 image: 13 offset: 0x6fe20 length: 0x1000
READ64 image: 13 offset: 0x70e20 length: 0x1000
READ64 image: 13 offset: 0x71e20 length: 0x1000
READ64 image: 13 offset: 0x72e20 length: 0x1000
READ64 image: 13 offset: 0x73e20 length: 0x1000
READ64 image: 13 offset: 0x74e20 length: 0x1000
READ64 image: 13 offset: 0x75e20 length: 0x1000
READ64 image: 13 offset: 0x76e20 length: 0x1000
READ64 image: 13 offset: 0x77e20 length: 0x1000
READ64 image: 13 offset: 0x78e20 length: 0x1000
READ64 image: 13 offset: 0x79e20 length: 0x1000
READ64 image: 13 offset: 0x7ae20 length: 0x89c
READ64 image: 13 offset: 0x7b6c0 length: 0x5c
READ64 image: 13 offset: 0x7b71c length: 0x1000
READ64 image: 13 offset: 0x7c71c length: 0x1000
READ64 image: 13 offset: 0x7d71c length: 0x1000
READ64 image: 13 offset: 0x7e71c length: 0x1000
READ64 image: 13 offset: 0x7f71c length: 0x1000
READ64 image: 13 offset: 0x8071c length: 0x8f0
READ64 image: 13 offset: 0x8100c length: 0x1000
READ64 image: 13 offset: 0x8200c length: 0x1000
READ64 image: 13 offset: 0x8300c length: 0x1000
READ64 image: 13 offset: 0x8400c length: 0x404
READ64 image: 13 offset: 0x84410 length: 0x1000
READ64 image: 13 offset: 0x85410 length: 0x1000
READ64 image: 13 offset: 0x86410 length: 0x1000
READ64 image: 13 offset: 0x87410 length: 0x1000
READ64 image: 13 offset: 0x88410 length: 0x1000
READ64 image: 13 offset: 0x89410 length: 0x1000
READ64 image: 13 offset: 0x8a410 length: 0x1000
READ64 image: 13 offset: 0x8b410 length: 0x1000
READ64 image: 13 offset: 0x8c410 length: 0x1000
READ64 image: 13 offset: 0x8d410 length: 0x1000
READ64 image: 13 offset: 0x8e410 length: 0x1000
READ64 image: 13 offset: 0x8f410 length: 0x1000
READ64 image: 13 offset: 0x90410 length: 0x1000
READ64 image: 13 offset: 0x91410 length: 0x1000
READ64 image: 13 offset: 0x92410 length: 0x1000
READ64 image: 13 offset: 0x93410 length: 0x1000
READ64 image: 13 offset: 0x94410 length: 0x1000
READ64 image: 13 offset: 0x95410 length: 0x1000
READ64 image: 13 offset: 0x96410 length: 0x1000
READ64 image: 13 offset: 0x97410 length: 0x1000
READ64 image: 13 offset: 0x98410 length: 0x1000
READ64 image: 13 offset: 0x99410 length: 0x1000
END OF IMAGE image: 13 status: 0
DONE status: 1
quic-jhugo commented 1 year ago

Oh, so it is sahara.c which can't open the file. That makes sense, at least from the standpoint that I touched that code. Will have a closer look.

bmx666 commented 1 year ago

Hi @andersson, I'm not sure, but this PR should be reverted until a working solution is implemented. Because many people who use QDL don't know anything about kickstart and most phones support the prog_firehose.elf bootloader. Most of them won't investigate why QDL doesn't work properly and even for me it was surprise because I spent 3 days to figure out why it wasn't working. Sorry, but I also don't get it why this PR was merged so quick without any verification and discussion? Your repo contains a lot of PR which is really useful, but they still in progress since 2022.

andersson commented 1 year ago

Sorry about that @bmx666, and thanks for the log. I've pushed a fix, after testing on a few different boards.