Cập nhật: 22/10/2024
ext4_utils là bộ tool dùng để tạo/chỉnh sửa file spared img cho Android dùng làm đĩa ảnh cho system.img, userdata.img. Để compile ext4_utils cho Fedora, có thể thực hiện các bước sau:
Cách sử dụng:
Chuyển từ file spared img sang raw img để mount trên linux:
./simg2img <SPARED IMG> <RAW IMG>
Tạo file spared img từ 1 folder trên linux:
./make_ext4fs -s -l <IMG SIZE> -a <MOUNT POINT> – S <FILE CONTEXTS> <img name> <folder>
Lưu ý: <FILE CONTEXTS> nằm trong thư mục gốc của ROM.ZIP
Các bước compile trên Fedora linux
yum install pcre-devel
yum install zlib-devel
git clone –branch lollipop-release https://android.googlesource.com/platform/external/libselinux
git clone –branch lollipop-release https://android.googlesource.com/platform/system/core
| git clone –branch lollipop-release https://android.googlesource.com/platform/external/zlib | 
git clone –branch lollipop-release https://android.googlesource.com/platform/system/extras
| gcc -c callbacks.c check_context.c freecon.c init.c label.c label_file.c label_android_property.c -I../include -I../../core/include -DHOST | 
| gcc -c adler32.c compress.c crc32.c deflate.c gzclose.c gzlib.c gzread.c gzwrite.c infback.c inflate.c inftrees.c inffast.c trees.c uncompr.c zutil.c -O3 -USE_MMAP -I.. | 
| gcc -c backed_block.c output_file.c sparse.c sparse_crc32.c sparse_err.c sparse_read.c -Iinclude | 
| gcc -o simg2img simg2img.c sparse_crc32.c -Iinclude libsparse.a -I../../zlib ../../zlib/src/libz.a | 
| gcc -o make_ext4fs make_ext4fs_main.c make_ext4fs.c ext4fixup.c ext4_utils.c allocate.c contents.c extent.c indirect.c uuid.c sha1.c wipe.c crc16.c canned_fs_config.c ext4_sb.c -I../../libselinux/include -I../../core/libsparse/include -I../../core/include/ ../../libselinux/src/libselinux.a ../../core/libsparse/libsparse.a ../../zlib/src/libz.a -DHOST -DANDROID | 
| cp make_ext4fs ../../../bin | 
| # build for mkbootimg & mkbootfs | 
| gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a | 
| cp mkbootimg ../../../bin | 
| gcc mkbootfs.c -o mkbootfs -I../include | 
cd ../..
[…] ext4-utils dùng để tạo file img với định dạng ext4fs (xem hướng dẫn compile tại đây) […]