Skip to content

Commit

Permalink
extract_utils: Support odm/product/vendor partition for zip extract
Browse files Browse the repository at this point in the history
Change-Id: Iec06835f1703e276f8882c5ee327ef241a2f8f23
  • Loading branch information
moetayuko authored and Genkzsz11 committed May 7, 2020
1 parent 9e40080 commit 0dcf3fe
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions build/tools/extract_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1473,18 +1473,23 @@ function extract() {
if [ -a "$DUMPDIR"/payload.bin ]; then
echo "A/B style OTA zip detected. This is not supported at this time. Stopping..."
exit 1
# If OTA is block based, extract it.
elif [ -a "$DUMPDIR"/system.new.dat ]; then
echo "Converting system.new.dat to system.img"
python "$DU_ROOT"/vendor/du/build/tools/sdat2img.py "$DUMPDIR"/system.transfer.list "$DUMPDIR"/system.new.dat "$DUMPDIR"/system.img 2>&1
rm -rf "$DUMPDIR"/system.new.dat "$DUMPDIR"/system
mkdir "$DUMPDIR"/system "$DUMPDIR"/tmp
echo "Requesting sudo access to mount the system.img"
sudo mount -o loop "$DUMPDIR"/system.img "$DUMPDIR"/tmp
cp -r "$DUMPDIR"/tmp/* "$DUMPDIR"/system/
sudo umount "$DUMPDIR"/tmp
rm -rf "$DUMPDIR"/tmp "$DUMPDIR"/system.img
fi

for PARTITION in "system" "odm" "product" "vendor"
do
# If OTA is block based, extract it.
if [ -a "$DUMPDIR"/"$PARTITION".new.dat ]; then
echo "Converting "$PARTITION".new.dat to "$PARTITION".img"
python "$DU_ROOT"/vendor/du/build/tools/sdat2img.py "$DUMPDIR"/"$PARTITION".transfer.list "$DUMPDIR"/"$PARTITION".new.dat "$DUMPDIR"/"$PARTITION".img 2>&1
rm -rf "$DUMPDIR"/"$PARTITION".new.dat "$DUMPDIR"/"$PARTITION"
mkdir "$DUMPDIR"/"$PARTITION" "$DUMPDIR"/tmp
echo "Requesting sudo access to mount the "$PARTITION".img"
sudo mount -o loop "$DUMPDIR"/"$PARTITION".img "$DUMPDIR"/tmp
cp -r "$DUMPDIR"/tmp/* "$DUMPDIR"/"$PARTITION"/
sudo umount "$DUMPDIR"/tmp
rm -rf "$DUMPDIR"/tmp "$DUMPDIR"/"$PARTITION".img
fi
done
fi

SRC="$DUMPDIR"
Expand Down

0 comments on commit 0dcf3fe

Please sign in to comment.