KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
fs_romdisk.h File Reference

ROMFS virtual file system. More...

#include <sys/cdefs.h>
#include <arch/types.h>
#include <kos/fs.h>

Go to the source code of this file.

Functions

int fs_romdisk_mount (const char *mountpoint, const uint8 *img, int own_buffer)
 Mount a ROMFS image as a new filesystem.
 
int fs_romdisk_unmount (const char *mountpoint)
 Unmount a ROMFS image.
 

Detailed Description

ROMFS virtual file system.

This file contains support for the romdisk VFS. This VFS allows you to make Linux-style ROMFS images and either embed them into your binary or load them at runtime from some other source (such as a CD-ROM). These images are made with the genromfs program that is included in the utils portion of the tree.

You can choose to automount one ROMFS image by embedding it into your binary and using the appropriate flags (INIT_DEFAULT by itself or INIT_FS_ROMDISK with other flags) when calling the KOS_INIT_FLAGS() macro with a custom flag selection. The embedded ROMFS will mount itself on /rd.

Warning
An embedded romdisk image is linked to your executable and cannot be evicted from system RAM!

Mounting additional images that you load from some other sources (such as a modified BIOS) on whatever mountpoint you want, is also possible. Using fs_romdisk_mount() and passing a pointer to the location of a romdisk image will mount it.

Remarks
Mounted images will reside in system RAM for as long as your program is running or until you unmount them with fs_romdisk_unmount(). The size of your generated ROMFS image must be kept below 16MB, with 14MB being the maximum recommended size, as your binary will also reside in RAM and you need to leave some memory available for it. Generating files larger than the available RAM will lead to system crashes.

A romdisk filesystem image can be created by adding "KOS_ROMDISK_DIR=" to your Makefile and pointing it to the directory contaning all the resources you wish to have embeded in filesystem image. A rule to create the image is provided in the rules provided in Makefile.rules, the created object file must be linked with your binary file by adding romdisk.o to your list of objects.

See also
INIT_FS_ROMDISK
KOS_INIT_FLAGS()
Author
Megan Potter