Chinaunix首页 | 论坛 | 博客
  • 博客访问: 931118
  • 博文数量: 96
  • 博客积分: 10071
  • 博客等级: 上将
  • 技术积分: 1118
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-20 17:54
文章分类

全部博文(96)

文章存档

2011年(3)

2010年(3)

2009年(29)

2008年(54)

2007年(7)

分类: LINUX

2011-08-21 20:33:49

今天看了marvell的UBI 文件生成的规则,对那几个参数逐渐明白了。

LOCAL_PATH := $(call my-dir)

#Generate UBI FS image, currently only Linux Host is supported.
MKFS.UBIFS := $(HOST_OUT_EXECUTABLES)/mkfs.ubifs
UBINIZE := $(HOST_OUT_EXECUTABLES)/ubinize

SYSTEM_UBINIZE_CFG:=$(LOCAL_PATH)/system_ubinize.cfg
USERDATA_UBINIZE_CFG:=$(LOCAL_PATH)/userdata_ubinize.cfg
MASSSTORAGE_UBINIZE_CFG:=$(LOCAL_PATH)/internal_storage_ubinize.cfg

# "system" partition: begin=0x11800000 size=0x7680000 (118MB)
# size of PEB:0x40000 (256KB or 262144)
# size of LEB:0x3F000 (252KB or 258048)
# -m : 2KiB
# -e : 252KB
# -c : Number-of-PEB=0x7680000/0x40000=0x1da, 10 blocks are reserved for bad block handling, so
#                         Number-of-LEB=0x1da - 10=0x1d0(or 464)
# vol_size= Number-of-LEB * size-of-LEB=0x1d0 * 0x3F000 = 0x7230000 (or 119734272 bytes or 114.18MB)
# vol_size need to write to system_ubinize.cfg
file := $(PRODUCT_OUT)/system_ubifs.img
$(file): $(PRODUCT_OUT)/system.img | $(MKFS.UBIFS)
@echo "Target system ubifs image: $@"
@$(MKFS.UBIFS) -x lzo -m 2KiB -e 258048 -c 393 -o $@ -d $(PRODUCT_OUT)/system/ -F 

# -m
# -s
# -p
file := $(PRODUCT_OUT)/system_ubi.img
$(file): $(PRODUCT_OUT)/system_ubifs.img | $(UBINIZE)
@echo "Target system ubi partition image: $@"
@CWD=$$(pwd) && cd $(PRODUCT_OUT) && $${CWD}/$(UBINIZE) -o $${CWD}/$@ -m 2KiB -p 256KiB -s 2KiB $${CWD}/$(SYSTEM_UBINIZE_CFG)

droidcore: $(file)

# "userdata" partition: begin=0x8800000 size=0x22c00000 (556MB)
# size of PEB:0x40000 (256KB or 262144)
# size of LEB:0x3F000 (252KB or 258048)
# -m : 2 KiB
# -e : 252KB
# -c : Number-of-PEB=0x13800000/0x40000=0x4E0, 10 blocks are reserved for bad block handling, so
#                         Number-of-LEB=0x4E0 - 10 = 0x4D6 (or 1238) 
# vol_size= Number-of-LEB * size-of-LEB =0x4D6 * 0x3F000 =0x130AA000( 319463424 or 304.664MB)
# vol_size need to write to userdata_ubinize.cfg
file := $(PRODUCT_OUT)/userdata_ubifs.img
$(file): $(PRODUCT_OUT)/userdata.img | $(MKFS.UBIFS)
@echo "Target userdata ubifs image: $@"
@$(MKFS.UBIFS) -m 2KiB -e 258048 -c 2143 -o $@ -d $(PRODUCT_OUT)/data/ -F 

file := $(PRODUCT_OUT)/userdata_ubi.img
$(file): $(PRODUCT_OUT)/userdata_ubifs.img | $(UBINIZE)
@echo "Target userdata ubi partition image: $@"
@CWD=$$(pwd) && cd $(PRODUCT_OUT) && $${CWD}/$(UBINIZE) -o $${CWD}/$@ -m 2KiB -p 256KiB -s 2KiB $${CWD}/$(USERDATA_UBINIZE_CFG)

droidcore: $(file)

# "massstorage" partition: begin=0x1c000000 size=0x13800000 (312MB)
# size of PEB:0x40000 (256KB or 262144)
# size of LEB:0x3F000 (252KB or 258048)
# -m : 2 KiB
# -e : 252KB
# -c : Number-of-PEB=0x22c00000/0x40000=0x8B0, 10 blocks are reserved for bad block handling, so
#                         Number-of-LEB=0x8B0 - 10(A) = 0x8A6 (or 2214) 
# vol_size= Number-of-LEB * size-of-LEB =0x8A6 * 0x3F000 =0x220DA000( 571318272 or 544.851MB)
file := $(PRODUCT_OUT)/internal_storage_ubifs.img
$(file): $(PRODUCT_OUT)/system.img | $(MKFS.UBIFS)
@echo "Target massstorage ubifs image: $@"
@mkdir -p $(PRODUCT_OUT)/internal_storage
@dd if=/dev/zero of=android_internal.img bs=512 count=500000
@mkfs.vfat android_internal.img
@CWD=$$(pwd) && mv $${CWD}/android_internal.img $(PRODUCT_OUT)/internal_storage
@$(MKFS.UBIFS) -m 2KiB -e 258048 -c 1167 -o $@ -d $(PRODUCT_OUT)/internal_storage 

file := $(PRODUCT_OUT)/internal_storage_ubi.img
$(file): $(PRODUCT_OUT)/internal_storage_ubifs.img | $(UBINIZE)
@echo "Target massstorage ubi partition image: $@"
@CWD=$$(pwd) && cd $(PRODUCT_OUT) && $${CWD}/$(UBINIZE) -o $${CWD}/$@ -m 2KiB -p 256KiB -s 2KiB $${CWD}/$(MASSSTORAGE_UBINIZE_CFG)

droidcore: $(file)

阅读(2458) | 评论(0) | 转发(0) |
0

上一篇:UBI文件系统简介

下一篇:没有了

给主人留下些什么吧!~~