天天看點

recovery更新系統時挂載cache分區失敗現象解決辦法

Platform: RK3368

OS: Android 6.0

Kernel: 3.10.0

文章目錄

  • 現象
  • 解決辦法

現象

重新開機進recovery更新update.zip時,不進更新界面,而是進入recovery界面。并有列印錯誤"“E:failed to mount /cache /dev/block/rknand_cache (No such file or directory)”

更新日志:

Starting recovery (pid 156) on Mon Jan 21 09:21:53 2013
read cmdline
cmdline=earlyprintk=uart8250-32bit,0xff690000 console=ttyS2 androidboot.baseband=N/A androidboot.selinux=enforcing androidboot.hardware=rk30board androidboot.console=ttyS2 init=/init mtdparts=rk29xxnand:[email protected](parameter),[email protected](uboot),[email protected](trust),[email protected](misc),[email protected](resource),[email protected](kernel),[email protected](boot),[email protected](recovery),[email protected](backup),[email protected](cache),[email protected](kpanic),[email protected](system),[email protected](metadata),[email protected](baseparamer),[email protected](radical_update),[email protected](userdata) storagemedia=nand loader_charged [email protected]:0x01000000 loader.timestamp=2018-12-12_17:12:58

bootmode = unknown 
recovery filesystem table
=========================
  0 /mnt/internal_sd vfat /dev/block/rknand_user 0
  1 /mnt/external_sd vfat /dev/block/mmcblk0p1 0
  2 /system ext4 /dev/block/rknand_system 0
  3 /cache ext4 /dev/block/rknand_cache 0
  4 /metadata ext4 /dev/block/rknand_metadata 0
  5 /data ext4 /dev/block/rknand_userdata 0
  6 /cust ext4 /dev/block/rknand_cust 0
  7 /custom ext4 /dev/block/rknand_custom 0
  8 /radical_update ext4 /dev/block/rknand_radical_update 0
  9 /misc mtd misc 0
  10 /uboot mtd uboot 0
  11 /charge mtd charge 0
  12 /resource mtd resource 0
  13 /parameter mtd parameter 0
  14 /boot mtd boot 0
  15 /recovery mtd recovery 0
  16 /backup mtd backup 0
  17 /trust mtd trust 0
  18 /baseparamer mtd baseparamer 0
  19 /tmp ramdisk ramdisk 0

I/ [File] : bootable/recovery/recovery.cpp; [Line] : 1301; [Func] : SetSdcardRootPath; InternalSD_ROOT: /mnt/internal_sd
I/ [File] : bootable/recovery/recovery.cpp; [Line] : 1303; [Func] : SetSdcardRootPath; ExternalSD_ROOT: /mnt/external_sd
D/ [File] : bootable/recovery/recovery.cpp; [Line] : 1980; [Func] : main; to dump args befor get_args() : 
	 1 argument(s) : 
	 /sbin/recovery 
matches 0, mtdnum -1, mtdsize 0, mtderasesize 0, mtdname 
matches 4, mtdnum 0, mtdsize 400000, mtderasesize 4000, mtdname parameter
matches 4, mtdnum 1, mtdsize 400000, mtderasesize 4000, mtdname uboot
matches 4, mtdnum 2, mtdsize 400000, mtderasesize 4000, mtdname trust
matches 4, mtdnum 3, mtdsize 400000, mtderasesize 4000, mtdname misc
matches 4, mtdnum 4, mtdsize 1000000, mtderasesize 4000, mtdname resource
matches 4, mtdnum 5, mtdsize 1000000, mtderasesize 4000, mtdname kernel
matches 4, mtdnum 6, mtdsize 2000000, mtderasesize 4000, mtdname boot
matches 4, mtdnum 7, mtdsize 2000000, mtderasesize 4000, mtdname recovery
matches 4, mtdnum 8, mtdsize 7000000, mtderasesize 4000, mtdname backup
matches 4, mtdnum 9, mtdsize 8000000, mtderasesize 4000, mtdname cache
matches 4, mtdnum 10, mtdsize 400000, mtderasesize 4000, mtdname kpanic
matches 4, mtdnum 11, mtdsize 40000000, mtderasesize 4000, mtdname system
matches 4, mtdnum 12, mtdsize 1000000, mtderasesize 4000, mtdname metadata
matches 4, mtdnum 13, mtdsize 400000, mtderasesize 4000, mtdname baseparamer
matches 4, mtdnum 14, mtdsize 4000000, mtderasesize 4000, mtdname radical_update
matches 4, mtdnum 15, mtdsize 8E800000, mtderasesize 4000, mtdname userdata
find_partition : p->name parameter, name misc
find_partition : p->name uboot, name misc
find_partition : p->name trust, name misc
find_partition : p->name misc, name misc
 260 : devname : /dev/block/rknand_misc
E:Can't find misc
E/ [File] : bootable/recovery/bootloader.cpp; [Line] : 82; [Func] : get_bootloader_message_mtd; Can't find misc
failed to create /cache dir,err=File exists!
mount /cache /dev/block/rknand_cache (ext4)
E:failed to mount /cache /dev/block/rknand_cache (No such file or directory)
E/ [File] : bootable/recovery/roots.cpp; [Line] : 139; [Func] : ensure_path_mounted; f0.
           

解決辦法

由于rk3368是在init.rc中加載flash驅動,是以在recovery運作時,block裝置節點可能還未生成。

on fs
    insmod /rk30xxnand_ko.ko
           

是以需要等block裝置節點生成後再挂載cache分區。在bootable/recovery/recovery.cpp的main函數中做以下修改:

printf("Starting recovery (pid %d) on %s", getpid(), ctime(&start));
	if(check_sdboot()==0) 
		bSDBoot = true;	
	else if(check_usbboot()==0)
		bUsbBoot = true;
    load_volume_table();
    SetSdcardRootPath();
#ifdef LogToSDCard
    copy_log_to_sd();
#endif
+    //cache may not ready,so wait a few seconds.
+    for(int n = 0; n < 3; n++) {
+        if(0 == ensure_path_mounted(CACHE_LOG_DIR)){
+            break;
+        }else {
+             printf("delay 1sec\n");
+             sleep(1);
+        }
+    }