[Nexus 7 Android Development] daniel_hk:
Discussions

Anyone has any idea are welcome to post here :)

DT2W

Sometimes it won't wakeup after a long DEEP_SLEEP

When volume buttons are also enabled for wakeup. It won't work too. Seems there are situations "soft pwr button press" won't work.

Fail after reboot

Supported API: 3
E: unknown fs_type "f2fs" for /cache
E: Can't mount /cache/recovery/last_locale

Some of you might encounter the above message after reboot. I never encountered before but there is definitely something wrong.

[MENTION=6754437]millosr[/MENTION] found that it was the recovery being replaced. I think that make sense and I want to study why.

I looked into the source. In the original AOSP, an OTA might come with a recovery patch. Stated in the build/core/Makefile "boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img"

It would generate the "recovery.img by the above formula itself. Custom ROMs usually won't carry a recovery and this part was usual ignored.

There is a warning in TWRP before reboot. Some of you might not read clearly and slide to continue immediately. In that case, the above mentioned recovery.img will be generated and flashed to the /recovery partition. Everything seems normal but after reboot.

When the script kick in, it would execute the "new" recovery. As a normal recovery, it would load the fstab and try to mount the partitions. The current fstab version is API 3. Almost all ROMs (no matter how close to AOSP) would have F2FS support. When we open a typical fstab:

/dev/block/platform/sdhci-tegra.3/by-name/APP	/system	ext4	ro	wait
/dev/block/platform/sdhci-tegra.3/by-name/CAC	/cache	f2fs	noatime,nosuid,nodev,nodiratime,discard,inline_xattr,inline_data,inline_dentry	wait,check
/dev/block/platform/sdhci-tegra.3/by-name/CAC	/cache	ext4	noatime,nosuid,nodev,nomblk_io_submit,journal_async_commit,errors=panic	wait,check

Note that the second line is the declaration for the /cache in f2fs. Stock AOSP recovery doesn't support f2fs. That's why the above error shown. Since it fail to mount /cache, the last_locale is not loaded and recovery would hang.

How to recover?

Naturally, you have to flash TWRP again.

First of all, you need to boot into bootloader (fastboot mode)

Some init.xxx.rc might start adbd earlier and in this case "adb reboot bootloader" would do the job.

If adbd was not started before the hang, the command won't work. In this case you can only use the pwr+vol. down combination.

If it is still hanging, the buttons might not work. Press the power button continuously might lead to repeatedly reboot. It is better to make sure the device is OFF first.

1. Connect to a charger.

2. Press the power button until you see the charging image

3. Release the power button immediately.

4. After that, press the volume down button first, and then the power button.

It would go to the bootloader. ;)

Note: /system is not really formatted during flashing. To make sure no residue left in /system, it is better to wipe the /system before flashing.

For ROM builders, there is a flag BOARD_USES_FULL_RECOVERY_IMAGE. Set it to true will stop the generation of recovery-resource.dat (in /system/etc) and break the above formula.