Run a terminal command from automated script in TWRP - General Questions and Answers

Hi
TWRP doesn't mount the misc partition and sometimes I have to run this code to sort out my bootloader problems.
Code:
dd if=/dev/zero of=/dev/block/platform/msm_sdcc.1/by-name/misc
Is there a way I can run a file/script within TWRP to save me typing it out manually every time?
Many thanks
Will

Related

help flashing twrp 2.2.2 via terminal

Alright so I put twrp recovery image on the root of my sd ... I open terminal type
Su
Cd sdcard
Flash_image recovery recoveryname(Der the name of it).img
And it says command not found
deleted
omario8484 said:
Alright so I put twrp recovery image on the root of my sd ... I open terminal type
Su
Cd sdcard
Flash_image recovery recoveryname(Der the name of it).img
And it says command not found
Click to expand...
Click to collapse
If you want to do it from terminal emulator on android, say name of recovery is twrp.img and is on root of sd....
Open terminal emulator
Type - su
Allow superuser permission,
Type -
dd if=sdcard/twrp.img of=/dev/block/mmcblk0p22
It will push, then do it again for good measure-
dd if=sdcard/twrp.img of=/dev/block/mmcblk0p22
Now power off, boot to bootloader and select recovery
as long as your rooted w. Bootloader unlocked you will have twrp recovery installed

[HOWTO] Unlocking i9505G bootloader

