[HOW-TO] Flash A/B Treble GSI ROMs without TWRP - Sony Xperia XZ3 Guides, News, & Discussion

Android devices can have different designs, so there is no generic command or set of instructions for flashing a GSI to apply to all devices. Specially for Xperias am i writing this Guides for You. So please read carefully...
1. Ensure that You have the following before You start:
Latest Fastboot Version (Or the used fastboot commands may not work)
A Method for disabling Android Verified Boot (Part of the Guide)
An unlocked Bootloader State (Official Instructions HERE)
To Start:
Download the Basic Package from Google: https://developer.android.com/topic/generic-system-image/releases
Download the AOSP Vendor Package from Sony: https://developer.sony.com/develop/open-devices/downloads/software-binaries
Open up the Zip Files and place the 3 included Images on Your fastboot destination
Boot Your Device into Fastboot:
Code:
Turn off Your Device and hold VolumeUP while connecting via USB to a PC or use ADB to reboot to fastboot
Disable the verified booting (AVB) by flashing vbmeta.img:
Code:
fastboot --disable-verification flash vbmeta vbmeta.img
Flash the Vendor to the Primary A Slot OEM:
Code:
fastboot flash oem_a nameofthesonyoemimage.img
Repeat to flash to the B Slot OEM
Code:
fastboot flash oem_b nameofthesonyoemimage.img
Flash the GSI to the Primary A Slot System:
Code:
fastboot flash system_a system.img
Repeat to flash to the B Slot System
Code:
fastboot flash system_b system.img
Wipe the user data and clear the data from other necessary partitions (for example, user data and system partitions):
Code:
fastboot -w
Reboot:
Code:
fastboot reboot
Additional:
You can use any Android 9+ GSI out of the XDA Forum here: https://forum.xda-developers.com/project-treble/trebleenabled-device-development
To get Magisk/Root; just patch Your actual Kernel with the Magisk Manager App and flash the Boot Image together with the GSI (Example below)
Patched Boot Image for Xperia 5 Users: https://forum.xda-developers.com/xp...isk-v20-3-patched-boot-image-android-t4033547

How to force unlock bootloader?
On Sony XZ3 Unlocking Bootloader is not allowed.

Related

[Q] command to flash kernel for Kindle Fire?

