AOSP将/data分区文件系统类型从EXT4->F2FS

AOSP将/data分区文件系统类型从EXT4->F2FS

source build/envsetup.sh
lunch sdk_phone_x86_64

#Edit fstab
$repo diff
project device/generic/goldfish/
diff --git a/fstab.ranchu.ex b/fstab.ranchu.ex
index 5fe5b801..9d29a3e9 100644
--- a/fstab.ranchu.ex
+++ b/fstab.ranchu.ex
@@ -4,7 +4,7 @@ system   /system     ext4    ro,barrier=1     wait,logical,avb=vbmeta,first_stag
 vendor   /vendor     ext4    ro,barrier=1     wait,logical,first_stage_mount
 product  /product    ext4    ro,barrier=1     wait,logical,first_stage_mount
 system_ext  /system_ext  ext4   ro,barrier=1   wait,logical,first_stage_mount
-/dev/block/vdc   /data     ext4      noatime,nosuid,nodev,nomblk_io_submit,errors=panic   wait,check,quota,fileencryption=aes-256-xts:aes-256-cts,reservedsi
+/dev/block/vdc   /data     f2fs      noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,inlinecrypt    wait,check,quota,fileencryption=aes-256-xts:aes-256-cts,reservedsize=128M,fsverity,keydirectory=/metadata/vold/metadata_encryption,latemount
 /dev/block/pci/pci0000:00/0000:00:06.0/by-name/metadata    /metadata    ext4    noatime,nosuid,nodev    wait,formattable,first_stage_mount
 /devices/*/block/vdf auto   auto      defaults    voldmanaged=sdcard:auto,encryptable=userdata
 dev/block/zram0 none swap  defaults zramsize=75%
 
#build 
m -j48

#build success!

#此时生成的userdata.img 是ext4格式的,也不需要它,直接自己生成f2fs格式的userdata.img
#制作f2fs格式镜像的工具在  out/host/linux-x86/bin/make_f2fs
#-S 后是大小 单位是B
make_f2fs -S 48318382080 -g android -l data userdata.img   #sparse格式的镜像
#执行成功的结果
    F2FS-tools: mkfs.f2fs Ver: 1.14.0 (2020-08-24)

Info: Disable heap-based policy
Info: Debug level = 1
Info: Label = data
Info: Trim is disabled
Info: Set conf for android
Info: Enable Project quota
Info: not exist /proc/version!
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 94371840 (46080 MB)
Info: zone aligned segment0 blkaddr: 512
Info: add quota type = 0 => 4
Info: add quota type = 1 => 5
Info: add quota type = 2 => 6
Info: format version with
  "5.4.0-125-generic"
[f2fs_init_sit_area: 626]       Filling sit area at offset 0x00600000
[f2fs_init_nat_area: 660]       Filling nat area at offset 0x00a00000
[f2fs_write_root_inode:1274]    Writing root inode (hot node), 13000 0 200 at offset 0x00077824
[f2fs_write_default_quota:1350]         Writing quota data, at offset 00013601, 00013602
[f2fs_write_qf_inode:1407]      Writing quota inode (hot node), 13000 0 200 at offset 0x00077825
[f2fs_write_default_quota:1350]         Writing quota data, at offset 00013603, 00013604
[f2fs_write_qf_inode:1407]      Writing quota inode (hot node), 13000 0 200 at offset 0x00077826
[f2fs_write_default_quota:1350]         Writing quota data, at offset 00013605, 00013606
[f2fs_write_qf_inode:1407]      Writing quota inode (hot node), 13000 0 200 at offset 0x00077827
[f2fs_update_nat_root:1461]     Writing nat root, at offset 0x00000a00
[f2fs_add_default_dentry_root:1658]     Writing default dentry root, at offset 0x00013600
Info: Overprovision ratio = 0.930%
Info: Overprovision segments = 433 (GC reserved = 223)
[f2fs_write_check_point_pack: 819]      Writing main segments, cp at offset 0x00000200
[f2fs_write_check_point_pack: 975]      Writing Segment summary for HOT/WARM/COLD_DATA, at offset 0x00000201
[f2fs_write_check_point_pack:1002]      Writing Segment summary for HOT_NODE, at offset 0x00000202
[f2fs_write_check_point_pack:1014]      Writing Segment summary for WARM_NODE, at offset 0x00000203
[f2fs_write_check_point_pack:1025]      Writing Segment summary for COLD_NODE, at offset 0x00000204
[f2fs_write_check_point_pack:1033]      Writing cp page2, at offset 0x00000205
[f2fs_write_check_point_pack:1053]      Writing NAT bits pages, at offset 0x000003fe
[f2fs_write_check_point_pack:1074]      Writing cp page 1 of checkpoint pack 2, at offset 0x00000400
[f2fs_write_check_point_pack:1093]      Writing cp page 2 of checkpoint pack 2, at offset 0x00000405
[f2fs_write_super_block:1126]   Writing super block, at offset 0x00000000
Info: format successful
#sparse img ---> raw img   out/host/linux-x86/bin/simg2img
simg2img userdata.img userdata-qemu.img
#raw img ----> qcow2 img (模拟器使用的镜像)
qemu-img convert -f raw -O qcow2 userdata-qemu.img userdata-qemu.img.qcow2
##run emulator
emulator -shell
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值