qualcomm R fastboot -w后无法开机问题

执行"fastboot -w"的需求一般来自于测试GMS 刷GSI的需求,刷完google system image需要重新格式化三个分区

userdata、cache及metadata

代码引用如下

system/core/fastboot

fastboot.c

int FastBootTool::Main(int argc, char* argv[]) {

...
  if (wants_wipe) {
          if (force_flash) {
              CancelSnapshotIfNeeded();
          }
          std::vector<std::string> partitions = { "userdata", "cache", "metadata" };
          for (const auto& partition : partitions) {
             std::string partition_type;
              if (fb->GetVar("partition-type:" + partition, &partition_type) != fastboot::SUCCESS) {
                  continue;
              }
              if (partition_type.empty()) continue;
              fb->Erase(partition);
              if (partition == "userdata" && set_fbe_marker) {
                  fprintf(stderr, "setting FBE marker on initial userdata...\n");
                  std::string initial_userdata_dir = create_fbemarker_tmpdir();
                  fb_perform_format(partition, 1, partition_type, "", initial_userdata_dir, fs_options);
                  delete_fbemarker_tmpdir(initial_userdata_dir);
              } else {
                  fb_perform_format(partition, 1, partition_type, "", "", fs_options);
              }
          }
      }
...

}

在Android Q及以后,引用动态分区,GSI的更新,不能载进入bootloader模式下了,只能是进入用户态的fastbootd模式下;

在bootloader模式下,执行fastboot -w后,无法开机主要可能是以下问题点:

1.查看一下对应的fstab配置,目前项目上对应userdata挂载的type类型为F2FS

#<src>   <mnt_point>     <type>      <mnt_flags and options>       <fs_mgr_flags>
/dev/block/bootdevice/by-name/userdata /data f2fs
noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier
latemount,wait,check,formattable,fileencryption=ice,wrappedkey,keydirectory=/metadata/vold/metadata_encryption,quota,reservedsize=128M,checkpoint=fs

2.如果挂载方式是F2FS,并且bootloader是uefi架构,还需要将对应的partitioninfo对应起来

bootable/bootloader/edk2/
diff --git a/QcomModulePkg/Library/FastbootLib/FastbootCmds.c
b/QcomModulePkg/Library/FastbootLib/FastbootCmds.c
index 2b82b97..2c5a9b0
--- a/QcomModulePkg/Library/FastbootLib/FastbootCmds.c
+++ b/QcomModulePkg/Library/FastbootLib/FastbootCmds.c
@@ -86,7 +86,7 @@ found at
STATIC struct GetVarPartitionInfo part_info[] = {
 {"system", "partition-size:", "partition-type:", "", "ext4"},
- {"userdata", "partition-size:", "partition-type:", "", "ext4"},
+ {"userdata", "partition-size:", "partition-type:", "", "f2fs"},
 {"cache", "partition-size:", "partition-type:", "", "ext4"},
};

3.另外,如果userdata的加密方式为ME,即采用metadata方式加密,还需要格式化metadata分区

google默认没有给metadata分区设置文件系统,我们获取分区类型时,metadata为raw数据类型, 所以当format时会不生效,

$ fastboot getvar partition-type:metadata
partition-type:metadata: raw

