日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux 编译system.img,android生成sysytem.img的命令过程

發布時間:2025/3/11 linux 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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

前一個system.img文件時可用的,而使用mkyaffs2image命令生成的system.img卻不能使用(將ramdisk.img,system.img,install.img等打包成iso文件,用virtualbox運行)。

誰 清楚android編譯系統是用什么命令生成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

沒能查到是哪個腳本生成的system.img

根據這個網址http://blog.csdn.net/liaoshengji

... /03/04/3957749.aspx,

1.執行#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系統的generic文件系統生成命令:

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系統的MID文件系統生成命令:

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)

文件系統 did not have a UUID; generating one.

第一步: 檢查inode,塊,和大小

第二步: 檢查目錄結構

第3步: 檢查目錄連接性

/lost+found未找到.創建? 是

Pass 4: Checking reference counts

第5步: 檢查簇概要信息

system: ***** 文件系統已修改 *****

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

三.相關命令使用說明:

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

一.簡介:

調整/查看ext2/ext3文件系統的文件系統參數,Windows下面如果出現意外斷電死機情況,下次開機一般都會出現系統自檢。Linux系統下面也有文件系統自檢,而且是可以通過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

常用選項說明:

-l 查看文件系統信息

-c max-mount-counts 設置強制自檢的掛載次數,如果開啟,每掛載一次mount

conut就會加1,超過次數就會強制自檢

-i interval-between-checks[d|m|w] 設置強制自檢的時間間隔[d天m月w周]

-m reserved-blocks-percentage 保留塊的百分比

-j 將ext2文件系統轉換為ext3類型的文件系統

-L volume-label 類似e2label的功能,可以修改文件系統的標簽

-r reserved-blocks-count 調整系統保留空間

-o [^]mount-option[,...] Set or clear the indicated default mount

options in the filesystem. 設置或清除默認掛載的文件系統選項

三.示例:

tune2fs -c 30 /dev/hda1 設置強制檢查前文件系統可以掛載的次數

tune2fs -c -l /dev/hda1 關閉強制檢查掛載次數限制。

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 禁用時間檢查

tune2fs -j /dev/hda1 添加日志功能,將ext2轉換成ext3文件系統

tune2fs -r 40000 /dev/hda1 調整/dev/hda1分區的保留空間為40000個磁盤塊

tune2fs -o acl,user_xattr /dev/hda1 設置/dev/hda1掛載選項,啟用Posix

Access Control Lists和用戶指定的擴展屬性

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)

功能說明:檢查ext2文件系統的正確性。

語法:e2fsck [-acCdfFnprsStvVy][-b

<

href="http://www.linuxso.com/command/su.html">superblock>][-B

][-l ][-L ][設備名稱]

補充說明:e2fsck執行后的傳回值及代表意義如下。

0?沒有任何錯誤發生。

1?文件系統發生錯誤,并且已經修正。

2?文件系統發生錯誤,并且已經修正。

4?文件系統發生錯誤,但沒有修正。

8?運作時發生錯誤。

16?使用的語法發生錯誤。

128?共享的函數庫發生錯誤。

參數:

-a?不詢問使用者意見,便自動修復文件系統。

-b?指定superblock,而不使用預設的superblock。

-B?指定區塊的大小,單位為字節。

-c?一并執行badblocks,以標示損壞的區塊。

-C?將檢查過程的信息完整記錄在file

descriptor中,使得整個檢查過程都能完整監控。

-d?顯示排錯信息。

-f?即使文件系統沒有錯誤跡象,仍強制地檢查正確性。

-F?執行前先清除設備的緩沖區。

-l?將文件中指定的區塊加到損壞區塊列表。

-L?先清除損壞區塊列表,再將文件中指定的區塊加到損壞區塊列表。因此損壞區塊列表的區塊跟文件中指定的區塊是一樣的。

-n?以只讀模式開啟文件系統,并采取非互動方式執行,所有的問題對話均設置以"no"回答。

-p?不詢問使用者意見,便自動修復文件系統。

-r?此參數只為了兼容性而存在,并無實際作用。

-s?如果文件系統的字節順序不適當,就交換字節順序,否則不做任何動作。

-S?不管文件系統的字節順序,一律交換字節順序。

-t?顯示時間信息。

-v?執行時顯示詳細的信息。

-V?顯示版本信息。

-y?采取非互動方式執行,所有的問題均設置以"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

總結

以上是生活随笔為你收集整理的linux 编译system.img,android生成sysytem.img的命令过程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。