What's the command to flash a kernel for the Kindle Fire? I've tried several fastboot commands to flash the kernel or boot.img, but it always ends up being stuck in Fastboot Mode. The commands I've tried (IIRC):
Code:
fastboot -i 0x1949 boot boot.img
fastboot -i 0x1949 flash boot boot.img
fastboot -i 0x1949 boot zImage ramdisk.gz
fastboot -i 0x1949 boot zImage
These commands appear to indicate success (by displaying "OKAY"), but they leave the device stuck at Fastboot. I've even tried setting Normal mode and rebooting:
Code:
fastboot -i 0x1949 oem idme bootmode 4000
I also tried setting the base address, which apparently overwrote my recovery.img because I couldn't get into TWRP after that (had to reflash recovery.img):
Code:
fastboot -b 0x80000000 -i 0x1949 flash boot boot.img [COLOR="Red"][B](DON'T RUN THIS LINE)[/B][/COLOR]
The only workaround I have is to include the zImage inside the source tree of CM9, and rebuild CM9 in order to package the custom kernel inside update.zip. Then, I flash that from TWRP. This takes quite a while (about 15 mins) even with no changes to CM9 source. There must be a way to create a flash-able update.zip with only the kernel (and ramdisk), but I haven't discovered it. Even better would be a way to do this all from the command line, so I can script it instead of using TWRP. Any ideas? Thanks

Can you erase the sdcard (external storage) using fastboot?

Does anyone know a way of erasing the sdcard (external storage) on the Nexus S using fastboot commands? i ask because i'm creating a cmd file that will return my phone back to stock using factory images and then relock the bootloader, the only problem is that the sdcard doesn't get erased when relocking the bootloader, so is there a fastboot command to erase the sdcard?
You can lock and unlock bootloader again. Then relock.
So lock->unlock->relock
Sent from my Nexus S using Tapatalk
Thanks for the quick reply, i had thought of that but i would prefer to just erase the sdcard (also for future reference), or, perform a relock that gives the same results as the unlock, eg: wipe sdcard, which would be better, my cmd entries are below.
fastboot flash bootloader bootloader-crespo-i9020xxkl1.img
fastboot reboot-bootloader
timeout /t 5 > nul
fastboot flash radio radio-crespo-i9020xxki1.img
fastboot reboot-bootloader
timeout /t 5 > nul
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot erase cache
fastboot oem lock
fastboot reboot
The only thing missing is a command to erase the sdcard.
d.chatten said:
Thanks for the quick reply, i had thought of that but i would prefer to just erase the sdcard (also for future reference), or, perform a relock that gives the same results as the unlock, eg: wipe sdcard, which would be better, my cmd entries are below.
fastboot flash bootloader bootloader-crespo-i9020xxkl1.img
fastboot reboot-bootloader
timeout /t 5 > nul
fastboot flash radio radio-crespo-i9020xxki1.img
fastboot reboot-bootloader
timeout /t 5 > nul
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot erase cache
fastboot oem lock
fastboot reboot
The only thing missing is a command to erase the sdcard.
Click to expand...
Click to collapse
Try fastboot erase sdcard?
Sent from my ice cream powered Nexus S
DarkhShadow said:
Try fastboot erase sdcard?
Click to expand...
Click to collapse
Thanks for the suggestion, but i have tried this and it doesn't seem to work with the Nexus S.
Anyone...?
d.chatten said:
Thanks for the suggestion, but i have tried this and it doesn't seem to work with the Nexus S.
Click to expand...
Click to collapse
You could try fastboot erase /dev/block/vold/179:3
Or boot it up and delete it via android
If they don't work don't lame me I'm a noob xD
Sent from my ARCHOS 80G9 using XDA Premium HD app
I think i'll just use the lock>unlock>lock method till i find something a bit more concrete, thanks for the suggestions though, much appreciated.
where can i find all this files?
d.chatten said:
Thanks for the quick reply, i had thought of that but i would prefer to just erase the sdcard (also for future reference), or, perform a relock that gives the same results as the unlock, eg: wipe sdcard, which would be better, my cmd entries are below.
fastboot flash bootloader bootloader-crespo-i9020xxkl1.img
fastboot reboot-bootloader
timeout /t 5 > nul
fastboot flash radio radio-crespo-i9020xxki1.img
fastboot reboot-bootloader
timeout /t 5 > nul
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot erase cache
fastboot oem lock
fastboot reboot
The only thing missing is a command to erase the sdcard.
Click to expand...
Click to collapse
where can i find all this files?
You can download the factory images from here > https://developers.google.com/android/nexus/images, you'll need WinRAR, 7zip or similar installed to enable you to extract the files.
if i recall correctly, the command is "fastboot erase media"
TheMachoMidget said:
if i recall correctly, the command is "fastboot erase media"
Click to expand...
Click to collapse
Found this
Delete existing apps on Android SD
adb shell rm -r /system/sd/app
adb shell rm -r /system/sd/appprivate
Through Terminal Partition SD card
It will erase everything on your SD card
$ su
# cd /data
# wget http://64.105.21.209/bin/lib/droid/sdsplit4
# chmod 555 sdsplit
# /data/sdsplit -fs *size* (add -nc to the end for JFv1.5ADP)

Fastboot Driver

I am trying to put a ROM on the TF300. I have Unlocked the tablet and installed the ADB driver. When I boot into recovery and the USB icon it asks for a driver for fastboot. I can't seem to get that anywhere. I have the Android SDK installed and java etc. Where is the driver located? I look in the USB driver folder but its not in their...
If you need just fastboot, use this guide, that you will find in the index for tf300 (General & Dev forums)
HELP FOR FLASH MORE FASTER WHEN YOU USE FASTBOOT LINE COMMAND​
If you have got a problem with your adb or fastboot or recovery....it's very simply and faster
use this:
Download this file "fastboot.zip"
Install this file somewhere in one folder which is named "fastboot" on your PC
=> disk C: root
Unzipped this file on the folder "fastboot" and you will find 3 files:
- adb.exe
- AdbWinApi.dll
- fastboot.exe
and when you need to push something by the bootloader, you can use it.
Don't forget to push on this folder the file that you need. For exemple: boot.img or a recovery.img, etc...
The line command is :
Code:
c:\fastboot>
Enter
Code:
c:\fastboot>fastboot flash recovery recovery.img
Enter
If you want to flash the "recovery.img" file
******************************************************************
******************************************************************
If you want to know all lines of command
Code:
c:\fastboot>fastboot
Code:
usage: fastboot [ ]
commands:
update reflash device from update.zip
flashall flash boot + recovery + system
flash [ ] write a file to a flash partition
erase erase a flash partition
getvar display a bootloader variable
boot [ ] download and boot kernel
flash:raw boot [ ] create bootimage and flash it
devices list all connected devices
continue continue with autoboot
reboot reboot device normally
reboot-bootloader reboot device into bootloader
help show this help message
options:
-w erase userdata and cache
-s specify device serial number
-p specify product name
-c override kernel commandline
-i specify a custom USB vendor id
-b specify a custom kernel base address
-n specify the nand page size. default: 2048
And if you have some problems with your drivers, you can use this : How to install Universal Naked Drivers
Sent from my N7 3G with DroiDevs premium between sky and earth.
I got it to work thanks!

How To Guide Guide to flash images in Linux

as we known, there's a famous tool called Tiny Script Tool to flash our custom systems. but i hate windows, is there a way to flash images in linux? at lease in linux there's no driver needs to all adb devices, thats perfect!
this guid will led you to do it in linux.
as Moto edge s is a dynamic partition device, these options suite to all devices with super block.
maybe YOU HAVE TO USE ROOT OR SUDO TO ACCESS YOUR DEVICE. change to root user if you can't access your device in linux.
# automatic tool:
i've wrote it as a script tool, see https://github.com/superiums/TrinyFlashScript
# manually steps:
## 刷机步骤
1. 备份app
Bash:
#!/bin/bash
backdirs='/dev/shm/app_backup/'
if [ ! -d "$backdirs" ]; then
mkdir $backdirs
fi
# user 0
backdir='/dev/shm/app_backup/0/'
if [ ! -d "$backdir" ]; then
mkdir $backdir
fi
adb shell pm list packages --user 0 -3 -f |awk '{ORS="\n";sub(/package:/,"adb pull ");sub(/apk=/,"apk '$backdir'");print($0".apk;");print("")}' >$backdir'dolist.sh'
sh $backdir'dolist.sh'
# ----------back app for user 10, if you have insular installed in your phone, this is needed!!! ********otherwise, skip.*******
backdir='/dev/shm/app_backup/10/'
if [ ! -d "$backdir" ]; then
mkdir $backdir
fi
adb shell pm list packages --user 10 -3 -f |awk '{ORS="\n";sub(/package:/,"adb pull ");sub(/apk=/,"apk '$backdir'");print($0".apk;");print("")}' >$backdir'dolist.sh'
sh $backdir'dolist.sh'
# ---------------------------------------------------------------------------------------------------------------------
2. 备份数据
Bash:
adb pull /sdcard/Downlad .
3. 重启到fastboot模式,刷写非动态分区
> **非动态分区包括**:
>
> - vbmeta
> - vbmeta_system
> - boot
> - vendor_boot
> - dtbo
Bash:
adb reboot bootloader
# 或 volumne- & power 开机
# 验证是否fastbootd模式
fastboot getvar is-userspace
# 应返回 no
fastboot flash [partition][_slot] [image]
# clear userdata and meta
fastboot -w
4. 重启到fastbootd模式,刷新动态分区
> **super分区包括**:
>
> - system
> - system_ext
> - vendor
> - product
Bash:
fastboot reboot fastboot
# 验证是否fastbootd模式
fastboot getvar is-userspace
# 应返回 yes
fastboot flash [partition][_slot] [image]
6. 双清
Bash:
fastboot erase userdata
#或
fastboot -w
#完成,重启到新系统
fastboot reboot
7. 设置系统
Bash:
#-------------for chinese users only, because they are blocked by the GFW and not able to connect to google.--------------
#Android 7及之后的版本输入如下两个命令,设置网络检测地址:
adb shell settings put global captive_portal_http_url http://www.google.cn/generate_204
adb shell settings put global captive_portal_https_url https://www.google.cn/generate_204
#可以输入如下命令, 禁止检测网络连接状态.
adb shell settings put global captive_portal_detection_enabled 0
#---------------------------------
#---------- if you are concern to your private data, this is usefull.
#强制开启分区存储
adb shell sm set-isolated-storage on
9. 恢复软件及数据
Bash:
cd 0
ls -1 *.apk | xargs -ti -n 1 adb install --user 0 {}
#------------- after install insular--------------------
cd 10
ls -1 *.apk | xargs -ti -n 1 adb install --user 10 {}
adb push ./Downloads/* /sdcard/Downloads/
hopes this help.
the insular mentioned above is this package: com.oasisfeng.island.fdroid.apk
which will create sperate user space for your storage , called "work profile".
if you bricked your device, try these options:
(Every flash lover should backup a stock image for future!)
RSA solution, flash back to stock firmware. follow Skip to content for windows, follow these commands for Linux:
Bash:
command
fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash vbmeta_system vbmeta_system.img
fastboot flash vbmeta vbmeta.img
fastboot flash radio radio.img
fastboot flash bluetooth BTFM.bin
fastboot flash dsp dspso.bin
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash vendor_boot vendor_boot.img
fastboot flash dtbo dtbo.img
fastboot flash super super.img_sparsechunk.0
fastboot flash super super.img_sparsechunk.1
fastboot flash super super.img_sparsechunk.2
fastboot flash super super.img_sparsechunk.3
fastboot flash super super.img_sparsechunk.4
fastboot flash super super.img_sparsechunk.5
fastboot flash super super.img_sparsechunk.6
fastboot flash super super.img_sparsechunk.7
fastboot flash super super.img_sparsechunk.8
fastboot flash super super.img_sparsechunk.9
fastboot erase userdata
fastboot erase ddr
fastboot oem fb_mode_clear
fastboot reboot
Blank Flash, both windows and linux tools and image contained.
download stock firmware for motorola edge s (nio, XT2125) here: https://mirrors.lolinet.com/firmwar...ubsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip
download blankFlash tool here:
https://mirrors.lolinet.com/firmware/motorola/nio/blankflash/blankflash_nio_RRTS31.Q1-84-24-3-6.zip
MSM Xextend is very powerfull, so many custom settings, love and great appreciate !
I've wrote a automatic script tool for this, see
https://github.com/superiums/TrinyFlashScript

[SOLVED] GSI on BV 4900 Pro: "Cannot load Android system. Your data may be corrupt. "

tl;dr: I followed the procedure to flash Android's Generic System Image (gsi_gms_arm64-exp-TP1A.220624.014-8819323-8a77fef1) on my Blackview BV 4900 Pro, but I am stuck in a bootloop that ends with "Cannot load Android system. Your data may be corrupt."
In details:
Prep​I made sure that my phone could support GSI​
$adb shell getprop ro.treble.enabled
true
$adb shell cat /system/etc/ld.config.29.txt | grep -A 20 "\[vendor\]"
…
namespace.default.isolated = true
…
$adb shell getprop ro.product.cpu.abi
arm64-v8a
Additional Checks​
Bootloader is unlocked.
Device was launched with Android 9 or higher (it was launched with Android 10)
Android 13 GSIs was downloaded (build Build: TP1A.220624.014) was downloaded from https://developer.android.com/topic/generic-system-image/releases and checksum for ARM64+GMS was confirmed to be 8a77fef1842da4a4cff68e36802f779d65e52ae0cfce024a33901d5dc48d47d0.
The phone has Android Verified Boot (AVB):
$adb shell getprop ro.boot.veritymode
enforcing
Flashing​
I followed the official tutorial for flashing GSIs but changed a couple of things (I may have the order wrong, but I essentially did, once I was in fastboot mode
fastboot flashing unlock # To unlock bootloader
fastboot flash --disable-verity --disable-verification vbmeta vbmeta.img # Disable secure boot
fastboot reboot fastboot # Restart in fastbootd
fastboot delete-logical-partition product # I didn't have enough space for Resizing 'system' (I had FAILED (remote: 'Not enough space to resize partition'))
fastboot erase system
fastboot format:ext4 system # because when I tried to flash system.img the first time, I had "Invalid sparse file format at header magic"
fastboot flash system system.img
fastboot format:ext4 userdata
fastboot erase userdata
fastboot format:ext4 metadata
fastboot erase metadata
fastboot erase cache
But when I restart, I am always prompted with
Android Recovery
Blackview /BV4900Pro_US/BV4900Pro10/…
user/release-keys
Use volume up/down and power
Can't load Android system. Your data
may be corrupt. If you continue to get
this message, you may need to perform a
factory data reset and erase all user
data stored on this device
-------------------------
Try again
Factory data reset
-------------------------
Supported API:3
I have tried to reset factory data and to reboot, but I always have the same message…
$ adb --version
Android Debug Bridge version 1.0.41
Version 33.0.3-8952118
I just realized / remembered that this phone uses super.img instead of system.img, maybe I need to repack the system.img into a super.img, following this procedure?
tl;dr: Yes, repacking the system.img into a super.img and then flashing it was key to success.
I have essentially followed what I have described here: https://forum.xda-developers.com/t/...n-blackview-bv-4900-pro.4453955/post-87029001
Except that the three images I used were the original vendor.img, the original product.img, and
aosp_arm64-exp-TP1A.220624.014-8819323-996da050/system.img (available at
Generic System Images (GSIs) | Platform | Android Developers
developer.android.com
)
I used the command
python3 lpmakesimple.py lpbinary/binary/lpmake ./super_20220510.img 4294967296 system=system.img,vendor=./vendor.img,product=./product.img
(4294967296 being picked semi-randomly: it's a multiple of the block size (65536), less than the size of the super partition but more than the size of the three images combined + some more).
That's it: I flashed that super_20220510.img using fastboot flash super super_20220510.img and it was all good!

Categories

Resources