未更改前,执行fastboot -w的log如下:
$ fastboot -w
Erasing 'userdata' OKAY [ 0.119s]
mke2fs 1.44.4 (18-Aug-2018)
Creating filesystem with 24811814 4k blocks and 6209536 inodes
Filesystem UUID: f0096258-2bb1-11ea-a7ee-efa76cb0902a
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done
Sending 'userdata' (4560 KB) OKAY [ 0.110s]
Writing 'userdata' OKAY [ 0.002s]
Erasing 'metadata' OKAY [ 0.005s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Finished. Total time: 0.815s

4.我们在bootloader的fastbootcmd partitioninfo中指定partition-type为ext4

bootable/bootloader/edk2/QcomModulePkg/Library/FastbootLib/FastbootCmds.c
STATIC struct GetVarPartitionInfo part_info[] = {
{"system", "partition-size:", "partition-type:", "", "ext4"},
{"userdata", "partition-size:", "partition-type:", "", "f2fs"},
{"cache", "partition-size:", "partition-type:", "", "ext4"},
+ {"metadata", "partition-size:", "partition-type:", "", "ext4"},
};

那我们看看最终执行成功执行完fastboot -w后的结果如下:

C:\windows\system32>fastboot -w
Erasing 'userdata'                                 OKAY [  0.099s]

        F2FS-tools: mkfs.f2fs Ver: 1.13.0 (2019-09-24)

Info: Disable heap-based policy
Info: Debug level = 1
Info: Trim is disabled
Info: Set conf for android
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 39312856 (19195 MB)
Info: zone aligned segment0 blkaddr: 512
Info: add quota type = 0 => 4
Info: add quota type = 1 => 5
[f2fs_init_sit_area: 560]       Filling sit area at offset 0x00600000
[f2fs_init_nat_area: 594]       Filling nat area at offset 0x00a00000
[f2fs_write_root_inode:1168]    Writing root inode (hot node), 8800 0 200 at offset 0x00034816
[f2fs_write_default_quota:1244]         Writing quota data, at offset 00008e01, 00008e02
[f2fs_write_qf_inode:1335]      Writing quota inode (hot node), 8800 0 200 at offset 0x00034817
[f2fs_write_default_quota:1244]         Writing quota data, at offset 00008e03, 00008e04
[f2fs_write_qf_inode:1335]      Writing quota inode (hot node), 8800 0 200 at offset 0x00034818
[f2fs_update_nat_root:1389]     Writing nat root, at offset 0x00000a00
[f2fs_add_default_dentry_root:1580]     Writing default dentry root, at offset 0x00008e00
Info: Overprovision ratio = 1.450%
Info: Overprovision segments = 281 (GC reserved = 145)
[f2fs_write_check_point_pack: 738]      Writing main segments, cp at offset 0x00000200
[f2fs_write_check_point_pack: 875]      Writing Segment summary for HOT/WARM/COLD_DATA, at offset 0x00000201
[f2fs_write_check_point_pack: 902]      Writing Segment summary for HOT_NODE, at offset 0x00000202
[f2fs_write_check_point_pack: 914]      Writing Segment summary for WARM_NODE, at offset 0x00000203
[f2fs_write_check_point_pack: 925]      Writing Segment summary for COLD_NODE, at offset 0x00000204
[f2fs_write_check_point_pack: 933]      Writing cp page2, at offset 0x00000205
[f2fs_write_check_point_pack: 953]      Writing NAT bits pages, at offset 0x000003ff
[f2fs_write_check_point_pack: 974]      Writing cp page 1 of checkpoint pack 2, at offset 0x00000400
[f2fs_write_check_point_pack: 993]      Writing cp page 2 of checkpoint pack 2, at offset 0x00000405
[f2fs_write_super_block:1026]   Writing super block, at offset 0x00000000
Info: format successful
Sending 'userdata' (80 KB)                         OKAY [  0.010s]
Writing 'userdata'                                 OKAY [  0.002s]
Erasing 'metadata'                                 OKAY [  0.005s]
mke2fs 1.45.4 (23-Sep-2019)
Creating filesystem with 4096 4k blocks and 4096 inodes

Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

Sending 'metadata' (48 KB)                         OKAY [  0.009s]
Writing 'metadata'                                 OKAY [  0.003s]
Finished. Total time: 8.834s

### PyCharm 打开文件显示全的解决方案 当遇到PyCharm打开文件显示全的情况时,可以尝试以下几种方法来解决问题。 #### 方法一:清理缓存并重启IDE 有时IDE内部缓存可能导致文件加载异常。通过清除缓存再启动程序能够有效改善此状况。具体操作路径为`File -> Invalidate Caches / Restart...`,之后按照提示完成相应动作即可[^1]。 #### 方法二:调整编辑器字体设置 如果是因为字体原因造成的内容显示问题,则可以通过修改编辑区内的文字样式来进行修复。进入`Settings/Preferences | Editor | Font`选项卡内更改合适的字号大小以及启用抗锯齿功能等参数配置[^2]。 #### 方法三:检查项目结构配置 对于某些特定场景下的源码视图缺失现象,可能是由于当前工作空间未能正确识别全部模块所引起。此时应该核查Project Structure的Content Roots设定项是否涵盖了整个工程根目录;必要时可手动添加遗漏部分,并保存变更生效[^3]。 ```python # 示例代码用于展示如何获取当前项目的根路径,在实际应用中可根据需求调用该函数辅助排查问题 import os def get_project_root(): current_file = os.path.abspath(__file__) project_dir = os.path.dirname(current_file) while not os.path.exists(os.path.join(project_dir, '.idea')): parent_dir = os.path.dirname(project_dir) if parent_dir == project_dir: break project_dir = parent_dir return project_dir print(f"Current Project Root Directory is {get_project_root()}") ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值