顯示具有 file system 標籤的文章。 顯示所有文章
顯示具有 file system 標籤的文章。 顯示所有文章

2009年2月17日 星期二

Embedded FAT implementations

並不是所有的embedded system都具有良好的file system support, 在此方面使用FAT 還是相當普遍. 而使用FAT的原因相當簡單, 因為FAT 沒有複雜的設計, 降低實做的code size, 多數3C產品與一般OS屬於預設的支援.

目前屬於Open Source FAT implementation有下
ELM - FAT File System Module
具有相當不錯的介面設計, 很接近一般VFS的介面
具有格式化功能, 算是相當完整的實做
並無明顯的授權聲明, 在source 中的 readme.txt 聲明自負風險下不限制使用於任何用途

EFSL - Embedded File System Library
有相當完整的文件說明
授權: LGPL

libfat
授權: GPL

dosfs
source中的readme.txt 聲明自負風險下不限制使用於任何用途.

2009年2月15日 星期日

Prex - FAT32

原本是打算將ELM FAT implementation移植到Prex上
然而因為Prex的Embedded VFS設計的緣故(該設計相當接近於VFS in Sun Unix),
若採用整合ELM FAT的方式需要相當的時間
而其中原因在於資料結構上的考量
因此就改為直接修改Prex本身具有的FAT 12/16以支援FAT32
如此還能針對FAT深入瞭解

而經過數日的奮戰
目前Prex 已經能夠操作 FAT32 檔案系統
也簡短地測試過, 檔案/目錄的新增移除是正常的
尚未支援用以輔助配置free block的 FSINFO以及長檔名的LFN(Long File Name)
有機會再把實做補上
由於處理FAT32的緣故, 研讀了些關於FS的相關資料
而先前所提到的書 File System Forensic Analysis 也幫助不少
另外下列資訊也有相當得助益

boot log如下:
Prex version 0.8.1 for arm-at2440ii (Feb 12 2009)
Free pages:
start end size
-------- -------- --------
00000000 - 00010000 64K
00033800 - 01c27000 28622K
01c39c00 - 04000000 36633K
used=142K free=65319K total=65461K
Time slice is 50 msec
IRQ10 attached priority=10
Clock rate: 1000 ticks/sec
Prex driver module built: Feb 12 2009
Calibrating delay loop... ok count=837
Initializing NULL device
Initializing Power Management
pm: Default power policy is performance mode
Initializing Zero device
Initializing Serial Console
UBRDIV0:0x23
IRQ28 attached priority=1
Initializing RAM disk
RAM disk at 0x01c270e0 (74K bytes)
Initializing SD card
Init. SD Freq. is 401256Hz

In idle
MMC check end!!

In SD ready

End id
RCA=0x9ffc
SD Frequency is 33304320Hz

In stand-by

****4bit bus****
SD disk
IRQ21 attached priority=2
Initializing TTY device
Driver initialized
Loading task:'boot'
Loading task:'proc'
Loading task:'fs'
Loading task:'exec'
Starting Bootstrap Server
Starting Process Server
Starting File System Server
Starting Exec Server
boot: Mounting file systems
VFS: Mounting ramfs dev= dir=/
VFS: Mounting devfs dev= dir=/dev
VFS: Mounting arfs dev=/dev/ram0 dir=/boot
VFS: Mounting fifofs dev= dir=/fifo
VFS: Mounting fatfs dev=/dev/card0 dir=/mnt/floppy
fatfs_mount device=/dev/card0
0 1 1 0 b 1f fd f7 3d 0 0 0 c3 42 1e 0
fatfs partition at sect: 3d
----- FAT 12/16/32 info ----- 3c673
drive:80
total_sectors:1983170
heads :32
serial :49984554
cluster size:8 sectors
fat_start :5d
root_start :2
data_start :f77
fat_type :FAT32
fat_eof :0xfffffff

boot: Run init process
Prex version 0.8.1 (arm-at2440ii)
[prex:/]# cat /mnt/floppy/champ.txt
fatfs_lookup: name=champ.txt
fat_lookup_denode: cl=0 name=champ.txt
fat_lookup_dirent: Ac
fat_lookup_dirent: found sec=3959
fatfs_lookup: cl=4
fatfs_read: vp=38e3c
Hello World!
fatfs_read: vp=38e3c
[prex:/]#

2009年2月11日 星期三

File System Forensic Analysis




目前個人正嘗試修改Prex上的FAT 12/16實做, 以便支援FAT 32. 過程中, 很令我很訝異的, 儘管FAT廣為人知,良好解釋FAT的文件卻付之闕如. 雖然, FAT 相關實做已經非常的多, 網路上相關的訊息卻非常零散且難以消化, 缺乏有系統和概念性的完整資訊.

File System在各種實際應用系統中, 都扮演著舉足輕重的角色. 從系統效能, 到基本的資料保存, 都與File System 息息相關. 然而很可惜的, 對於File System而言, 許多人的印象似乎只是附屬的存在, 常常容易被忽略.

那麼非得下去好好trace code才能獲得相關知識? 對於File System有興趣研究的人該怎麼下手?對此File System Forensic Analysis是關於FS相當不錯的參考書目, 該書除了提供目前主流各式File System的說明外, 也提供了相關的基本知識, 在章節的規劃與內文的易讀性, 都相當不錯. 目前市面上專注於此方面的書並不多, 而部份甚至已經顯得過時. 對FS有興趣者, 相當建議購買一本來閱讀.儘管許多進階的檔案系統(ex: ext4, xfs, zfs) 沒有納入介紹, 然而書的內容對於瞭解這些FS的設計與規劃也有相當的助益.

在 ARM 平台上使用 Function Multi-Versioning (FMV) - 以使用 Android NDK 為例

Function Multi-Versioning (FMV) 過往的 CPU 發展歷程中, x86 平台由於因應各種應用需求的提出, 而陸陸續續加入了不同的指令集, 此外也可能因為針對市場做等級區隔, 支援的數量與種類也不等. 在 Linux 平台上這些 CPU 資訊可以透過...