Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-04-2015, 04:23 PM   #1
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
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
For the older Kobo Touch, if it is running on an older FW (3.0.0 and older), one would have to set the PLATFORM to ntx508.

Last edited by tshering; 07-04-2015 at 04:55 PM.
tshering is offline   Reply With Quote
Old 07-04-2015, 04:44 PM   #2
Ken Maltby
Wizard
Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.Ken Maltby ought to be getting tired of karma fortunes by now.
 
Ken Maltby's Avatar
 
Posts: 4,466
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.
Ken Maltby is offline   Reply With Quote
Advert
Old 07-04-2015, 04:58 PM   #3
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by Ken Maltby View Post
OK, but it will take 30 min. to backup my internal uSD. <more in 30 min.>

Luck;
Ken
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.
tshering is offline   Reply With Quote
Old 07-04-2015, 05:03 PM   #4
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,282
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
}
Could also use /mnt/sd/u-boot.backup instead of /tmp/u-boot.cur so - if it doesn't actually boot afterwards you could undo by writing u-boot.backup back to the internal microsd.

Quote:
There are people around who could tell just by reading the script!
I'm not so sure. I remember I tried this recovery u-boot at some point and even though I think I did the same things rcS does, it didn't actually work for me. Maybe my mistake, maybe something missing, but testing is important in any case.

Last edited by frostschutz; 07-04-2015 at 05:11 PM.
frostschutz is offline   Reply With Quote
Old 07-04-2015, 05:25 PM   #5
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by frostschutz View Post
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.
I do not want to talk anybody into something. But I am curious, of course.

Quote:
Originally Posted by frostschutz View Post
A different take: (only works if u-boot.mmc is identical to present u-boot)
Very nice take. That would also work for mark 3 Touch with old FW.

Thank you for looking at the script!
tshering is offline   Reply With Quote
Advert
Old 07-04-2015, 09:14 PM   #6
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,282
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
My script:

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
frostschutz is offline   Reply With Quote
Old 07-05-2015, 03:32 PM   #7
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by frostschutz View Post
It works for me on the H2O.
Thank you very much for testing, and also for your script.
tshering is offline   Reply With Quote
Old 07-06-2015, 12:13 PM   #8
barobach_so
Connoisseur
barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.
 
Posts: 76
Karma: 25460
Join Date: Feb 2015
Device: kobo h2o
Quote:
Originally Posted by tshering View Post
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
For the older Kobo Touch, if it is running on an older FW (3.0.0 and older), one would have to set the PLATFORM to ntx508.
hi
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
barobach_so is offline   Reply With Quote
Old 07-06-2015, 02:50 PM   #9
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by barobach_so View Post
hi
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
Your imagination is correct. And then you would need to execute the script.

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!
tshering is offline   Reply With Quote
Old 07-07-2015, 08:49 AM   #10
barobach_so
Connoisseur
barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.
 
Posts: 76
Karma: 25460
Join Date: Feb 2015
Device: kobo h2o
Quote:
Originally Posted by tshering View Post
Your imagination is correct. And then you would need to execute the script.

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!
hi
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 ?
barobach_so is offline   Reply With Quote
Old 07-07-2015, 12:30 PM   #11
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by barobach_so View Post
hi
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 ?
If you like, extract KoboRoot.tgz from the archive and copy it to .kobo. After reboot, autoscript.sh will be started from the external sd.

Warning: This must not be installed on a device running KSM!
Attached Files
File Type: zip autorun_autoscript_sh_from_sd2.zip (753 Bytes, 302 views)

Last edited by tshering; 07-08-2015 at 04:17 AM.
tshering is offline   Reply With Quote
Old 07-08-2015, 02:32 AM   #12
barobach_so
Connoisseur
barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.
 
Posts: 76
Karma: 25460
Join Date: Feb 2015
Device: kobo h2o
Quote:
Originally Posted by tshering View Post
If you like, extract KoboRoot.tgz from the archive and copy it to .kobo. After reboot, autoscript.sh will be started from the external sd.

Warning: This must not be installed on a device running KSM!
hi
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
barobach_so is offline   Reply With Quote
Old 07-08-2015, 03:38 AM   #13
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by barobach_so View Post
hi
thank you

it doesn't work for me
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.
tshering is offline   Reply With Quote
Old 07-08-2015, 03:02 PM   #14
barobach_so
Connoisseur
barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.barobach_so knows what's going on.
 
Posts: 76
Karma: 25460
Join Date: Feb 2015
Device: kobo h2o
hi
it doesn't work again
can u take a look at my script file please
here
barobach_so is offline   Reply With Quote
Old 07-08-2015, 03:39 PM   #15
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by barobach_so View Post
hi
it doesn't work again
can u take a look at my script file please
here
Use unix style line endings (LF), instead of Windows style endings (CR+LF). You can select in notepad++ the end of line character (or sequence of charactres).

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:
Code:
#!/bin/sh

echo "ch 3" > /sys/devices/platform/pmic_light.1/lit
echo "cur 1" > /sys/devices/platform/pmic_light.1/lit
echo "bp 5" > /sys/devices/platform/pmic_light.1/lit
echo "dc 5" > /sys/devices/platform/pmic_light.1/lit

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-08-2015 at 03:45 PM.
tshering is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 01:35 AM.


MobileRead.com is a privately owned, operated and funded community.