This will Wipe every thing on the internal storage SO BACKUP your stuff on the SD card and maybe the onto computer too
This is for the Google edition of the Galaxy S4
Go To setting / about phone /
Tap "Build Number" 7 times
Go back to Main Settings Menu and under now shown "Developer Options" enable "USB debugging"
Download this
http://developer.android.com/sdk/index.html#download
extract to the C drive in the folder adb (you can move it anywhere just adjust the path)
run "SDK Manager.exe"
in the extras select "Google USB Drivers"
click "Install 1 package" and accept license / Install
now go into the device manager on you PC and change the "Samsung ADB driver" to the
"Android Composite ADB Interface" located in this folder
C:\adb\sdk\extras\google\usb_driver
you will have to force that driver to install by selecting it
let it finish installing the drivers
then
unplug and then plug in the USB on the phone
your phone will ask you about "Allow USB debugging?"
check the box "always allow from this computer"
click OK on your phone
If this doesn't work the some thing is wrong with the drivers and reinstall the drivers make sure you select "Android Composite ADB Interface" and not "Android ADB Interface"
Now open up a command prompt (I did this as "run as administrator")
type "cd C:\adb\sdk\platform-tools" (or what ever the directory you extract your files)
enter this command
adb reboot bootloader <enter>
Once in bootloader,
In the command prompt type:
fastboot oem unlock <enter>
It will ask you to unlock you phone and this may void you warranty
Use the volume buttons to change to yes and the power button as enter
At this point everything gets wiped on your phone
The phone rebooted back into bootloader and it now said "bootloader=unlocked" and the bottom left of the screen
Reboot the phone and the unlock icon will appear on the 1st Google screen.
the phone will boot into android like it was new
I have not done any ODIN on my phone so i don't know how this affect it
I am trying to avoid ODIN and get the phone rooted and have a custom recovery on it.
I just did this on my phone and typed this up i think everything is accurate let me know if i need to adjust anything.
fyi the command "fastboot flash recovery recovery.img" don't work because the system is still secure boot enable.
Thanks and Questions
Thanks. Could you please tell where you found this info?
Also, I'm not that experienced and don't understand why this is necessary. Don't our GT-i9505G phones come with unlocked boot loader?
bsam55 said:
Thanks. Could you please tell where you found this info?
Also, I'm not that experienced and don't understand why this is necessary. Don't our GT-i9505G phones come with unlocked boot loader?
Click to expand...
Click to collapse
It still needs to perform fastboot oem unlock just like nexus device does
Sent using GT-i9505~
This is what i did on my galaxy nexus device (nexus 3) and my friend nexus one
I made this from my notes of the old devices
my experience is that i could mess up my phone and lock me out of it it, so i wanted to be sure i could fix it, that is why i did this
I did not try to use fastboot beforehand, so it could work.
but i have a feeling that the ODIN flash changed the bootloader (probably not)
but i have been screwed buy a odin flash messing with the bootloader on the vibrant( but for some reason there looked to be 3 bootloader on that device)
if some one want to try it
just put the ClockworkMod 6.0.3.3 recovery file the
C:\adb\sdk\platform-tools
adb reboot bootloader
fastboot boot recovery.img
this dose take 1 minute after the file is sent to reboot and load
I have tried TWRP but it don't load past the first screen.
This just boots into the file and doesn't change anything
access to the sd cards don't work
I am tempted to flash ClockworkMod but i would like to pull a copy of the recovery first.
BTW after paying $700 for a phone i want to be sure to be able to reinstall the OS, like on a PC.
warwolfx0 said:
This is what i did on my galaxy nexus device (nexus 3) and my friend nexus one
I made this from my notes of the old devices
my experience is that i could mess up my phone and lock me out of it it, so i wanted to be sure i could fix it, that is why i did this
I did not try to use fastboot beforehand, so it could work.
but i have a feeling that the ODIN flash changed the bootloader (probably not)
but i have been screwed buy a odin flash messing with the bootloader on the vibrant( but for some reason there looked to be 3 bootloader on that device)
if some one want to try it
just put the ClockworkMod 6.0.3.3 recovery file the
C:\adb\sdk\platform-tools
adb reboot bootloader
fastboot boot recovery.img
this dose take 1 minute after the file is sent to reboot and load
I have tried TWRP but it don't load past the first screen.
This just boots into the file and doesn't change anything
access to the sd cards don't work
I am tempted to flash ClockworkMod but i would like to pull a copy of the recovery first.
BTW after paying $700 for a phone i want to be sure to be able to reinstall the OS, like on a PC.
Click to expand...
Click to collapse
Maybe you can do a full dump for the community.
before you install custom recovery, I'd like to ask if you could do complete system dump of your device, including stock recovery (recovery.img), stock bootloader (boot.img) and system.img . It would be a big help to the community. You can do it simple after rooting with for example Motochopper exploit (described here http://whatswithtech.com/how-to-root-samsung-galaxy-s4/ )
Then something like this:
Code:
for gaining root access type: su
then:
copy BOOT -> dd if=/dev/block/mmcblk0p20 of=/sdcard/boot.img bs=4096
copy HIDDEN -> dd if=/dev/block/mmcblk0p27 of=/sdcard/hidden.img bs=4096
copy PARAM -> dd if=/dev/block/mmcblk0p19 of=/sdcard/param.bin bs=4096
copy RECOVERY -> dd if=/dev/block/mmcblk0p21 of=/sdcard/recovery.img bs=4096
copy SYSTEM -> dd if=/dev/block/mmcblk0p16 of=/sdcard/system.img bs=4096
Thanks a lot!
System Dump
Plus One on the system dump. There are a lot of knowledgeable people waiting to help as soon as they have this. I don't know enough to do it and did try CWM (which doesn't work, by the way.)
Hope you are able to help. Thanks
bmbm said:
before you install custom recovery, I'd like to ask if you could do complete system dump of your device, including stock recovery (recovery.img), stock bootloader (boot.img) and system.img . It would be a big help to the community. You can do it simple after rooting with for example Motochopper exploit (described here http://whatswithtech.com/how-to-root-samsung-galaxy-s4/ )
Then something like this:
Code:
for gaining root access type: su
then:
copy BOOT -> dd if=/dev/block/mmcblk0p20 of=/sdcard/boot.img bs=4096
copy HIDDEN -> dd if=/dev/block/mmcblk0p27 of=/sdcard/hidden.img bs=4096
copy PARAM -> dd if=/dev/block/mmcblk0p19 of=/sdcard/param.bin bs=4096
copy RECOVERY -> dd if=/dev/block/mmcblk0p21 of=/sdcard/recovery.img bs=4096
copy SYSTEM -> dd if=/dev/block/mmcblk0p16 of=/sdcard/system.img bs=4096
Thanks a lot!
Click to expand...
Click to collapse
cool thank i was looking for that info
Just i couldn't get su to work in adb
I have been able to get Supersu (also tried superuser) on the phone but it complains about the su binaries (busybox in superuser) not being installed i have tried to install it using the market app (which said i am rooted) but i get no popup on the system.
i might try a wipe to see if that fixed it. (i did flash root to the system so it should still be there after a wipe)
first root, then system dump
unless someone knows how to do a system dump without root? or temp root solution.
I will look into the motochopper later today
you don't need "su" to work in adb shell, if you run "adb root" and "adb remount" with a modified adbd binary (inside CWM for example) you will have root access.
pls try out this root zip I just made, maybe it will work
warwolfx0 said:
QUOTE]
DELETed
Click to expand...
Click to collapse
I have root
Thanks broodplank1337
download the root that "broodplank1337" made
and put it in "C:\adb\sdk\platform-tools" (this is my adb.exe folder)
Download ClockworkMod 6.0.3.3 NORMAL from below
http://forum.xda-developers.com/showthread.php?t=2359132&highlight=recovery
aka Miustone_CWM_flash-NORMAL.zip
extract the recovery.img to the folder "C:\adb\sdk\platform-tools"
Now open up a command prompt (I did this as "run as administrator")
type "cd C:\adb\sdk\platform-tools" (or what ever the directory you extract your files)
enter this command
adb reboot bootloader <enter>
Once in bootloader,
In the command prompt type:
fastboot boot recovery.img (this takes 1min to load after the file is sent)
This will boot into ClockworkMod
goto "install zip"
goto "install zip from sideload"
in the cmd type
adb sideload root.zip
This sends to the phone and write to the phones Rom.
Now reboot and we have root without ODIN on a I9505G
BTW my file was missing busybox in the xbin i was playing around with "CWM-SuperSU.zip" as a base
It is kind of late so i may have missed some things in this write up.
Now off to the system dump.
I will repost this later as a new post to keep this clean.
ok i had some issues with viewing the files on the phone
i moved them to the sdcard and then pulled them off the card on my pc using a "sd to usb"
dd if=/dev/block/mmcblk0p20 of=/storage/extSdCard/dump/boot.img bs=4096
dd if=/dev/block/mmcblk0p27 of=/storage/extSdCard/dump/hidden.img bs=4096
dd if=/dev/block/mmcblk0p19 of=/storage/extSdCard/dump/param.bin bs=4096
dd if=/dev/block/mmcblk0p21 of=/storage/extSdCard/dump/recovery.img bs=4096
dd if=/dev/block/mmcblk0p16 of=/storage/extSdCard/dump/system.img bs=4096
Is there any other mmcblk0p i should backup
and is there any issues with posting this info on this forum
so far this only has root
i did notice that clockworkmod did give me access to root but i couldn't find the sd card while fastbooting it.
I don't think that the whole bootloader is part of what i backup, I thought there was a sbl.bin that i need too.
warwolfx0 said:
ok i had some issues with viewing the files on the phone
i moved them to the sdcard and then pulled them off the card on my pc using a "sd to usb"
dd if=/dev/block/mmcblk0p20 of=/storage/extSdCard/dump/boot.img bs=4096
dd if=/dev/block/mmcblk0p27 of=/storage/extSdCard/dump/hidden.img bs=4096
dd if=/dev/block/mmcblk0p19 of=/storage/extSdCard/dump/param.bin bs=4096
dd if=/dev/block/mmcblk0p21 of=/storage/extSdCard/dump/recovery.img bs=4096
dd if=/dev/block/mmcblk0p16 of=/storage/extSdCard/dump/system.img bs=4096
Is there any other mmcblk0p i should backup
and is there any issues with posting this info on this forum
so far this only has root
i did notice that clockworkmod did give me access to root but i couldn't find the sd card while fastbooting it.
I don't think that the whole bootloader is part of what i backup, I thought there was a sbl.bin that i need too.
Click to expand...
Click to collapse
can you please upload your system dump , thank you mate
warwolfx0 said:
Thanks broodplank1337
download the root that "broodplank1337" made
and put it in "C:\adb\sdk\platform-tools" (this is my adb.exe folder)
Download ClockworkMod 6.0.3.3 NORMAL from below
http://forum.xda-developers.com/showthread.php?t=2359132&highlight=recovery
aka Miustone_CWM_flash-NORMAL.zip
extract the recovery.img to the folder "C:\adb\sdk\platform-tools"
Now open up a command prompt (I did this as "run as administrator")
type "cd C:\adb\sdk\platform-tools" (or what ever the directory you extract your files)
enter this command
adb reboot bootloader <enter>
Once in bootloader,
In the command prompt type:
fastboot boot recovery.img (this takes 1min to load after the file is sent)
This will boot into ClockworkMod
goto "install zip"
goto "install zip from sideload"
in the cmd type
adb sideload root.zip
This sends to the phone and write to the phones Rom.
Now reboot and we have root without ODIN on a I9505G
BTW my file was missing busybox in the xbin i was playing around with "CWM-SuperSU.zip" as a base
It is kind of late so i may have missed some things in this write up.
Now off to the system dump.
I will repost this later as a new post to keep this clean.
Click to expand...
Click to collapse
I maybe wrong in this, but I have played with fastboot on my ex HTC device. the proper command to flash recovery is
Code:
fastboot flash recovery recovery.img
the proper command to flash kernel is
Code:
fastboot flash boot boot.img
with
Code:
fastboot boot recovery.img
, the recovery isn't permanent. it will be only be there for the current session. after rebooting, the stock recovery will overwrite the custom recovery. the same goes to kernel.
Sent from my GT-I9505 using Tapatalk 2
warwolfx0 said:
ok i had some issues with viewing the files on the phone
i moved them to the sdcard and then pulled them off the card on my pc using a "sd to usb"
dd if=/dev/block/mmcblk0p20 of=/storage/extSdCard/dump/boot.img bs=4096
dd if=/dev/block/mmcblk0p27 of=/storage/extSdCard/dump/hidden.img bs=4096
dd if=/dev/block/mmcblk0p19 of=/storage/extSdCard/dump/param.bin bs=4096
dd if=/dev/block/mmcblk0p21 of=/storage/extSdCard/dump/recovery.img bs=4096
dd if=/dev/block/mmcblk0p16 of=/storage/extSdCard/dump/system.img bs=4096
Is there any other mmcblk0p i should backup
and is there any issues with posting this info on this forum
so far this only has root
i did notice that clockworkmod did give me access to root but i couldn't find the sd card while fastbooting it.
I don't think that the whole bootloader is part of what i backup, I thought there was a sbl.bin that i need too.
Click to expand...
Click to collapse
NONE of this would pull anything of relation from the I9505G (except System - mmcblk0p16) as our partitions layout is completely different. And more so, it would softbrick your 9505 if you tried flashing.
Check out here - http://forum.xda-developers.com/showthread.php?t=2360346 - for a system dump from the i9505G. It has SYSTEM/BOOT/RECOVERY. Param and Hidden are both empty on our phones. This has already been used a couple times to cook roms for other S4 devices.
donovanbrock said:
NONE of this would pull anything of relation from the I9505G (except System - mmcblk0p16) as our partitions layout is completely different. And more so, it would softbrick your 9505 if you tried flashing.
Check out here - http://forum.xda-developers.com/showthread.php?t=2360346 - for a system dump from the i9505G. It has SYSTEM/BOOT/RECOVERY. Param and Hidden are both empty on our phones. This has already been used a couple times to cook roms for other S4 devices.
Click to expand...
Click to collapse
Since my backup might mess people up i am not going to post it.
but as a backup i will make a full backup of all the mmcblk0pxx file
dd if=/dev/block/mmcblk0pxx of=/storage/extSdCard/dump/mmcblk0pxx.img bs=4096
i think there is like 20 files
Those with a real I9505G google edition samsung, do u have an option in settings to always have the lightkeys light up when screen is on? The menu and the back key, that light up.
hmmm followed step bye step but phones boot loader is still locked
i do have Super User access tho
edit: fail on my part. everything worked smoothly! thanks man!
Hello. Please help me. Can I flash stock ROM GT-I9005 on my Google Edition phone GT-I9005G? Thank for answer
SnegovikRZN said:
Hello. Please help me. Can I flash stock ROM GT-I9005 on my Google Edition phone GT-I9005G? Thank for answer
Click to expand...
Click to collapse
no

