Reading inode content and directory entry record from a ext2 image file.
Simply run make
.
The target execute file need to read a file name initrd.img
. You can change the file name to any. You can create a file with mke2fs
:
dd if=/dev/zero of=initrd.img bs=300k count=1
mke2fs -F -m0 initrd.img
Then mount the file, do what ever you want in that mount point. Unmount, execute the target in debugger, then watch the results.
Execute target won't output anythings. In order to see the result, you need to use debugger with breakpoints to watch the changes of the variable d
and content
.
This code based on OSdev's Ext2 article.