linux 编译system.img,android生成sysytem.img的命令过程
From
http://xianghuaclm.blog.163.com/blog/static/6668783201110221486240/
使用#file system.img
輸出:system.img: Linux rev 0.0 ext2 filesystem data,
UUID=4eb0489c-647d-49d8-9111-94657b5fd342, volume name
"system"。
然而本人使用命令#mkyaffs2image?system/?system.img,
再使用#file system.img,卻輸出:system.img: VMS Alpha executable
前一個(gè)system.img文件時(shí)可用的,而使用mkyaffs2image命令生成的system.img卻不能使用(將ramdisk.img,system.img,install.img等打包成iso文件,用virtualbox運(yùn)行)。
誰(shuí) 清楚android編譯系統(tǒng)是用什么命令生成system.img的?本人使用#make
systemimage命令,只顯示出如下信息:?Install system fs image:
out/target/product/eeepc/system.img
out/host/linux-x86/bin/acp -fpt
out/target/product/eeepc/obj/PACKAGING?/systemimage_unopt_intermediates/system.img
out/target/product/eeepc/system.img
true
沒(méi)能查到是哪個(gè)腳本生成的system.img
根據(jù)這個(gè)網(wǎng)址http://blog.csdn.net/liaoshengji
... /03/04/3957749.aspx,
1.執(zhí)行#make showcommands snod
2.得出android制作system.img命令為:
#!/bin/bash
export PATH="/home/tony/tmp/e2fsprogs-1.41.3/prefix/sbin:$PATH"
num_blocks=`du -sk out/target/product/eeepc/system | tail -n1 |
awk '{print $1;}'`
if [ $num_blocks -lt 20480 ]; then
extra_blocks=3072;
else
extra_blocks=20480;
fi
num_blocks=`expr $num_blocks + $extra_blocks`
num_inodes=`find out/target/product/eeepc/system | wc -l`
num_inodes=`expr $num_inodes + 500`
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
tune2fs -L system out/target/product/eeepc/system.img
tune2fs -C 1 out/target/product/eeepc/system.img
e2fsck -fy out/target/product/eeepc/system.img
一.android2.3系統(tǒng)的generic文件系統(tǒng)生成命令:
out/host/linux-x86/bin/mkyaffs2image -f?out/target/product/generic/system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
chmod a+r
out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
Install system fs image:
out/target/product/generic/system.img
out/host/linux-x86/bin/acp -fpt
out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
out/target/product/generic/system.img
true
out/host/linux-x86/bin/mkbootfs
out/target/product/generic/root | out/host/linux-x86/bin/minigzip
> out/target/product/generic/ramdisk.img
out/host/linux-x86/bin/mkyaffs2image -f?out/target/product/generic/data
out/target/product/generic/userdata.img
chmod a+r
out/target/product/generic/userdata.imgtrue
二.android2.2系統(tǒng)的MID文件系統(tǒng)生成命令:
file out/target/product/mid/system.img
out/target/product/mid/system.img: u-boot legacy uImage, Android,
Linux/ARM, Filesystem Image (any type) (Not compressed), 143233024
bytes, Tue Nov 22 10:48:07 2011, Load Address: 0x40008000, Entry
Point: 0x40008000, Header CRC: 0x6D462E1C, Data CRC: 0xE1876EFF
file sys.img
sys.img: Linux rev 1.0 ext3 filesystem data,
UUID=2c363e3e-f731-4800-9553-a0613a1264eb, volume name "system
dd if=system.img of=sys.img bs=64 skip=1
sudo mount -t ext3 -o loop sys.img mnt
修改
sudo umount mnt
./rcmkimage sys.img system.img(./mkimage -A arm -O linux -C none
-T filesystem -a 1 -e 1 -n "system.img" -d $1 $2)
make showcommands
Target system fs image:
out/target/product/mid/obj/PACKAGING/systemimage_unopt_intermediates/system.img
Target system fs image: ext2image
out/target/product/mid/system/framework
if [ -f
out/target/product/mid/system/framework/framework-res-TG.apk ];
then mv
out/target/product/mid/system/framework/framework-res-TG.apk
out/target/product/mid/system/framework/framework-res.apk; fi
num_blocks=`du -sk out/target/product/mid/system | tail -n1 | awk
'{print $1;}'`; if [ $num_blocks -lt 20480 ]; then
extra_blocks=3072; else extra_blocks=20480; fi ; num_blocks=`expr
$num_blocks + $extra_blocks` ; num_inodes=`find
out/target/product/mid/system | wc -l` ; num_inodes=`expr
$num_inodes + 500`;
out/host/linux-x86/bin/genext2fs -a
-d out/target/product/mid/system -b $num_blocks -N $num_inodes -m 0
out/target/product/mid/obj/PACKAGING/systemimage_unopt_intermediates/system.img
tune2fs -L system
out/target/product/mid/obj/PACKAGING/systemimage_unopt_intermediates/system.img
tune2fs 1.41.14 (22-Dec-2010)
tune2fs -C 1
out/target/product/mid/obj/PACKAGING/systemimage_unopt_intermediates/system.img
tune2fs 1.41.14 (22-Dec-2010)
Setting current mount count to 1
e2fsck -fy
out/target/product/mid/obj/PACKAGING/systemimage_unopt_intermediates/system.img
; [ $? -lt 4 ]e2fsck 1.41.14
(22-Dec-2010)
文件系統(tǒng) did not have a UUID; generating one.
第一步: 檢查inode,塊,和大小
第二步: 檢查目錄結(jié)構(gòu)
第3步: 檢查目錄連接性
/lost+found未找到.創(chuàng)建? 是
Pass 4: Checking reference counts
第5步: 檢查簇概要信息
system: ***** 文件系統(tǒng)已修改 *****
system: 648/1152 files (1.7% non-contiguous), 119292/139876
blocks
Install system fs image: out/target/product/mid/system.img
out/host/linux-x86/bin/acp -fpt
out/target/product/mid/obj/PACKAGING/systemimage_unopt_intermediates/system.img
out/target/product/mid/system.img
true
Generate system.img for iNAND
mv out/target/product/mid/system.img
out/target/product/mid/system.img.ext3
tune2fs -j
out/target/product/mid/system.img.ext3
tune2fs 1.41.14 (22-Dec-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.
out/host/linux-x86/bin/mkimage -A arm
-O linux -T filesystem -C
none?\
-a 40008000 -n "Android" -d out/target/product/mid/system.img.ext3
out/target/product/mid/system.imgImage
Name:?Android
Created:?Tue Nov 22 11:05:21 2011
Image Type:?ARM Linux
Filesystem Image (uncompressed)
Data Size:?143233024 Bytes = 139876.00 kB = 136.60 MB
Load Address: 40008000
Entry Point:?40008000
gzip -9
out/target/product/mid/system.img.ext3
out/host/linux-x86/bin/mkimage -A arm
-O linux -T filesystem -C
none?\
-a 40008000 -n "zAndroid" -d
out/target/product/mid/system.img.ext3.gz
out/target/product/mid/zSYS.img
Image Name:?zAndroid
Created:?Tue Nov 22 11:05:34 2011
Image Type:?ARM Linux
Filesystem Image (uncompressed)
Data Size:?80767125 Bytes = 78874.15 kB = 77.03 MB
Load Address: 40008000
Entry Point:?40008000
rm -f out/target/product/mid/system.img.ext3.gz
out/host/linux-x86/bin/mkbootfs out/target/product/mid/root |
out/host/linux-x86/bin/minigzip >
out/target/product/mid/ramdisk.img
mv out/target/product/mid/ramdisk.img
out/target/product/mid/ramdisk.img.ori
out/host/linux-x86/bin/mkimage -A arm -O linux -T ramdisk \
-C none -a 0x41000000 -n "hRamdisk" -d
out/target/product/mid/ramdisk.img.ori
out/target/product/mid/ramdisk.img
Image Name:?hRamdisk
Created:?Tue Nov 22 11:05:35 2011
Image Type:?ARM Linux RAMDisk
Image (uncompressed)
Data Size:?170001 Bytes = 166.02 kB = 0.16 MB
Load Address: 41000000
Entry Point:?41000000
Installed file list:
out/target/product/mid/installed-files.txt
build/tools/fileslist.py out/target/product/mid/system
out/target/product/mid/data >
out/target/product/mid/installed-files.txt
三.相關(guān)命令使用說(shuō)明:
genext2fs:
out/host/linux-x86/bin/genext2fs --help
Usage: out/host/linux-x86/bin/genext2fs [options] image
Create an ext2 filesystem image from directories/files
-x, --starting-image
-d, --root
-D, --devtable
-b, --size-in-blocks
-i, --bytes-per-inode
-N, --number-of-inodes
-m, --reserved-percentage
-g, --block-map
Generate a block map file for this path.
-e, --fill-value
Fill unallocated blocks with
value.
-z,
--allow-holes?Allow files with holes.
-f,
--faketime?Set filesystem timestamps to 0 (for testing).
-q,
--squash?Same as "-U -P".
-U,
--squash-uids?Squash owners making all files be owned by root.
-P,
--squash-perms?Squash permissions on all files.
-a,
--fix-android-stats?Fix-up file stats (user, perms, ...)
-h, --help
-V, --version
-v, --verbose
tune2fs :
tune2fs
tune2fs 1.41.14 (22-Dec-2010)
Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-g
group]
[-i interval[d|m|w]] [-j] [-J journal_options] [-l]
[-m reserved_blocks_percent] [-o [^]mount_options[,...]]
[-r reserved_blocks_count] [-u user] [-C mount_count] [-L
volume_label]
[-M last_mounted_dir] [-O [^]feature[,...]]
[-E extended-option[,...]] [-T last_check_time] [-U UUID]
[ -I new_inode_size ] device
一.簡(jiǎn)介:
調(diào)整/查看ext2/ext3文件系統(tǒng)的文件系統(tǒng)參數(shù),Windows下面如果出現(xiàn)意外斷電死機(jī)情況,下次開(kāi)機(jī)一般都會(huì)出現(xiàn)系統(tǒng)自檢。Linux系統(tǒng)下面也有文件系統(tǒng)自檢,而且是可以通過(guò)tune2fs命令,自行定義自檢周期及方式。
二.用法:
tune2fs [ -l ] [ -c max-mount-counts ] [ -e errors-behavior ] [
-f ] [ -i interval-between-checks ] [ -j ] [ -J journal-options ] [
-m
reserved-blocks-percentage ] [ -o [^]mount-options[,...] ] [ -r
reserved-blocks-count ] [ -s sparse-super-flag ] [ -u user ] [
-g
group ] [ -C mount-count ] [ -L volume-name ] [ -M
last-mounted-directory ] [ -O [^]feature[,...] ] [ -T
time-last-checked ] [ -U
UUID ] device
常用選項(xiàng)說(shuō)明:
-l 查看文件系統(tǒng)信息
-c max-mount-counts 設(shè)置強(qiáng)制自檢的掛載次數(shù),如果開(kāi)啟,每掛載一次mount
conut就會(huì)加1,超過(guò)次數(shù)就會(huì)強(qiáng)制自檢
-i interval-between-checks[d|m|w] 設(shè)置強(qiáng)制自檢的時(shí)間間隔[d天m月w周]
-m reserved-blocks-percentage 保留塊的百分比
-j 將ext2文件系統(tǒng)轉(zhuǎn)換為ext3類型的文件系統(tǒng)
-L volume-label 類似e2label的功能,可以修改文件系統(tǒng)的標(biāo)簽
-r reserved-blocks-count 調(diào)整系統(tǒng)保留空間
-o [^]mount-option[,...] Set or clear the indicated default mount
options in the filesystem. 設(shè)置或清除默認(rèn)掛載的文件系統(tǒng)選項(xiàng)
三.示例:
tune2fs -c 30 /dev/hda1 設(shè)置強(qiáng)制檢查前文件系統(tǒng)可以掛載的次數(shù)
tune2fs -c -l /dev/hda1 關(guān)閉強(qiáng)制檢查掛載次數(shù)限制。
tune2fs -i 10 /dev/hda1 10天后檢查
tune2fs -i 1d /dev/hda1 1天后檢查
tune2fs -i 3w /dev/hda1 3周后檢查
tune2fs -i 6m /dev/hda1 半年后檢查
tune2fs -i 0 /dev/hda1 禁用時(shí)間檢查
tune2fs -j /dev/hda1 添加日志功能,將ext2轉(zhuǎn)換成ext3文件系統(tǒng)
tune2fs -r 40000 /dev/hda1 調(diào)整/dev/hda1分區(qū)的保留空間為40000個(gè)磁盤塊
tune2fs -o acl,user_xattr /dev/hda1 設(shè)置/dev/hda1掛載選項(xiàng),啟用Posix
Access Control Lists和用戶指定的擴(kuò)展屬性
e2fsck :
e2fsck
Usage: e2fsck [-panyrcdfvtDFV] [-b superblock] [-B blocksize]
[-I inode_buffer_blocks] [-P process_inode_size]
[-l|-L bad_blocks_file] [-C fd] [-j external_journal]
[-E extended-options] device
Emergency help:
-p?Automatic repair (no questions)
-n?Make no changes to the filesystem
-y?Assume "yes" to all questions
-c?Check for bad blocks and add them to the badblock list
-f?Force checking even if filesystem is marked clean
-v?Be verbose
-b
superblock?Use alternative superblock
-B
blocksize?Force blocksize when looking for superblock
-j external_journal?Set
location of the external journal
-l
bad_blocks_file?Add to
badblocks list
-L
bad_blocks_file?Set badblocks
list
e2fsck(ext2
file system
check)
功能說(shuō)明:檢查ext2文件系統(tǒng)的正確性。
語(yǔ)法:e2fsck [-acCdfFnprsStvVy][-b
<
href="http://www.linuxso.com/command/su.html">superblock>][-B
][-l ][-L ][設(shè)備名稱]
補(bǔ)充說(shuō)明:e2fsck執(zhí)行后的傳回值及代表意義如下。
0?沒(méi)有任何錯(cuò)誤發(fā)生。
1?文件系統(tǒng)發(fā)生錯(cuò)誤,并且已經(jīng)修正。
2?文件系統(tǒng)發(fā)生錯(cuò)誤,并且已經(jīng)修正。
4?文件系統(tǒng)發(fā)生錯(cuò)誤,但沒(méi)有修正。
8?運(yùn)作時(shí)發(fā)生錯(cuò)誤。
16?使用的語(yǔ)法發(fā)生錯(cuò)誤。
128?共享的函數(shù)庫(kù)發(fā)生錯(cuò)誤。
參數(shù):
-a?不詢問(wèn)使用者意見(jiàn),便自動(dòng)修復(fù)文件系統(tǒng)。
-b?指定superblock,而不使用預(yù)設(shè)的superblock。
-B?指定區(qū)塊的大小,單位為字節(jié)。
-c?一并執(zhí)行badblocks,以標(biāo)示損壞的區(qū)塊。
-C?將檢查過(guò)程的信息完整記錄在file
descriptor中,使得整個(gè)檢查過(guò)程都能完整監(jiān)控。
-d?顯示排錯(cuò)信息。
-f?即使文件系統(tǒng)沒(méi)有錯(cuò)誤跡象,仍強(qiáng)制地檢查正確性。
-F?執(zhí)行前先清除設(shè)備的緩沖區(qū)。
-l?將文件中指定的區(qū)塊加到損壞區(qū)塊列表。
-L?先清除損壞區(qū)塊列表,再將文件中指定的區(qū)塊加到損壞區(qū)塊列表。因此損壞區(qū)塊列表的區(qū)塊跟文件中指定的區(qū)塊是一樣的。
-n?以只讀模式開(kāi)啟文件系統(tǒng),并采取非互動(dòng)方式執(zhí)行,所有的問(wèn)題對(duì)話均設(shè)置以"no"回答。
-p?不詢問(wèn)使用者意見(jiàn),便自動(dòng)修復(fù)文件系統(tǒng)。
-r?此參數(shù)只為了兼容性而存在,并無(wú)實(shí)際作用。
-s?如果文件系統(tǒng)的字節(jié)順序不適當(dāng),就交換字節(jié)順序,否則不做任何動(dòng)作。
-S?不管文件系統(tǒng)的字節(jié)順序,一律交換字節(jié)順序。
-t?顯示時(shí)間信息。
-v?執(zhí)行時(shí)顯示詳細(xì)的信息。
-V?顯示版本信息。
-y?采取非互動(dòng)方式執(zhí)行,所有的問(wèn)題均設(shè)置以"yes"回答。
acp :
out/host/linux-x86/bin/acp -?
out/host/linux-x86/bin/acp: invalid option -- '?'
Unexpected arg -?
Usage: acp [OPTION]... SOURCE DEST
or:?acp [OPTION]... SOURCE...
DIRECTORY
Options:
-d?never follow (dereference)
symbolic links
-e?if source file doesn't
exist, try adding '.exe' [Win32 only]
-f?use force, removing
existing file if it's not writeable
-p?preserve mode,
ownership
-r?recursive copy
-t?preserve timestamps
-u?update only: don't copy if
dest is newer
-v?verbose output (-vv is more
verbose)
mkimage --help
Usage: mkimage -l image
-l ==> list image header information
mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d
data_file[:data_file...] image
-A ==> set architecture to 'arch'
-O ==> set operating system to 'os'
-T ==> set image type to 'type'
-C ==> set compression type 'comp'
-a ==> set load address to 'addr' (hex)
-e ==> set entry point to 'ep' (hex)
-n ==> set image name to 'name'
-d ==> use image data from 'datafile'
-x ==> set XIP (execute in place)
mkimage [-D dtc_options] -f fit-image.its fit-image
總結(jié)
以上是生活随笔為你收集整理的linux 编译system.img,android生成sysytem.img的命令过程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: linux 卸载 openldap,Li
- 下一篇: exfat单元分配要设置多少_微软宣布,