Mi4w IMEI (mmcblck) recovery. If Imei "unknown"

Hi! Sorry for my very bad English =) This thread is a solution, if you have IMEI unknown and all instructions NOT working - read/write error etc.
1. root device
2. download attach zip. It is contains 3 partitions - mmcblk 12,13 and 16.
3. copy three this files to your phone.
4. enable diag mode (com port in windows)
5. Run adb, type adb shell, type su
before Restoring we have to make sure that the efs partitions are cleared and dont have previous data so follow this codes before restoring
dd if=/dev/zero of=/dev/block/mmcblk0p12
dd if=/dev/zero of=/dev/block/mmcblk0p13
dd if=/dev/zero of=/dev/block/mmcblk0p16
reboot
Copy the Code
Use the below mentioned codes to restore
dd if=/sdcard/mmcblk0p12 of=/dev/block/mmcblk0p12
dd if=/sdcard/mmcblk0p13 of=/dev/block/mmcblk0p13
dd if=/sdcard/mmcblk0p16 of=/dev/block/mmcblk0p16
Copy the Code
Now Phone would reboot, Your Imei is Fixed (Restored) - imei null =)
6. in EFS Professional write your IMEI =)
7. reboot and enjoy your working phone =)

Stuck at fastboot, won't show device

Hi all, I've got a TF300T running stock 4.2. The device is unlocked (says so when starting). I can get ADB to recognize the device and reboot it. If I run reboot fastboot I get to a screen with 3 icons (RCK, android, wipe) and the text above "starting fastboot USB download protocol".
Running fastboot commands (with or without sudo) from my Mac doesn't provide a list of devices and I can't push TWRP.
If I choose RCK I get the little dude belly up with the red triangle.
Any help in getting fastboot to work? I"d love to go to a slimed down marshmallow rom if possible.
Thanks in advance!
FYI - I'm using moto-fastboot-osx64 as my fastboot file.
Liamfm said:
Hi all, I've got a TF300T running stock 4.2. The device is unlocked (says so when starting). I can get ADB to recognize the device and reboot it. If I run reboot fastboot I get to a screen with 3 icons (RCK, android, wipe) and the text above "starting fastboot USB download protocol".
Running fastboot commands (with or without sudo) from my Mac doesn't provide a list of devices and I can't push TWRP.
If I choose RCK I get the little dude belly up with the red triangle.
Any help in getting fastboot to work? I"d love to go to a slimed down marshmallow rom if possible.
Thanks in advance!
FYI - I'm using moto-fastboot-osx64 as my fastboot file.
Click to expand...
Click to collapse
Try to start adb and put in the command shell. ~# appear!
Copy into the open line:
dd if=/dev/zero of=/dev/block/mmcblk0p4 bs=100 count=1 > enter!
Copy into the open line:
dd if=/dev/zero of=/dev/block/mmcblk0p3 bs=16 count=1 >enter!
Now the tablet should start again into Android. If not try to start TWRP.
That's it!
ebonit said:
Try to start adb and put in the command shell. ~# appear!
Copy into the open line:
dd if=/dev/zero of=/dev/block/mmcblk0p4 bs=100 count=1 > enter!
Copy into the open line:
dd if=/dev/zero of=/dev/block/mmcblk0p3 bs=16 count=1 >enter!
Now the tablet should start again into Android. If not try to start TWRP.
That's it!
Click to expand...
Click to collapse
I'm unsure as to where these commands are going. am I going into Terminal on my mac, running ADB and then the commands? ($ adb dd if=/dev/zero of=/dev/block/mmcblk0p4 bs=100 count=1 > enter!)
I'm not trying to start it in Android, I'm trying to start in fastboot so I can load TWRP. Currently I think I have the stock recovery, but I can't even get into that.
Liamfm said:
I'm unsure as to where these commands are going. am I going into Terminal on my mac, running ADB and then the commands? ($ adb dd if=/dev/zero of=/dev/block/mmcblk0p4 bs=100 count=1 > enter!)
I'm not trying to start it in Android, I'm trying to start in fastboot so I can load TWRP. Currently I think I have the stock recovery, but I can't even get into that.
Click to expand...
Click to collapse
Did you do the first step:Try to start adb and put in the command shell. ~# appear! ?
I'm not sure what you mean by "Start ADB" - if in a terminal, I can write adb device and see my device. Running adb ~# appear! returns the same as if I just hit "adb" and "enter".
Sorry - I'm used to the reboot commands, the device commands, etc - just not this "appear" command with the ~#
Liamfm said:
I'm not sure what you mean by "Start ADB" - if in a terminal, I can write adb device and see my device. Running adb ~# appear! returns the same as if I just hit "adb" and "enter".
Sorry - I'm used to the reboot commands, the device commands, etc - just not this "appear" command with the ~#
Click to expand...
Click to collapse
I'm verry sorry for that fail, but we rescued TF300T with Stock Rom JB 4.2 which got stuck several times using Windows 7/10
First step "adb devices": your device as a serial number or so on should appear,
Second step "shell": ~# should appear. After that you may use the commands I mentioned in my post. If it doesn't work forget my post.
BTW you may try this one http://forum.xda-developers.com/showpost.php?p=62498968&postcount=1046
Good luck!
Bricked after attempting TWRP 2.8.2 Flash
I have the same problem, only now my TF300T will only boot as far as the Asus Logo. I can use ADB to recognize it, however when I attempt "fastboot reboot recovery," or "fastboot reboot bootloader" the tablet will only reboot to the Asus Logo. I can only force it into fastboot manually holding the Vol Down key. From this point neither adb devices nor fastboot devices will recognize the tablet. I've triedyou shell command and this is what I get:
C:\adb>adb devices
List of devices attached
015d262e0b20041a device
C:\adb>adb shell ~# appear!
- exec '/system/bin/sh' failed: No such file or directory (2) -
C:\adb>fastboot devices
C:\adb>adb devices
List of devices attached
C:\adb>
Any suggestions?

