Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer to QDL #33

Merged
merged 114 commits into from
Apr 17, 2024
Merged

Transfer to QDL #33

merged 114 commits into from
Apr 17, 2024

Conversation

bongbui321
Copy link
Contributor

@bongbui321 bongbui321 commented Feb 8, 2024

+++ Covered all the needed commands. Now test and integrate+++
https://bongbui321.github.io/flash/

  • WebUSB read + write
  • Sahara class
  • store + load appropriate loader (snapdrag 845 for Comma)
  • firehose class
  • storageInfo
  • detect partitions
  • write
  • write sparse (haven't tested)
  • erase
  • getactiveslot (can't test on the leeco)
  • setactiveslot (can't test on the leeco)
  • Get partitions info for device check
  • reset
  • XML parser
  • Serial detection
  • maxDownloadSize - maxbytestotarget
  • integrate info comma flash
    - [ ] Connect without detach_driver.py (not sure if all linux but def 20.04)
    - [ ] Refactor for beaut improvement in other PRs
  • Delete fastboot lib

TESTS

  • expectedPartitions for C3/C3X
  • getactiveslot
  • setactiveslot
    - [x] Compare speed of full and sparse images
  • write sparse image
  • Connect on Mac
  • Connect on Windows

@bongbui321 bongbui321 marked this pull request as draft February 8, 2024 07:46
@bongbui321
Copy link
Contributor Author

I will be updating in this repo (https://github.com/bongbui321/op_qdl_eons) which is mainly used for testing of QDL.js library and eons flashing only without interfering with this repo. I will transfer working changes to this repo once I finish with everything.

@bongbui321
Copy link
Contributor Author

bongbui321 commented Mar 30, 2024

You recently mentioned I'd have to flash with fastboot to recover an interrupted flash before using this again. Has that been fixed?

Hmm, I was wrong, fastboot doesn't even fix this (tested), if the device disconnects at the middle of changing slot, most likely the guid type of the partitions will be incorrect (it is just metadata, and the device look at the attribute field of the partition to determine active slots). Though this would not affect the ability to boot up, I still prefer to preserve the correctness of the guid type metadata of the partitions

My fix is currently better since it uses backup gpt to recover that metadata if the device disconnects

@bongbui321
Copy link
Contributor Author

Can use this whenever you test. https://github.com/bongbui321/test_flash_op

src/QDL/firehose.js Outdated Show resolved Hide resolved
src/workers/image.worker.js Outdated Show resolved Hide resolved
src/utils/manifest.test.js Outdated Show resolved Hide resolved
src/QDL/firehose.js Outdated Show resolved Hide resolved
src/QDL/sahara.js Outdated Show resolved Hide resolved
src/QDL/sahara.js Outdated Show resolved Hide resolved
Comment on lines +258 to +259
// Erase current xbl partition so if users try to power up device
// with corrupted primary gpt header, it would not update the backup
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain this more?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever booting up the device, the xbl partition will try to compare the primary gpt headers with their corresponding backup gpt headers, and if the backups are not the same as the primary gpt headers, it will update the backup to be the primary gpt headers.

If a user somehow disconnect the device during changing active slot process then the device would have corrupted gpt header, and if the user tries to boot up the device immediately afterwards without flashing again, the xbl would just update the backup gpt headers with the corrupted primary one. Erasing that makes sure that that doesn't happen.

it is important to always keep the backup gpt headers clean and uncorrupted since we use those to recover the corrupted gpt headers if there were any failure during flashing process.

Fastboot doesn't have this feature, and it would just go with the corrupted gpt headers (tested).

src/QDL/usblib.js Outdated Show resolved Hide resolved
src/config.js Outdated Show resolved Hide resolved
Loaders/6000000000010000_f8ab20526358c4fa_fhprg.bin Outdated Show resolved Hide resolved
@adeebshihadeh adeebshihadeh changed the base branch from master to qdl April 17, 2024 20:51
@adeebshihadeh
Copy link
Collaborator

Nice work! Merged into a staging qdl branch for now.

@adeebshihadeh adeebshihadeh merged commit 3b28e6c into commaai:qdl Apr 17, 2024
1 of 2 checks passed
@bongbui321 bongbui321 deleted the qdl branch April 17, 2024 22:32
adeebshihadeh pushed a commit that referenced this pull request Apr 18, 2024
* connect qualcomusb

* finish read write

* sahara setup

* js is painful

* finish sahara

* upload programmer

* fix usblib

* load programmer

* time out

* can reset

* firehose detect partition storage info gpt

* can detect partition

* can write

* can erase

* can get active slot - haven't tested

* setactive slot

* remove releaseinterface

* cleanup

* add sparse

* big cleanup

* cleanup saharadefs

* automate usb packet maxsize

* fix getactiveslot

* import only used from gpt.js

* refactor

* move folder

* integrate

* maxlun = 6

* refactor

* serial

* trailing white space

* fix getactiveslot

* auto download loader

* setactiveslot

* transferout with retry

* add reset userdata

* add semicolon

* update onprogress

* test

* qdl update

* fix sparse

* works

* add loader

* unpack system

* remove sleep at write

* test

* update instructions

* update instructions

* update instructions

* move detach

* cleanup sahara

* update scripts

* update instructions

* update error message

* fasttt

* remove run()

* update eraseuserdata

* auto upload loader

* throw when disconnect + resetuserdata

* delete fb

* cleanup + catch disconnect

* update instruction

* faster

* fix

* zadig_form update

* zadig_create_new_device update to match tint

* update instruction

* remove

* update instruction

* timed out connect

* increase timeout

* update instruction

* update instruction + update detach script

* add copy button

* log setactive successfully

* throw during connecting if error

* error diconnect while connecting

* update throw error

* cleanup

* cleanup

* cleanup

* restructure + cleanup

* fix

* fix style

* style

* fix

* fix

* serial -> int

* cleanup restructure

* cleanup

* cleanup sparse

* cleanup sparse

* change name bytes to num

* clean up path

* consistent var name cmd erase

* cleanup sparse

* write resetuserdata

* remove erase cmd

* cleanup sparse

* update

* update

* cleanup style

* clearer instruction

* cleanup

* update check gpt header consistency

* faster setactiveslot

* move loader into Loaders

* 4x faster setactiveslot

* cleanup

* remove web fastboot

* revert manifest test and image workers

* fix downloadLoader

---------

Co-authored-by: Andrei Radulescu <andi.radulescu@gmail.com>
adeebshihadeh added a commit that referenced this pull request Sep 12, 2024
* Transfer to QDL (#33)

* connect qualcomusb

* finish read write

* sahara setup

* js is painful

* finish sahara

* upload programmer

* fix usblib

* load programmer

* time out

* can reset

* firehose detect partition storage info gpt

* can detect partition

* can write

* can erase

* can get active slot - haven't tested

* setactive slot

* remove releaseinterface

* cleanup

* add sparse

* big cleanup

* cleanup saharadefs

* automate usb packet maxsize

* fix getactiveslot

* import only used from gpt.js

* refactor

* move folder

* integrate

* maxlun = 6

* refactor

* serial

* trailing white space

* fix getactiveslot

* auto download loader

* setactiveslot

* transferout with retry

* add reset userdata

* add semicolon

* update onprogress

* test

* qdl update

* fix sparse

* works

* add loader

* unpack system

* remove sleep at write

* test

* update instructions

* update instructions

* update instructions

* move detach

* cleanup sahara

* update scripts

* update instructions

* update error message

* fasttt

* remove run()

* update eraseuserdata

* auto upload loader

* throw when disconnect + resetuserdata

* delete fb

* cleanup + catch disconnect

* update instruction

* faster

* fix

* zadig_form update

* zadig_create_new_device update to match tint

* update instruction

* remove

* update instruction

* timed out connect

* increase timeout

* update instruction

* update instruction + update detach script

* add copy button

* log setactive successfully

* throw during connecting if error

* error diconnect while connecting

* update throw error

* cleanup

* cleanup

* cleanup

* restructure + cleanup

* fix

* fix style

* style

* fix

* fix

* serial -> int

* cleanup restructure

* cleanup

* cleanup sparse

* cleanup sparse

* change name bytes to num

* clean up path

* consistent var name cmd erase

* cleanup sparse

* write resetuserdata

* remove erase cmd

* cleanup sparse

* update

* update

* cleanup style

* clearer instruction

* cleanup

* update check gpt header consistency

* faster setactiveslot

* move loader into Loaders

* 4x faster setactiveslot

* cleanup

* remove web fastboot

* revert manifest test and image workers

* fix downloadLoader

---------

Co-authored-by: Andrei Radulescu <andi.radulescu@gmail.com>

* switch programmer

* remove system-skip-chunks image

* fix missing Buffer in browser

* lint: Fixed Unnecessary escape character: "

* lint: Fixed defined but never used

* lint: Fixed unnecessary try/catch wrapper

* lint: Fixed do not access Object.prototype method 'hasOwnProperty' from target object

* fix typo image_tx_status

* Revert "remove system-skip-chunks image"

This reverts commit 8381ab2.

* support jsons without the system alt image

* better naming for crc32

* nicer logging about loader

* support old and new manifest

---------

Co-authored-by: Hoang Bui <47828508+bongbui321@users.noreply.github.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants