android源码编译system.img文件重打包

替换了out/target/product里面system里面的很多文件,本来想make snod重打包img

error: ext4_allocate_best_fit_partial: failed to allocate 302 blocks, out of space?
error: failed to build out/target/product/generic_x86/system.img from out/target/product/generic_x86/system
Out of space? the tree size of out/target/product/generic_x86/system is (MB): 
727	out/target/product/generic_x86/system
The max is 750 MB.
make: *** [snod] Error 1

#### make failed to build some targets (1 seconds) ####

网上百度谷歌搜了很多,都说简单修改 BoardConfig.mk system执行的大小就可以,但我重新source lunch make snod 还是一样的结果。

最后通过阅读 /build/core/Makefile文件发现。makesnod 命令是通过/build/tools/releasetools/build_image.py
生成的。
这个命令在源码编译的环境下需要三个参数。
参数一:system目录(就是手机里面system目录里面所有的文件)
参数二: 一个配置文件system_image_info.txt 这个环境变量是根据源码的环境变量设置的
大概位置out/target/product/generic_x86/obj/PACKAGING/systemimage_intermediates/system_image_info.txt
参数三:指定需要生成的文件 我们这里是system.img

将build_image.py system_image_info.txt文件放在源码根目录

修改system_image_info.txt

fs_type=ext4
system_size=802897920   #这里可以改成你需要的system大小
userdata_size=576716800
cache_fs_type=ext4
cache_size=69206016
selinux_fc=out/target/product/generic_x86/root/file_contexts
skip_fsck=true

执行
python build_image.py out/target/product/generic_x86/system/ system_image_info.txt system.img

Running:  mkuserimg.sh out/target/product/generic_x86/system/ system.img ext4 system 802897920 out/target/product/generic_x86/root/file_contexts
make_ext4fs -T -1 -S out/target/product/generic_x86/root/file_contexts -l 802897920 -a system system.img out/target/product/generic_x86/system/
Creating filesystem with parameters:
    Size: 802897920
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8176
    Inode size: 256
    Journal blocks: 3062
    Label: 
    Blocks: 196020
    Block groups: 6
    Reserved block group size: 47
Created filesystem with 1462/49056 inodes and 130536/196020 blocks

成功。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值