flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > any idea of file system support in a boot loader? |
Author |
|
ManOfSteel 04 Aug 2011, 16:30
All OSs I know of support booting off of only one or at most two FS(s). Bootloaders are usually FS-dependent. If you want to support more than one FS, simply write two (or more) different bootloaders and give the user the option of installing either one of them when they install the OS.
A 1 sector bootloader is more than enough to load files. It's done in virtually every existing OS. It doesn't really take that much code to read and traverse the entire FS hierarchy. You only need a very basic read-only support at that stage, i.e. sector reading routines and a lot of loops and checks depending on the FS structures you're reading and parsing (BPB, superblock, FAT, MFT, inode table, root directory). On the other hand, the entire first track (minus the bootloader) is often kept free of data and boot managers (for example) usually fill that space with their own code so you could very well use it too. It's your OS, write it as you wish... |
|||
04 Aug 2011, 16:30 |
|
BOTOKILLER 04 Aug 2011, 16:54
In my opinion the best option is to create one read-only plain partition for kernel, drivers and all the stuff that works in priviligies level 0, and modules that work as regular applications(GUI, etc) should go to any other partition.
This should provide security for kernel, driver, etc and free you from writing FS driver in bootloader |
|||
04 Aug 2011, 16:54 |
|
cod3b453 04 Aug 2011, 17:17
My boot images construct their own FS but calculate absolute LBAs for the boot sector/loader to use to load the core, system and basic drivers. Higher up, the proper FS handling will be used and can access the full FS not just those particular files I've selected. I find this a nice lazy shortcut (it also means I only have to implement my FS once which is designed towards 64bit rather 16/32bit)
|
|||
04 Aug 2011, 17:17 |
|
egos 05 Aug 2011, 09:03
A stage 1 boot loader is boot device and file system specific. You could use call back technique for access to stage 1 boot loader's API. But this technique has two essential lacks such as RM (maybe only for me) and small size of boot loader in some cases that is reason to have no support for paths (only reading from root dir is supported).
Other way is to load two files instead one from root dir by stage 1 boot loader. The first one could be a stage 2 boot loader and the second one could be a driver for specific boot device and file system. I use this technique in two variants: 1) to load basic system modules from root dir I just load kernel and PM boot device and file system driver by stage 1 boot loader; 2) to load basic system modules from other than root dir I load stage 2 boot loader and RM boot device and file system driver by stage 1 boot loader and then I load kernel and PM boot device and file system driver by stage 2 boot loader (which use a specific RM driver). Or the first file could be a stage 2 boot loader for specific boot device and file system and the second one could be a configuration file for this boot loader. Last edited by egos on 05 Aug 2011, 10:31; edited 1 time in total |
|||
05 Aug 2011, 09:03 |
|
BOTOKILLER 05 Aug 2011, 10:28
cod3b453 wrote: I find this a nice lazy shortcut All long journies start from words "I know a shortcut" |
|||
05 Aug 2011, 10:28 |
|
cod3b453 05 Aug 2011, 16:36
BOTOKILLER wrote:
(Nasty shortcuts are my page mapping code ) |
|||
05 Aug 2011, 16:36 |
|
BOTOKILLER 11 Aug 2011, 11:51
Also, How do file systems map 'free space'???
|
|||
11 Aug 2011, 11:51 |
|
ManOfSteel 11 Aug 2011, 15:01
Different FSs use different methods. One easy and efficient one is to use bitmaps. Check the See also section at the end of the article for other methods.
|
|||
11 Aug 2011, 15:01 |
|
BOTOKILLER 11 Aug 2011, 15:25
ManOfSteel wrote: Different FSs use different methods. One easy and efficient one is to use bitmaps. Check the See also section at the end of the article for other methods. Thanks!!! I'll to mix B-tree and bitmap cuz b-tree is complex and bitmap is large |
|||
11 Aug 2011, 15:25 |
|
BOTOKILLER 08 Sep 2011, 09:28
One more question:
How do I edit files that located in my FS ??? |
|||
08 Sep 2011, 09:28 |
|
ManOfSteel 08 Sep 2011, 10:42
Using an editor of some kind (text, hex, etc.) that calls FS-independent file operation functions (e.g. open, seek, write, etc.) that call FS-dependent APIs that call low-level disk routines (e.g. write block).
In case you were wondering how big that is, the code used in everything except the editor is probably 1/3 (or more) of the entire OS. |
|||
08 Sep 2011, 10:42 |
|
xleelz 11 Sep 2011, 01:19
BOTOKILLER wrote: One more question: if you're wanting to learn how to design a FS in entirety I'd suggest reading Practical File System Design with the Be File System _________________ The person you don't know is the person that could help you the most... or rape you, whichever they prefer. |
|||
11 Sep 2011, 01:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.