swissChili | 4418ca5 | 2021-06-14 17:36:00 -0700 | [diff] [blame] | 1 | Bluejay Filesystem |
| 2 | ================== |
| 3 | |
| 4 | Filesystem drivers are still a work in progress. To test a file system you will |
| 5 | want to create and mount a virtual block device. The makefile in ``src/kernel`` |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 6 | will generate an ``hd0_ext2.img`` EXT2 disk image for you automatically. The |
| 7 | default size is 32 megabytes, but you can create your own of any size if you |
| 8 | want. Once the image has been created it will be loaded by QEMU automatically. |
swissChili | 4418ca5 | 2021-06-14 17:36:00 -0700 | [diff] [blame] | 9 | |
| 10 | In order to write to the virtual hard disk from your host operating system you |
| 11 | should mount it. The ``make mount`` command in ``src/kernel`` mount the image to |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 12 | ``$(BLUEJAY_ROOT)/mnt``. If you are using an EXT2 filesystem you should probably |
| 13 | change the owner of that directory once it is mounted so that you can write to |
| 14 | it. |
swissChili | 4418ca5 | 2021-06-14 17:36:00 -0700 | [diff] [blame] | 15 | |
| 16 | Virtual Filesystem |
| 17 | ------------------ |
| 18 | |
| 19 | The Bluejay VFS is heavily inspired by UNIX. It relies on inodes and a tree of |
| 20 | file nodes. The source can be found in ``src/kernel/vfs.c``. This also exports a |
| 21 | very low-level API for dealing with files -- including the usual read(), |
| 22 | write(), readdir(), etc -- but this should not be used for much longer. A high |
| 23 | level API utilizing file descriptors will be implemented to make this simpler. |
swissChili | caa2478 | 2021-07-19 14:29:58 -0700 | [diff] [blame] | 24 | |
| 25 | Filesystem Drivers |
| 26 | ------------------ |
| 27 | |
| 28 | The current filesystem driver(s) available in Bluejay are: |
| 29 | |
| 30 | - ``ext2`` |
| 31 | - Read-only support, write support is in progress |
| 32 | |
| 33 | Creating a Virtual Drive in QEMU |
| 34 | -------------------------------- |
| 35 | |
| 36 | By default ``make qemu`` will load ``hd0_$(FS).img`` as the virtual hard drive |
| 37 | for Bluejay. ``FS`` defaults to ``ext2`` but can be set in your ``Jmk.options`` |
| 38 | to any value. If this file does not exist it will be created using |
| 39 | ``mkfs.$(FS)``, ie ``mkfs.ext2`` by default. The default size of the file system |
| 40 | is 35 megabytes, although you can create one of any size manually if you want. |
| 41 | 35 megabytes is plenty for testing though. |
| 42 | |
| 43 | The ``make mount`` command will mount the current virtual hard drive in |
| 44 | ``$(ROOT)/mnt`` (where ``$(ROOT)`` is the root directory of the Bluejay sources, |
| 45 | not ``/``). This command requires superuser privileges. If you want to give your |
| 46 | (host) user account write permissions use ``chown -R user:group /path/to/mnt`` |
| 47 | where ``user`` and ``group`` are the user and group you want to own the files. |
| 48 | |
| 49 | Currently Bluejay ignores file permissions so it doesn't matter who you set the |
| 50 | owner to. |