View previous topic :: View next topic |
Author |
Message |
misfire
Joined: 06 Sep 2004 Posts: 120 Location: Germany
|
Posted: Thu Jul 16, 2009 3:56 am Post subject: ROMDIR filesystem in userspace |
|
|
Here's romdirfs - my first attempt at writing a userspace filesystem.
From the README:
Code: | ---===========---
About romdirfs
---==============---
romdirfs was mainly developed because I was interested in the technology behind
FUSE (Filesystem in Userspace) and wanted to implement a simple FS on my own.
(With the FUSE interface, you can easily export a virtual FS to the Linux
kernel without root privileges.)
romdirfs makes it possible to mount the ROMDIR "filesystem" which can be found
in PS2 IOPRP images and BIOS dumps to a directory, thereby mapping the included
IOP modules to actual files. The filesystem is read-only.
---==---
Build
---=====---
To compile romdirfs, you need the following Debian packages:
- cmake >= 2.6
- gcc
- fuse-utils
- libfuse-dev >= 2.6
I recommend doing an out-of-source build:
$ mkdir build
$ cd build
$ cmake ..
$ make
To install romdirfs:
# make install
---==---
Usage
---=====---
usage: romdirfs <file> <mountpoint> [options]
<file> must be a PS2 IOPRP image or BIOS dump
ROMDIRFS options:
-V, --version print version
-h, --help print help
-D, -o romdirfs_debug print some debugging information
You can get the complete option list with -h.
To unmount the filesystem:
fusermount -u <mountpoint>
---=====--
Samples
---=======---
1) Mounting a PS2 IOPRP image
$ mkdir /tmp/romdir
$ romdirfs ioprp15.img /tmp/romdir/
$ mount | grep romdirfs
romdirfs on /tmp/romdir type fuse.romdirfs (rw,nosuid,nodev,user=misfire)
$ ls -l /tmp/romdir/
total 0
-r--r--r-- 1 root root 28533 1970-01-01 01:00 CDVDFSV
-r--r--r-- 1 root root 35317 1970-01-01 01:00 CDVDMAN
-r--r--r-- 1 root root 208 1970-01-01 01:00 EXTINFO
-r--r--r-- 1 root root 9085 1970-01-01 01:00 FILEIO
-r--r--r-- 1 root root 0 1970-01-01 01:00 RESET
-r--r--r-- 1 root root 128 1970-01-01 01:00 ROMDIR
-r--r--r-- 1 root root 9441 1970-01-01 01:00 SIFCMD
$ hd /tmp/romdir/ROMDIR
00000000 52 45 53 45 54 00 00 00 00 00 08 00 00 00 00 00 |RESET...........|
00000010 52 4f 4d 44 49 52 00 00 00 00 44 00 80 00 00 00 |ROMDIR....D.....|
00000020 45 58 54 49 4e 46 4f 00 00 00 00 00 d0 00 00 00 |EXTINFO.........|
00000030 53 49 46 43 4d 44 00 00 00 00 28 00 e1 24 00 00 |SIFCMD....(..$..|
00000040 46 49 4c 45 49 4f 00 00 00 00 20 00 7d 23 00 00 |FILEIO.... .}#..|
00000050 43 44 56 44 4d 41 4e 00 00 00 1c 00 f5 89 00 00 |CDVDMAN.........|
00000060 43 44 56 44 46 53 56 00 00 00 20 00 75 6f 00 00 |CDVDFSV... .uo..|
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000080
$ fusermount -u /tmp/romdir/
2) Mounting a PS2 BIOS dump
$ romdirfs SCPH-30004R_BIOS_V4_PAL_160.BIN /tmp/romdir/
$ ls /tmp/romdir/
ADDDRV EXTINFO IOPBOOT MODLOAD ROMDRV SYSMEM VBLANK
ATAD FILEIO IOPBTCON2 OSDCNF ROMVER TBIN VERSTR
CDVDFSV FNTIMAGE IOPBTCONF OSDSND SBIN TESTMODE XCDVDFSV
CDVDMAN FONTM KERNEL OSDSYS SECRMAN TESTSPU XCDVDMAN
CLEARSPU HDDLOAD KROM PADMAN SIFCMD TEXIMAGE XFILEIO
DMACMAN HDDOSD KROMG PS1DRV SIFINIT THREADMAN XLOADFILE
EECONF HEAPLIB LIBSD PS2LOGO SIFMAN TIMEMANI XMCMAN
EELOAD ICOIMAGE LOADCORE RDRAM SIO2MAN TIMEMANP XMCSERV
EELOADCNF IGREETING LOADFILE REBOOT SNDIMAGE TPADMAN XMTAPMAN
EENULL INTRMANI LOGO RESET SSBUSC TSIO2MAN XPADMAN
EESYNC INTRMANP MCMAN RMRESET STDIO TZLIST XSIFCMD
EXCEPMAN IOMAN MCSERV ROMDIR SYSCLIB UDNL XSIO2MAN
$ cat /tmp/romdir/ROMVER
0160EC20010704
$ fusermount -u /tmp/romdir/ |
romdirfs-1.0.tar.gz |
|
Back to top |
|
|
yoshi314
Joined: 26 Jul 2008 Posts: 36
|
Posted: Sun Aug 09, 2009 6:45 pm Post subject: |
|
|
looks cool, i'll give it a shot. |
|
Back to top |
|
|
misfire
Joined: 06 Sep 2004 Posts: 120 Location: Germany
|
Posted: Mon Aug 10, 2009 7:53 pm Post subject: |
|
|
Cool, the first user. :) |
|
Back to top |
|
|
yownas
Joined: 12 Aug 2009 Posts: 4
|
Posted: Thu Aug 13, 2009 6:45 pm Post subject: |
|
|
I tried it the other day. It worked great. :) |
|
Back to top |
|
|
yownas
Joined: 12 Aug 2009 Posts: 4
|
Posted: Sat Aug 22, 2009 1:10 am Post subject: |
|
|
I added some basic write-support for romdirfs.
Notes:
* EXTINFO is ignored for all files and lost if any file is updated.
* The content of ROMDIR isn't updated until you remount the file system.
* Appending to files is not supported. But most commands such as cp, mv, editing and overwriting files should work.
* Unlinked (deleted) files will be removed from memory even if it is still open. Accessing a removed file will probably result in a segfault.
* The order of the files written to the romdirfile isn't controlled in any way. Removing RESET or ROMDIR will probably result in a messed up romdirfile.
If you still wan't to test it the source could be found here:
romdirfs-1.1.tar.gz |
|
Back to top |
|
|
misfire
Joined: 06 Sep 2004 Posts: 120 Location: Germany
|
Posted: Mon Aug 24, 2009 11:18 pm Post subject: |
|
|
Ah, cool. :)
I updated romdirfs too and added some EXTINFO (read) support.
Originally, I also thought about write support but I've actually never felt the need for it. Although I don't know if things like EXTINFO, file order etc. actually matter to the IOP image loader, I guess that proper write support is really hard to accomplish with a virtual FS. A simple user-space tool would do a better job.
Anyway, good work. Interesting to see how writing can be done. |
|
Back to top |
|
|
misfire
Joined: 06 Sep 2004 Posts: 120 Location: Germany
|
Posted: Tue Aug 25, 2009 7:24 pm Post subject: |
|
|
Here is my new version: romdirfs-1.1.tar.gz
Code: | 1.1 (Aug 25 2009)
- Read whole input file into memory rather than reading each module's data.
- Define -DUSE_MMAP to map the input file into memory with mmap().
- Add EXTINFO information to romfile_t struct. |
Unfortunately, it's now more a read-only filesystem than before. |
|
Back to top |
|
|
misfire
Joined: 06 Sep 2004 Posts: 120 Location: Germany
|
|
Back to top |
|
|
|