NicolasWebDev / reinstall-magisk-on-lineageos

Small bash script to reinstall magisk after each LineageOS update
72 stars 15 forks source link

Extract boot.img from payload.bin when required #9

Closed mattdale77 closed 1 year ago

mattdale77 commented 2 years ago

I changed the following function in order to pull the boot.img out of the payload as required on some builds

extract_boot_image() {
if [ unzip -l /tmp/lineageos-last-build.zip | grep boot.img | wc -l -ge 1 ]; then
unzip -od /tmp /tmp/lineageos-last-build.zip boot.img
else
if [ unzip -l /tmp/lineageos-last-build.zip | grep payload.bin | wc -l -ge 1 ]; then
echo "payload.bin found and boot.img must be extracted"
rm -rf /tmp/payload_dumper
git clone https://gist.github.com/ius/42bd02a5df2226633a342ab7a9c60f15 /tmp/payload_dumper unzip -od /tmp/payload_dumper /tmp/lineageos-last-build.zip payload.bin
python3 -m pip install protobuf
cd /tmp/payload_dumper
python3 payload_dumper.py payload.bin
rm -f /tmp/boot.img
mv boot.img /tmp
else
echo "no boot image"
exit 1
fi
fi
}

NicolasWebDev commented 2 years ago

See #10.

NicolasWebDev commented 2 years ago

@mattdale77 , would you mind telling me what builds have the boot.img in the payload.bin file? If you could mention the precise build you are having problem with, then I could reproduce the problem and create tests for that.

I actually used the official guide to install Magisk to create my script and I don't see mentions of payload.bin files there.

When downloading the microG zip file of my own phone, vayu, there is indeed a boot.img partition there.

mattdale77 commented 2 years ago

My device is a OnePlus 6, codename enchilada. That's the only one I know for sure I'm afraid On 10 Jun 2022, 03:42 +0100, NicolasWebDev @.***>, wrote:

@mattdale77 , would you mind telling me what builds have the boot.img in the payload.bin file? If you could mention the precise build you are having problem with, then I could reproduce the problem and create tests for that. I actually used the official guide to install Magisk to create my script and I don't see mentions of payload.bin files there. When downloading the microG zip file of my own phone, vayu, there is indeed a boot.img partition there. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

darthr4v3m commented 1 year ago

Hi @NicolasWebDev, thank you for your work! I'm using a OnePlus 6T (fajita) and I've find the boot.img contained in the payload.bin for the following builds:

I've also found very useful this wiki to extract the boot.img but it depends on python and python-protobuf: https://wiki.lineageos.org/extracting_blobs_from_zips#extracting-proprietary-blobs-from-payload-based-otas

NicolasWebDev commented 1 year ago

Hi @darthr4v3m , thanks a lot for the link to the article and the explanation. With that, I've been able to implement it in #14 that has already been merged. Actually if somebody is up to testing it it would be nice. I've tested it on my machine, but you never know.

Thanks @mattdale77 also for the original issue. I was not so keen on having to rely on python as an additional dependency, but knowing that lineageos recommends that package to extract the blobs, I think that it makes sense after all.