File System inside of memory
Posted: Mon Aug 31, 2015 7:26 pm
I'm working on a simple kernel that runs at ARM CM3 and x86.
I'm looking for a simple way to implement my Virtual File System without need implement disk driver before.
One of those ways is create a simple File System inside of memory.
I've seen a lot of methods to do this with grub using modules (initrd) but with arm architecture will not work in the same way.
I found one method for standardize this function, but I don't know if this is a good practice or if this way can get me in trouble in the future.
Below has steps:
** Convert file to object file using LD **
** Linking result object file with kernel **
Map file result is:
And can access content of file using link file constants
I'm looking for a simple way to implement my Virtual File System without need implement disk driver before.
One of those ways is create a simple File System inside of memory.
I've seen a lot of methods to do this with grub using modules (initrd) but with arm architecture will not work in the same way.
I found one method for standardize this function, but I don't know if this is a good practice or if this way can get me in trouble in the future.
Below has steps:
** Convert file to object file using LD **
Code: Select all
i686-elf-ld -r -b binary -o fs.o fs.img
Map file result is:
Code: Select all
0x1000000c _binary_initrd_main_start
0x10002207 _binary_initrd_main_end
Code: Select all
extern char _binary_initrd_main_start;
extern char _binary_initrd_main_end;
main()
{
char* p = &_binary_initrd_main_start;
while ( p != &_binary_initrd_main_end ) putchar(*p++);
}