gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS Misc > romdiskfs filesystem for the DS

#62780 - GPFerror - Mon Dec 05, 2005 6:43 pm

--------------------------------------------------------------------------------
This DS library implementation the Linux ROMFS file system for reading a pre-made boot romdisk.

To create a romdisk image, you will need the program "genromfs". This program was designed for Linux but can compile under Cygwin.", included is a prebuilt mingw windows binary.

This was derived/ported from KOS 1.3.x from the Dreamcast KallistiOS .

included is a simple FS test which demonstrates reading a couple of files from the romdisk, and then it displays the directory structure.

for more information about using the filesystem checkout the fs.h file for the proper api calls, which are all very similiar to standard stdio calls.

Code:
file_t   fs_open(const char *fn, int mode);
void   fs_close(file_t hnd);
ssize_t   fs_read(file_t hnd, void *buffer, size_t cnt);
ssize_t   fs_write(file_t hnd, const void *buffer, size_t cnt);
off_t   fs_seek(file_t hnd, off_t offset, int whence);
off_t   fs_tell(file_t hnd);
size_t   fs_total(file_t hnd);
dirent_t* fs_readdir(file_t hnd);
int   fs_ioctl(file_t hnd, void *data, size_t size);
int   fs_rename(const char *fn1, const char *fn2);
int   fs_unlink(const char *fn);
int   fs_chdir(const char *fn);
void*   fs_mmap(file_t hnd);
int   fs_complete(file_t fd, ssize_t * rv);
int   fs_stat(const char * fn, stat_t * rv);
int   fs_mkdir(const char * fn);
int   fs_rmdir(const char * fn);
file_t   fs_dup(file_t oldfd);
file_t   fs_dup2(file_t oldfd, file_t newfd);


Also include is some stdio newlib files(stdio.c and stdio.h) that call the kosFS for better stdio support but so far I havent figure out how to make them work successfully yet.

Enjoy :)
Troy Davis(GPF)
http://gpf.dcemu.co.uk/ndsromdisk.shtml


Last edited by GPFerror on Wed Dec 07, 2005 3:45 pm; edited 1 time in total

#62792 - MaHe - Mon Dec 05, 2005 7:34 pm

Hmmm, so this means you make this RomDisk 512Mbits big and put it on, let's say, X-ROM and then install FAT on it?

#62795 - GPFerror - Mon Dec 05, 2005 8:01 pm

iv only tested it within the 4 megs of memory for the ds, its basically a gbfs like library that has some stdio like accessor functions. Shouldnt be to hard to port to work with other FS probably as well. Iv released the source code if anyones interested.

Troy(GPF)
http://gpf.dcemu.co.uk