Firefly Open Source Community

   Login   |   Register   |
New_Topic
Print Previous Topic Next Topic

How to write recovery command to misc.img at Android?

403

Credits

10

Prestige

12

Contribution

intermediate

Rank: 3Rank: 3

Credits
403
Posted at 12/23/2014 09:32:54      1#
Do  a hexdump of misc.img, and you'll find the magic word:
  1. $ hexdump -C rkst/Image/misc.img
  2. 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  3. *
  4. 00004000  62 6f 6f 74 2d 72 65 63  6f 76 65 72 79 00 00 00  |boot-recovery...|
  5. 00004010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  6. *
  7. 00004040  72 65 63 6f 76 65 72 79  0a 2d 2d 77 69 70 65 5f  |recovery.--wipe_|
  8. 00004050  61 6c 6c 00 00 00 00 00  00 00 00 00 00 00 00 00  |all.............|
  9. 00004060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  10. *
  11. 0000c000
Copy the code

Please refer to https://bitbucket.org/T-Firefly/firefly ... 0462265ae6

There's a command to write misc partition:

  1. (echo -n boot-recovery | busybox dd bs=16k seek=1 conv=sync; busybox dd if=/dev/zero bs=16k count=1) > /dev/block/mtd/by-name/misc
Copy the code



Reply

Use props Report

403

Credits

10

Prestige

12

Contribution

intermediate

Rank: 3Rank: 3

Credits
403
Posted at 12/23/2014 17:54:52      2#

Check the commit already mensioned above.

https://bitbucket.org/T-Firefly/firefly ... 0462265ae6



This commit a based on the fact that misc partition is writable by all users:

diff --git a/system/core/init/devices.c b/system/core/init/devices.c
index 537627e..88287ef 100644
--- a/system/core/init/devices.c
+++ b/system/core/init/devices.c
@@ -188,7 +188,7 @@ static mode_t get_device_perm(const char *path, unsigned *uid, unsigned *gid)
     /* Default if nothing found. */
     *uid = 0;
     *gid = 0;
-    return 0600;
+    return 0666;
}

static void make_device(const char *path,


It's somewhat ugly. Please follow the factory reset code in Setting.
Reply

Use props Report

You need to log in before you can reply Login | Register

This forum Credits Rules

Quick Reply Back to top Back to list