07-04-2015, 04:23 PM | #1 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
initiate factory reset by script
Could anybody please confirm whether this script looks okay? It is meant to be run from an external sd.
Code:
#!/bin/sh PLATFORM=freescale if [ `dd if=/dev/mmcblk0 bs=512 skip=1024 count=1 | grep -c "HW CONFIG"` == 1 ]; then CPU=`ntx_hwconfig -s -p /dev/mmcblk0 CPU` PLATFORM=$CPU-ntx fi if [ -f "/etc/u-boot/${PLATFORM}/u-boot.recovery" ]; then dd if=/etc/u-boot/${PLATFORM}/u-boot.recovery of=/dev/mmcblk0 bs=128k count=1 seek=6 sync reboot else mount -o remount,rw /mnt/sd sleep 2 echo "Cannot find /etc/u-boot/${PLATFORM}/u-boot.recovery" > /mnt/sd/factory_reset.log sync /bin/busybox poweroff fi Last edited by tshering; 07-04-2015 at 04:55 PM. |
07-04-2015, 04:44 PM | #2 |
Wizard
Posts: 4,465
Karma: 6900052
Join Date: Dec 2009
Location: The Heart of Texas
Device: Boox Note2, AuraHD, PDA,
|
OK, but it will take 30 min. to backup my internal uSD. <more in 30 min.>
Well, OK, I'm not sure that image got created right anyway. Luck; Ken Last edited by Ken Maltby; 07-04-2015 at 05:44 PM. |
Advert | |
|
07-04-2015, 04:58 PM | #3 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Ken, I did not intend that somebody tests this. There are people around who could tell just by reading the script! Or those who want to reimage the internal sd anyway. So please do not do it.
|
07-04-2015, 05:03 PM | #4 | |
Linux User
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
Do you want me to look at it or do you want me to actually test it?
It LOOKS okay. I can test it tomorrow with another SD card if you like. A different take: (only works if u-boot.mmc is identical to present u-boot) Code:
recovery() { dd if=/dev/mmcblk0 bs=128k count=1 skip=6 of=/tmp/u-boot.cur for uboot in /etc/u-boot/*/u-boot.mmc do cmp /tmp/u-boot.cur $uboot \ && dd if=$(dirname $uboot)/u-boot.recovery of=/dev/mmcblk0 bs=128k count=1 seek=6 \ && success done failure } Quote:
Last edited by frostschutz; 07-04-2015 at 05:11 PM. |
|
07-04-2015, 05:25 PM | #5 | ||
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
Quote:
Thank you for looking at the script! |
||
Advert | |
|
07-04-2015, 09:14 PM | #6 |
Linux User
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
It works for me on the H2O.
Your script: Code:
+ PLATFORM=freescale + dd if=/dev/mmcblk0 bs=512 skip=1024 count=1 + grep -c HW CONFIG 1+0 records in 1+0 records out 512 bytes (512B) copied, 0.000754 seconds, 663.1KB/s + [ 1 == 1 ] + ntx_hwconfig -s -p /dev/mmcblk0 CPU + CPU=mx50 + PLATFORM=mx50-ntx + [ -f /etc/u-boot/mx50-ntx/u-boot.recovery ] + dd if=/etc/u-boot/mx50-ntx/u-boot.recovery of=/dev/mmcblk0 bs=128k count=1 seek=6 1+0 records in 1+0 records out 131072 bytes (128.0KB) copied, 0.001900 seconds, 65.8MB/s + sync + reboot Code:
+ recovery + dd if=/dev/mmcblk0 bs=128k count=1 skip=6 of=/tmp/u-boot.cur 1+0 records in 1+0 records out 131072 bytes (128.0KB) copied, 0.029423 seconds, 4.2MB/s + cmp /tmp/u-boot.cur /etc/u-boot/freescale/u-boot.mmc /tmp/u-boot.cur /etc/u-boot/freescale/u-boot.mmc differ: char 1, line 1 + cmp /tmp/u-boot.cur /etc/u-boot/mx50-ntx/u-boot.mmc + dirname /etc/u-boot/mx50-ntx/u-boot.mmc + dd if=/etc/u-boot/mx50-ntx/u-boot.recovery of=/dev/mmcblk0 bs=128k count=1 seek=6 1+0 records in 1+0 records out 131072 bytes (128.0KB) copied, 0.020337 seconds, 6.1MB/s + success |
07-05-2015, 03:32 PM | #7 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
|
07-06-2015, 12:13 PM | #8 | |
Connoisseur
Posts: 76
Karma: 25460
Join Date: Feb 2015
Device: kobo h2o
|
Quote:
sry I'm not familar with codes how should I use this scripts code ? copying them in notepad++ rename file to *.sh ? copy to SD ? these are my imagination |
|
07-06-2015, 02:50 PM | #9 | |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
If KSM 7 is installed on your device, you can name the file autoscript.sh. It will be executed when you insert the sd as soon as it is recognized and mounted by the system. This is meant for emergency cases when you cannot communicate any longer with your device in the usual ways. Do this only if you really want to factory reset your device! The process will start without asking for further confirmation! |
|
07-07-2015, 08:49 AM | #10 | |
Connoisseur
Posts: 76
Karma: 25460
Join Date: Feb 2015
Device: kobo h2o
|
Quote:
thank you for reply yes I want to factry reset and want to try it by this method but I don't have KSM on kobo any other way to execute script on sd ? |
|
07-07-2015, 12:30 PM | #11 | |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
Warning: This must not be installed on a device running KSM! Last edited by tshering; 07-08-2015 at 04:17 AM. |
|
07-08-2015, 02:32 AM | #12 | |
Connoisseur
Posts: 76
Karma: 25460
Join Date: Feb 2015
Device: kobo h2o
|
Quote:
thank you it doesn't work for me, which script should I use ? I use post one's ( that ends if "Fi" . should I change this part {PLATFORM} to anything for H2O ? and another question : in hypothetical case as you said there is no communication way with device, there is no chance to apply your patch " extract KoboRoot.tgz from the archive and copy it to .kobo." should I open this way every time after factory reset for emergency case |
|
07-08-2015, 03:38 AM | #13 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
I guess I goofed it up. I have to look at the sd script again.
Edit: Yes, I did. I have replaced the archive in the post above by the new one (autorun_autoscript_sh_from_sd2.zip). Last edited by tshering; 07-08-2015 at 04:19 AM. |
07-08-2015, 03:39 PM | #15 | |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
You can add some lines to the script in order to give you an optical feedback whether the script is executed at all. The led will start blinking. Spoiler:
Last edited by tshering; 07-08-2015 at 03:45 PM. |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Factory reset | christopher22 | Kobo Reader | 5 | 02-04-2015 02:26 PM |
PRS-T1 Factory reset - possible to execute via script? | bookler | Sony Reader Dev Corner | 1 | 07-04-2012 12:48 PM |
What happens when you do a factory reset? | Cameronpaterson | Kobo Reader | 16 | 12-20-2011 09:48 PM |
How do I do a Factory Reset? | Tinah | enTourage eDGe | 8 | 05-29-2011 08:11 AM |
Factory Reset! | sammieb77 | enTourage Archive | 55 | 03-18-2011 09:07 PM |