"write error: No space left on device" error fix

when im about to remove the modem files like this from adb menu
dd if=/dev/zero of=/dev/block/bootdevice/by-name/mdm1m9kefs1
dd if=/dev/zero of=/dev/block/bootdevice/by-name/mdm1m9kefs2
dd if=/dev/zero of=/dev/block/bootdevice/by-name/mdm1m9kefs3
dd if=/dev/zero of=/dev/block/bootdevice/by-name/mdm1m9kefsc
im getting "write error: No space left on device" error.
how to fix this. or is there any other way to delete those files.
Those commands will overwrite the named block-devices with zeroes, they don't get deleted means it's not technically erasing.
jwoegerbauer said:
Those commands will overwrite the named block-devices with zeroes, they don't get deleted means it's not technically erasing.
Click to expand...
Click to collapse
ok, so is there a way to overwrite them? cos atm i cant with those commands
To overwrite you have to specify as infile an image ( .img ) and as outfile the block-device wanted
jwoegerbauer said:
Look inside here:
dd: No Space Left on Device | Beamtic
After running dd for a long time, it stops with an error saying no space is left on the device.
beamtic.com
Click to expand...
Click to collapse
would it also be fixed when i format the device and wipe all data?
Raw34 said:
would it also be fixed when i format the device and wipe all data?
Click to expand...
Click to collapse
Re-read my altered post above yours.
jwoegerbauer said:
To overwrite you have to specify as infile an image ( .img ) and as outfile the block-device wanted
Click to expand...
Click to collapse
can u give me an example for the command for adb menu?
i want to get rid of this file mi10orj.bin in the modem
What ADB are you using? AFAIK ADB hasn't a menu,
If device is rooted then you may run
Code:
adb devices
adb shell "stop"
adb shell "rm -f /vendor/mi10orj.bin"
adb shell "start"
if the .bin-file is located in vendor partition what IDK
jwoegerbauer said:
What ADB are you using? AFAIK ADB hasn't a menu,
If device is rooted then you may run
Code:
adb devices
adb shell "stop"
adb shell "rm -f /vendor/mi10orj.bin"
adb shell "start"
if the .bin-file is located in vendor partition what IDK
Click to expand...
Click to collapse
its called "minimal adb and fastboot tool".
yes the device is rooted. im gonna try this commands when im done with my working.
thx so much for your help and insight, so far.

Categories

Resources