2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
EROFS
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
EROFS は、Linux 4.19 で導入された読み取り専用のファイル システムです。圧縮と重複除去をサポートし、読み取り用にパフォーマンスが最適化されています。
他の圧縮ファイル システムとの主な違いは、インプレース解凍をサポートしている点です。圧縮されたデータがブロックの最後に保存されるため、同じページに解凍できます。EROFS イメージでは、99% を超えるブロックでこの方式を使用できるため、読み取りオペレーション中に追加のページを割り当てる必要がなくなります。
EROFS イメージの圧縮は必須ではありません。ただし、圧縮すると平均で約 25% 小さくなります。上限レベルまで圧縮できると、最大で 45% 小さくなります。
EROFS は、圧縮を使用しているかどうかに関係なく、ランダム アクセス時間とシーケンシャル アクセス時間の両方で他のファイル システムより優れていることがわかっています。
ビルドの変更
EROFS を有効にするには、BoardConfig.mk
でファイルシステム タイプ erofs
を使用します。例:
BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs
fstab の変更
fstab タイプは erofs
です。必要なマウント オプションは ro
のみです。EXT4 ベースの GSI イメージを引き続きテストできるようにするには、/system.
の 2 つの fstab エントリを使用します。
例:
system /system erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount
system /system ext4 ro,barrier=1 wait,slotselect,avb=vbmeta_system,logical,first_stage_mount
圧縮の調整
EROFS は、デフォルトでは固定サイズのブロックに圧縮されます。可変長ブロックを有効にすると圧縮効率が大幅に向上します。次のフラグで構成できます。
BOARD_EROFS_PCLUSTER_SIZE := 262144
これにより、PCLUSTER
(可変長ブロックサイズ)の上限が 262,144 バイトに設定されます。4096 の倍数を指定する必要があります。値を大きくするほど効果は逓減します。デバイス ハードウェアによっては、値を大きくするほど読み取りパフォーマンスが低下することがあります。
圧縮を無効にする
デフォルトの圧縮方式は lz4hc
です。圧縮を無効にするには次のコマンドを使用します。
BOARD_EROFS_COMPRESSOR := none
次のように、パーティションごとに変更することもできます。
BOARD_SYSTEMIMAGE_EROFS_COMPRESSOR := none
重複除去
EROFS では、次のフラグを使用して重複ブロックを共有できます。
BOARD_EROFS_SHARE_DUP_BLOCKS := true
Android 13 以降でこのフラグを使用するには、圧縮を無効にする必要があります。
OTA への影響
Android 13 以降では、EROFS が仮想 A/B で完全にサポートされています。OTA パッケージ生成ツールは、ファイル システム内の LZ4 ストリームをインテリジェントに解凍することによりデルタを生成できます。ソースビルドとターゲット ビルドで同じ LZ4 ライブラリを使用している限り、OTA パッケージのサイズは EXT4 ベースの OTA と同等になります。src
ビルドと dst
ビルドで同じ LZ4 ライブラリを使用していない場合でも、OTA サイズへの影響はそれほど大きくありません。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-26 UTC。"],[],[],null,["# EROFS is a read-only file system introduced in Linux 4.19. It supports\ncompression and deduplication, and is optimized for read performance.\n\nThe primary difference between EROFS and other compressed file systems is that\nit supports in-place decompression. Compressed data is stored at the end of\nblocks, so that it can be uncompressed into the same page. In an EROFS image,\nmore than 99% of blocks are able to use this scheme, thus eliminating the need\nto allocate extra pages during read operations.\n\nEROFS images don't have to be compressed. When using compression, however,\nimages are around 25% smaller on average. At the highest levels of compression,\nimages can be up to 45% smaller.\n\nWhether using compression or not, EROFS has been shown to outperform other\nfile systems in both random and sequential access times.\n\nBuild changes\n-------------\n\nTo enable EROFS, use the file system type `erofs` in `BoardConfig.mk`.\nFor example: \n\n BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := erofs\n BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := erofs\n BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := erofs\n BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := erofs\n BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs\n BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs\n\nfstab changes\n-------------\n\nThe fstab type is `erofs`, and the only mount option needed is `ro`. To keep the\nability to test EXT4-based GSI images, you can use two fstab entries for\n`/system.`\n\nFor example: \n\n system /system erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount\n system /system ext4 ro,barrier=1 wait,slotselect,avb=vbmeta_system,logical,first_stage_mount\n\nCompression tuning\n------------------\n\nBy default, EROFS compresses into fixed-size blocks. Compression efficacy can be\nincreased significantly by enabling variable-length blocks. This can be\nconfigured by the following flag: \n\n BOARD_EROFS_PCLUSTER_SIZE := 262144\n\nThis sets the maximum `PCLUSTER`, or variable length block size, to 262144\nbytes. The number must be a multiple of 4096. There are diminishing returns at\nhigher values, and higher values can decrease read performance depending on the\ndevice hardware.\n\nDisable compression\n-------------------\n\nBy default, the compression scheme is `lz4hc`. To disable compression, use: \n\n BOARD_EROFS_COMPRESSOR := none\n\nThis can be changed on a per-partition basis as well, for example: \n\n BOARD_SYSTEMIMAGE_EROFS_COMPRESSOR := none\n\nDeduplication\n-------------\n\nEROFS can share duplicate blocks with the following flag: \n\n BOARD_EROFS_SHARE_DUP_BLOCKS := true\n\nAs of Android 13, compression must be disabled to use this flag.\n\nImpact on OTAs\n--------------\n\nAs of Android 13, EROFS is fully supported with Virtual A/B. The OTA package\ngenerator can generate deltas by intelligently decompressing the LZ4\nstreams within the file system. As long as both the source and target builds use\nthe same LZ4 library, the OTA package is comparable in size to an\nEXT4-based OTA. Even if the `src` or `dst` builds don't use the same LZ4\nlibrary, it should only have a minor impact on OTA size."]]