How To Guide Guide to flash images in Linux - Motorola Moto G100 / Edge S

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

Related

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)

[Q] Problem flashing recovery.

Hi guys.
I have been trying to root my HTC One S for hours now without any luck.
I have been using this guide,(http://forum.xda-developers.com/showthread.php?t=1583427) and have managed to get all the way to the last step in the "recovery"-section.
But when I try to flash the recovery, this is what I get:
c:\fastboot>fastboot recovery clockwork-touch.img
usage: fastboot [ <option> ] <command>
commands:
update <filename> reflash device from update.zip
flashall flash boot + recovery + system
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition> erase a flash partition
getvar <variable> display a bootloader variable
boot <kernel> [ <ramdisk> ] download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] 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 <serial number> specify device serial number
-p <product> specify product name
-c <cmdline> override kernel commandline
-i <vendor id> specify a custom USB vendor id
-b <base_addr> specify a custom kernel base address
-n <page size> specify the nand page size. default:
2048
How can this be?
Thanks in advance for your help
Type the following command
c:\fastboot>fastboot recovery recovery clockwork-touch.img
Thanks for your reply, frazzeld.
It didn't work. Sorry. Still the same text coming up.
Maybe there is something wrong with have a managed my fastboot-folder.
Because I am a new member I cant post a picture of my folder :/
But it is set up like this:
(folder)add-ons
(Folder)platforms
Folder)tools
adb
adbWinapi.dll
AVD Manager
clockwork-touch.img
fastboot.exe
SDK Manager
SDK Readme
Unlock-code
Never mind.
It worked after all. Don't know what I did wrong the first 50 times.
Thank you
which clockwork are you trying to install?
Edit: I see you've sorted it now
Are you in fastboot mode? Also the recovery image has to be in the same folder as fastboot.exe is.
To point to the correct folder its "cd"
e.g.
cd c:\fastboot
And the correct command is;
fastboot flash recovery name_of_the_recovery.img
Thats all i can see from what you've posted
edit: too slowwww, glad you got it sorted
Big_Den said:
...
fastboot flash recovery name_of_the_recovery.img
...
Click to expand...
Click to collapse
This.
Just in case someone else stumbles across this thread.
Unconn said:
This.
Just in case someone else stumbles across this thread.
Click to expand...
Click to collapse
From the proper directory. It's not C:\ for everyone... Some have their fastboot.exe in C:\Android and some even C:\Android\platform-tools for example.
Point being, make sure u know where your fastboot.exe is located
Sent from my HTC VLE_U using xda premium

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!

[HELP] Need help running command 'fastboot erase modemst1' on Pixel 5

After the March security update my Pixel 5 is not receiving any mobile network and i am not able to turn on radio power via the *#*#4636#*# command.
After googling for a solution i found similar posts which suggested resetting the modemst1 and 2 partitions
Tried running the following commands in adb but was unable to
Code:
adb shell 'dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst1'
adb shell 'dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst2'
For fastboot I used the following commands
Code:
fastboot erase modemst1
fastboot erase modemst2
which gave me an error
Code:
FAILED (remote: Not allowed to erase (modemst1))
I'm also not able to boot into adb root but i am able to run adb shell su
I tried installing adbd insecure which was unable to patch adbd and also installed an adb_root module in magisk which still failed to initialize adb root
Currently I'm running ProtonOS on my Pixel 5. I thought running a custom rom might help but the problem still persists
Please help
Hi.
I would suggest making a back up before you erase a partition in case you need to restore it.
Make sure to name the backup clearly so you know what it is.
Since you do not have adb root, you need to run the command as root using su -c "NameOfCommand".
If you boot into a custom recovery, you generally have adbd and do not need to use the su -c option.
Also double check your path, you should be able to call it from /dev/block/by-name.
or list by-name, ls -la /dev/block/by-name/ and call it from the true partition number.
Example of making a backup.
Dump the partition(s) into an image.
Code:
adb shell su -c "dd if=/dev/block/by-name/modemst1 of=/sdcard/redfin-modemst1.img"
adb shell su -c "dd if=/dev/block/by-name/modemst2 of=/sdcard/redfin-modemst2.img"
Copy the image(s) to computer.
Code:
adb pull /sdcard/redfin-modemst1.img
adb pull /sdcard/redfin-modemst2.img
Delete the image(s) from the device.
Code:
adb shell rm /sdcard/redfin-modemst1.img
adb shell rm /sdcard/redfin-modemst2.img
You need to be in fastbootd to modify critical partitions.
adb reboot bootloader will reboot into fastboot.
adb reboot fastboot will reboot into fastbootd.
You can do the same in fastboot/fastbootd
fastboot reboot bootloader will reboot into fastboot.
fastboot reboot fastboot will reboot into fastbootd.
Be Careful.
There are always risks involved when you start messing around with a device.
If something goes wrong, you may end up with a non-working "bricked" device.
This is especially true when you start modifying partitions.
Good luck.
Cheers.
ipdev said:
Hi.
I would suggest making a back up before you erase a partition in case you need to restore it.
Make sure to name the backup clearly so you know what it is.
Since you do not have adb root, you need to run the command as root using su -c "NameOfCommand".
If you boot into a custom recovery, you generally have adbd and do not need to use the su -c option.
Also double check your path, you should be able to call it from /dev/block/by-name.
or list by-name, ls -la /dev/block/by-name/ and call it from the true partition number.
Example of making a backup.
Dump the partition(s) into an image.
Code:
adb shell su -c "dd if=/dev/block/by-name/modemst1 of=/sdcard/redfin-modemst1.img"
adb shell su -c "dd if=/dev/block/by-name/modemst2 of=/sdcard/redfin-modemst2.img"
Copy the image(s) to computer.
Code:
adb pull /sdcard/redfin-modemst1.img
adb pull /sdcard/redfin-modemst2.img
Delete the image(s) from the device.
Code:
adb shell rm /sdcard/redfin-modemst1.img
adb shell rm /sdcard/redfin-modemst2.img
You need to be in fastbootd to modify critical partitions.
adb reboot bootloader will reboot into fastboot.
adb reboot fastboot will reboot into fastbootd.
You can do the same in fastboot/fastbootd
fastboot reboot bootloader will reboot into fastboot.
fastboot reboot fastboot will reboot into fastbootd.
Be Careful.
There are always risks involved when you start messing around with a device.
If something goes wrong, you may end up with a non-working "bricked" device.
This is especially true when you start modifying partitions.
Good luck.
Cheers.
Click to expand...
Click to collapse
Hello, I hope you will see this text. As you have mentioned, I have rebooted my Pixel 5 to fastbootd but I cannot erase any critical partition. for example, when i run fastboot erase cache OR fastboot erase modemst1, i get the same error message saying FAILED (remote: 'Partition doesn't exist'). Would you mind helping me? I would appreciate it a lot. Thank you.

[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