Firefly Open Source Community

   Login   |   Register   |
New_Topic

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

107

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
107
Posted at 12/22/2014 14:35:23     
I upload custom RK3288 Android image and linux image to the Firefly for dual OS. But, there is some problem "switch system" in custom Android firmware. The custom Android image is not Firefly official image. When I connect to PC with "adb shell", "reboot recovery" command works well for switching Android to Linux. So I'd like to know how to write "recovery command" to misc.img that is /dev/block/mtd/by-name/misc at Android without PC.
Reply

Use props Report

403

Credits

10

Prestige

12

Contribution

intermediate

Rank: 3Rank: 3

Credits
403
Posted at 12/23/2014 09:32:54     
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

107

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
107
Posted at 12/23/2014 12:13:03     

In addition, I'd like to know how to setup "switch system" at Android power menu with "(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". I don't know how to put script at Android's switch system menu. Please let let me know how to put recovery command script that you told me. I'm using custom Android. So, where can I modify system file to switching system?









Reply

Use props Report

403

Credits

10

Prestige

12

Contribution

intermediate

Rank: 3Rank: 3

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

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