现在的位置: 首页 > 综合 > 正文

手工打包system.img

2013年12月07日 ⁄ 综合 ⁄ 共 3777字 ⁄ 字号 评论关闭

手工打包system.img
out/host/linux-x86/bin下有一些有用的host工具,可以添加它到环境变量:export PATH=$PATH:~/Project/android/out/host/linux-x86/bin , L' ~9 p# @9 a, r  o
其中就有我们打包要用到的mkyaffs2img
+ T9 G6 I9 p. H3 F1 v8 q# R4 g8 l
$ h! s7 m1 G. P9 |& ~ mkyaffs2img 可以用来手工打包emulator用到的img镜像。比如我们需要额外在system中添加一些组件的时候,直接将组件拷贝到system目录中,再执行
; d4 ~, e, ?) ]9 h mkyaffs2img system system.img
$ B! ?: /) v% K2 T: }2 P3 q 就会生成带你需要组件的system.img文件。

           先在android目录下执行
           $ . build/envsetup.sh
           然后你就会多出几个可用的命令。在改了Contacts联系人项目后,可以简单的执行一下命令来单独编译这个部分:
           $mmm packages/apps/Contacts/
          为了可以直接测试改动,需要生成新的system.img,在android目录下执行:
           $ make snod
          当然,如果你改动的是emulator或者其它外围相关的,而非系统内部的东西,就不只是要重新生成system.img了

1.执行#make showcommands snod
# w/ X8 C6 ~3 m- T, f* ~0 k5 @ 2.得出 android制作system.img命令为: - Q& x1 B( N7 v! /
  #!/bin/bash
4 M4 `/ l0 p' l& O( _# v; t export PATH="/home/tony/tmp/e2fsprogs-1.41.3/prefix/sbin/:$PATH" ; {, L7 x' X/ s( g
) p! i- i& p7 G+ s& k' N4 q
num_blocks=`du -sk out/target/product/eeepc/system | tail -n1 | awk '{print $1;}'`
2 K" j/ /- V- @2 j# z  G0 g if [ $num_blocks -lt 20480 ]; then
) N2 @' U+ [5 v* T: j         extra_blocks=3072;
/ q6 [' N" d( N; f# m% ]+ H0 e% K2 S else
7 b; e0 h+ S5 R7 M  R         extra_blocks=20480;
0 ]' L* /9 x2 O* v+ q; [: Q6 [ fi # z3 q7 N/ t$ e; h0 g. ~
num_blocks=`expr $num_blocks + $extra_blocks`
3 J$ d+ N0 T# K5 R! J0 v" o( A0 { num_inodes=`find out/target/product/eeepc/system | wc -l`
8 r/ v# o. a6 t5 ]0 X$ A2 K$ P; w num_inodes=`expr $num_inodes + 500` 6 f% v( K- L- A* h# R
out/host/linux-x86/bin/genext2fs -a -d out/target/product/eeepc/system -b $num_blocks -N $num_inodes -m 0 out/target/product/eeepc/system.img
% G- z0 w# Q! ~1 m1 p 3 L2 V3 u/ y7 /9 ^: C
tune2fs -L system out/target/product/eeepc/system.img
7 ^2 E# i7 z! i- `' ~ tune2fs -C 1 out/target/product/eeepc/system.img
. Y# F% A! ?& q4 B' X e2fsck -fy out/target/product/eeepc/system.img

我这里的打印信息

$ make showcommands snod
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.1
TARGET_PRODUCT=imx51_BBG
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ERD79
============================================
build/core/copy_headers.mk:15: 警告:覆盖关于目标“out/target/product/imx51_BBG/obj/include/libpv/getactualaacconfig.h”的命令
build/core/copy_headers.mk:15: 警告:忽略关于目标“out/target/product/imx51_BBG/obj/include/libpv/getactualaacconfig.h”的旧命令
/bin/bash: line 0: cd: sdk/layoutopt/app/src/resources: 没有那个文件或目录
No private recovery resources for TARGET_DEVICE imx51_BBG
Install: out/host/linux-x86/bin/genext2fs
out/host/linux-x86/bin/acp -fpt out/host/linux-x86/obj/EXECUTABLES/genext2fs_intermediates/genext2fs out/host/linux-x86/bin/genext2fs
make snod: ignoring dependencies
Target system fs image: out/target/product/imx51_BBG/system.img
num_blocks=`du -sk out/target/product/imx51_BBG/system | tail -n1 | awk '{print $1;}'`; if [ $num_blocks -lt 20480 ]; then extra_blocks=3072; else extra_blocks=20480; fi ; if [ "" != "" ]; then num_blocks=; num_inodes=4096; else num_blocks=`expr $num_blocks + $extra_blocks` ; num_inodes=`find out/target/product/imx51_BBG/system | wc -l` ; num_inodes=`expr $num_inodes + 500`; fi; out/host/linux-x86/bin/genext2fs -a -d out/target/product/imx51_BBG/system -b $num_blocks -N $num_inodes -m 0 out/target/product/imx51_BBG/system.img;
tune2fs -L system out/target/product/imx51_BBG/system.img
tune2fs 1.41.11 (14-Mar-2010)
tune2fs -j out/target/product/imx51_BBG/system.img
tune2fs 1.41.11 (14-Mar-2010)
Creating journal inode: 完成
This filesystem will be automatically checked every 20 mounts or
0 days, whichever comes first.  Use tune2fs -c or -i to override.
tune2fs -C 1 out/target/product/imx51_BBG/system.img
tune2fs 1.41.11 (14-Mar-2010)
Setting current mount count to 1
e2fsck -fy out/target/product/imx51_BBG/system.img ; [ $? -lt 4 ]
e2fsck 1.41.11 (14-Mar-2010)
文件系统 did not have a UUID; generating one.

文件系统 has feature flag(s) set, but is a revision 0 文件系统.  处理? 是

第一步: 检查inode,块,和大小
第二步: 检查目录结构
第3步: 检查目录连接性
/lost+found未找到.创建? 是

Pass 4: Checking reference counts
第5步: 检查簇概要信息

system: ***** 文件系统已修改 *****
system: 521/1056 files (1.3% non-contiguous), 80423/96976 blocks
true

 

抱歉!评论已关闭.