Project 4 Mechanics
Please do the following things as soon as possible:
-
Build a kernel that supports the cse451 file system
- Make sure you have a copy of the linux source tree (see Project 1 if
you need to get a new one).
- Copy the file /cse451/projects/config-fs into the root
directory of your linux source tree and save it with the name .config
-
Unpack the starter code and make sure you can make it.
- The subdirectory mkfs produces mkfs.cse451fs, which sets up a disk
partition. Just enter the mkfs directory and type make.
- The subdirectory fsSource contains the cse451fs file system source.
To make it, it has to appear to be part of the Linux source tree:
-
Navigate to the fs directory in your linux source code.
-
mv minix minix-orig
- Now create a symbolic link named "minix" to the directory you
will keep your working copy of the source in. For me, this was done
using the command: ln -s /cse451/tanderl/cse451fs/fsSource minix
-
Go back to your Linux source root directory.
-
Run these commands:
make oldconfig
make dep
make bzImage
This will build a kernel that will support your file system.
- Type make modules. This will compile the file system
source (in the folder you've linked directory 'minix' to). Verify
that the file cse451fs.o has been created in your file system source
working directory.
-
Try out the file system on a VMware machine.
- Get VMWare up and running with the kernel you built (see Project 1
if you don't remember how)
-
Ftp 3 files to VMWare:
- fs/minix/cse451fs.o
- drivers/block/rd.o
- cse451fs/mkfs/mkfs.cse451fs
-
Setup a ramdisk by typing insmod rd.o rd_size=<size in
KB>.
For example, insmod rd.o rd_size=4096 will create a 4 MB
ramdisk. You don't need a huge disk for this project.
- You now need to set up the file system on the partition /dev/ram0.
The program mkfs.cse451fs will do that: mkfs.cse451fs /dev/ram0
- If you want to look at what has been written to disk, try
hexdump -n 9192 /dev/ram0 or xxd -s 1024 -l 1024 /dev/ram0
| less
- You now need to install the file system (which has been created as
a module) into the kernel: insmod cse451fs.o.
lsmod(8) will list loaded modules.
- Now, finally, you need to mount the new file system. Create an
empty directory (say, cse451fsmnt), and then
mount -t cse451fs
/dev/ram0 cse451fsmnt
- At this point, you should be able to cd into cse451fsmnt, create
directories and files, do an ls, and (almost) everything else you're
used to.
- When you're done, cd out of the mounted file system, then do
umount /dev/ram0 and rmmod cse451fs. You can now
repeat the above steps with a newer version of your mkfs program and
file system module if you need to.