sonyxperiadev / bug_tracker

Empty repository that is used as a bugtracker for Open Devices project
52 stars 13 forks source link

AOSP build guidance needs to be updated #652

Closed sjllls closed 3 years ago

sjllls commented 3 years ago

First metadata partition could not be erased by fastboot, at least on pdx201.

sjll@sjll:~/desktop$ fastboot erase metadata
erasing 'metadata'...
FAILED (remote: Erasing is not allowed for partition
)
finished. total time: 0.002s

Second For devices own dynamic partitions: Logical partitions need to be flashed in fastbootd in recovery.

Guidance should be:

  1. Flash these images at first
    fastboot flash boot out/target/product/<device>/boot.img​
    fastboot flash vbmeta out/target/product/<device>/vbmeta.img​
    fastboot flash dtbo out/target/product/<device>/dtbo.img​
    fastboot flash recovery out/target/product/<device>/recovery.img​
    fastboot flash userdata out/target/product/<device>/userdata.img​
    fastboot flash vbmeta_system out/target/product/<device>/vbmeta_system.img

    Hold power key + volume down, you will boot into recovery. Choose enter fastboot, then run :

    fastboot flash system out/target/product/<device>/system.img​
    fastboot flash vendor out/target/product/<device>/vendor.img​
    fastboot flash product out/target/product/<device>/product.img​​
MarijnS95 commented 3 years ago

First metadata partition could not be erased by fastboot, at least on pdx201.

Needs to happen from recovery-fastboot, not bootloader-fastboot iirc.

Logical partitions need to be flashed in fastbootd in recovery.

The build guides for Q and R very clearly state that you have to reboot to fastbootd. From here you can flash everything including boot and recovery:

image

Hold power key + volume down, you will boot into recovery. Choose enter fastboot

fastboot reboot fastboot or adb reboot fastboot, depending on where you are. No need to manually fumble around with turning the device off and holding buttons for some time.

Perhaps a better suggestion, when flashing from the same computer where the build takes place, while lunched to a particular device: fastboot flashall. When booted into bootloader-fastboot this automatically flashes aforementioned partitions, automatically reboots to fastbootd, sets up super partition sizes and flashes super partitions.

sjllls commented 3 years ago

First metadata partition could not be erased by fastboot, at least on pdx201.

Needs to happen from recovery-fastboot, not bootloader-fastboot iirc.

Nice, it works now, I tried it in fastbootd yesterday, but failed.

The build guides for Q and R very clearly state that you have to reboot to fastbootd. From here you can flash everything including boot and recovery:

image

Hold power key + volume down, you will boot into recovery. Choose enter fastboot

fastboot reboot fastboot or adb reboot fastboot, depending on where you are. No need to manually fumble around with turning the device off and holding buttons for some time.

Perhaps a better suggestion, when flashing from the same computer where the build takes place, while lunched to a particular > device: fastboot flashall. When booted into bootloader-fastboot this automatically flashes aforementioned partitions, >automatically reboots to fastbootd, sets up super partition sizes and flashes super partitions.

My bad, I skipped this step. So sorry. My fastboot needs to be updated.

sjll@sjll:~/fastboot$ fastboot reboot fastboot
fastboot: usage: unknown reboot target fastboot

Thanks, it works now after download latest one from google. :P

sjllls commented 3 years ago

@MarijnS95 Could you try to increase system reserved size, it is too small for gapps, even pico. IDK why it will boot into fastboot once I enlarged it, and nothing in pstore. :(

MarijnS95 commented 3 years ago

@sjllls I'm baking it in at boot using aosp_build, way more convenient than flashing packages from recovery/magisk after every system partition reflash.

sjllls commented 3 years ago

@sjllls I'm baking it in at boot using aosp_build, way more convenient than flashing packages from recovery/magisk after every system partition reflash.

Yup, but some users need a non-gapps build, this means dev need to build twice if they use opengapps aosp_build.

MarijnS95 commented 3 years ago

Distributing images of either variant to the community is obviously a different situation :)

I don't remember if you need to re-flash super_empty.img or otherwise tell fastbootd to take a partition resize into account. I doubt it's blindly overwriting a previously allocated segment for a smaller system.img without checking and dealing with size mismatches...

sjllls commented 3 years ago

Distributing images of either variant to the community is obviously a different situation :)

I don't remember if you need to re-flash super_empty.img or otherwise tell fastbootd to take a partition resize into account. I doubt it's blindly overwriting a previously allocated segment for a smaller system.img without checking and dealing with size mismatches...

@MarijnS95 I find the reason, becuase the fastboot on my Ubuntu is old version, on Google's latest one, fastbootd will resize the partition before you flashing new images. Old fastboot would not resize it, so if I flash a larger image, this parition will be empty.