OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 9:55 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: The Simple File System
PostPosted: Mon Sep 18, 2017 12:14 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
Brendan wrote:
...everywhere it says "media" it should say "volume" (e.g. for the volume identifier, it should say "The very first entry (just below the end of the volume) in the index area must be a Volume Identifier Entry"). It should probably also have a glossary to define "volume" (as "all blocks within the logical address space provided by whatever the file system mounted").

Okay, I was wondering about that. Now the allocation makes sense, along with a few other things.

Thanks,
Ben


Top
 Profile  
 
 Post subject: Re: The Simple File System
PostPosted: Tue Sep 19, 2017 12:15 am 
Offline
Member
Member

Joined: Thu Jul 05, 2012 5:12 am
Posts: 923
Location: Finland
Ben, the current document looks good in general. Thank you for your valuable work on OSDev.

_________________
Undefined behavior since 2012


Top
 Profile  
 
 Post subject: Re: The Simple File System
PostPosted: Tue Sep 19, 2017 12:27 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
Antti wrote:
Ben, the current document looks good in general. Thank you for your valuable work on OSDev.

Thank you. As soon as I add a little more to it, mostly notes and comments, I will release the source code to create SFS images, with files added. I don't have a Linux machine, but I am pretty sure my code is portable enough to compile as-is on Linux for you *nix guys. However, once I get it out, if someone would try it and let me know.

Thanks again for your comments,
Ben


Top
 Profile  
 
 Post subject: Re: The Simple File System
PostPosted: Wed Sep 20, 2017 12:06 pm 
Offline
User avatar

Joined: Wed Sep 20, 2017 11:10 am
Posts: 1
@BenLunt: I've implemented SFS 1.0 and 1.1 in my boot loader. It would be nice to have a tool to create images to test with.


Top
 Profile  
 
 Post subject: Re: The Simple File System
PostPosted: Wed Sep 20, 2017 4:12 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
bztX wrote:
@BenLunt: I've implemented SFS 1.0 and 1.1 in my boot loader. It would be nice to have a tool to create images to test with.

Sorry for the delay. Other work had me busy for a while.

The source code, a DOS DPMI .exe, specification, and example resource files are now on GIT at https://github.com/fysnet/mksfs.

The .EXE is compiled with DJGPP for a DPMI environment, however I hope I have made the source code mostly portable so it should compile for other environments as-is. However, please let me know if it doesn't and please show me the additions/modifications you made to get it to compile on your platform.

I ask that someone with Linux and other *nix platform, compile it and see what modifications need to be made.

Okay, now for some notes:
The two example resource files, floppy.txt and harddisk.txt, create a 1.44meg floppy image and a 5Meg hard drive image (respectively). To make either one, use:
Code:
  mksfs floppy.txt
or
   mksfs harddisk.txt

Within the .txt file are a few parameters you need to initialize:
Code:
imgfile=  D:\fysos\main\filesys\images\sfs_f.img

This is the target path and filename of the image file to create. It will truncate any existing file, so only create new images or know that any existing will be destroyed.
Code:
mbrfile=D:\Books\fysos\main\syscore\source\mbr\mbr.bin
This is the path and filename of the MBR boot sector code to put at the first of the image. Your code to create mbr.bin should parse the partition entries, load the active one, then jump to 0x07C00. (Note that this parameter should not be used for floppy images, though if given, will still work just fine)

Code:
# Boot file.  Should be a multiple of 512 bytes
bootfile= D:\Path\to\your\boot\source\code\sfs_f.bin
This is the path and filename of the boot sector code to put at the first of the volume. Note that it should be a multiple of 512 (BLOCK SIZE) and can be one (1) or more blocks in size.

Code:
# You may use decimal or hexadecimal numbers
base_lba= 0         # LBA = 0
tot_sects= 2880     # Total number of sectors in partition
param0= 0           # Ignored
param1= 0           # Ignored
heads= 2            # heads per cylinder
spt= 18             # sectors per track

These need to be initialized to the specs shown above. The tot_sects field is the total count of 512-byte sectors used in the image, not the volume size. For example, if you are creating a hard disk image and give 123,456 as the tot_sects parameter and then 63 as the base_lba parameter, the volume size will be 123,456 - 63 sectors. (Note that the code may add sectors to pad to the nearest ending cylinder or track.)

Code:
D:\Path\goes\here\kernel.sys, kernel.sys, 0
* , system, 1            # make the system folder (note, must put something in path field. '*' works just fine)
The end of the file is a list of paths and files to add to the image. The first parameter (before the first comma) is the path and filename of the file on the host machine to copy from.

The second parameter is the path and filename of the file to place onto the image. Note that it will write the path and file name exactly as you have it in this parameter. There is no error checking to see if the path and filename is valid.

The last parameter is a 0 or a 1. If 0, it is a file, write to file's contents to the image as well as adding the entry. If the parameter is a 1, it is a folder, only add the entry to the Index Data Area. (Note that there must be all three parameters, even though the folder doesn't need a first parameter, and each parameter must have something in it, hence the '*' character.

The code is not written to check errors and assumes that all input is valid. I did not test it as much as I probably should have, so please let me know if you find any errors.

I have also included two pre-made images, so that you can test your code without having to make mksfs. Each image contains minimal files for FYSOS. Each image will boot with valid SFS boot code, though note that the GUI will not load since I didn't include a complete SFS driver for FYSOS yet.

I am not included source code to boot SFS since this is suppose to be your job :-).

Thank you,
Ben

P.S. Please note that even though the source code states that it is included with the book, I have not done so yet, since it is for a future edition of that book.


Top
 Profile  
 
 Post subject: Re: The Simple File System
PostPosted: Thu Sep 21, 2017 6:20 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
Just for your information, I have finalized the specification for version 1.10 (please note that a version of 1.10 is different than a version of 1.1), and the updated .PDF is available at: https://github.com/fysnet/mksfs. (Please note that the two images on that page may still be version 1.1rc3, a value of 0x11).

Thank you Brendan for letting me take your SFS and run with it. I am, again, quite fond of file systems.

Thank you everyone for your comments. Please be sure to let me know if you find any errors or have comments or suggestions.

Ben


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group