Firefly Open Source Community

Title: How to write recovery command to misc.img at Android? [Print This Page]

Author: cgsong    Time: 12/22/2014 14:35
Title: How to write recovery command to misc.img at Android?
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.
Author: busybee    Time: 12/23/2014 09:32
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




Author: cgsong    Time: 12/23/2014 12:13

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?










Author: busybee    Time: 12/23/2014 17:54

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.




Welcome Firefly Open Source Community (https://bbs.t-firefly.com/) Powered by Discuz! X3.1