0

I'm a newbie to kernel programming, and I'm stuck on something, so I'd appreciate some help. I appologize in advance if something similar was asked before, I did not find any relevant post, and could find explanations on the web which were simple enough for someone unexperienced as myself in this field to understand.

I want to experiment with my own version of ext2. I've got the source files from kernel.org, and made the proper changes. Nothing fancy, just to check something I had in mind.

Now I want to insert it to my linux kernel (ubuntu 2.6.31-14-generic-pae if it matters). How can I do this?

My (obviously naive) initial thought was to simply use the makefile that comes along with it (after manually setting various flags there so it has obj-m/obj-y where needed) and compile it as a kernel module.

However I keep getting errors during compile time about redifining macros, implicit declarations of functions etc. For example

    ext2.h:181:1: warning: "ext2_find_first_zero_bit" redefined
    balloc.c:574: error: implicit declaration of function dquot_free_block_nodirty

Obviously this is not the way to go. I guess worst case scenario is compiling the entire kernel again (with my modified ext2 code instead of the original) so it creates the relevant library with my own ext2, and rebooting from the new image. I find it hard to believe this is the best approach.

Is it even possible for a new file system to be inserted as a kernel module?

Myabe I should put my modified ext2 code in /usr/src and somehow compile only the relevant library which contains the current ext2 code?

Anyway, I'd appreciate any help on what should I be doing.

Thank you

user331398
  • 179
  • 2
  • 9
  • is your current kernel using ext2 as a module? :/ – Karoly Horvath Sep 01 '11 at 11:11
  • No. lsmod does not list anything relating to ext2. and I do have libext2fs in /lib – user331398 Sep 01 '11 at 11:34
  • first: you cannot load it as a module if it is already compiled *into* the kernel. second: you need a different FS for the root filesystem, otherwise you won't be able to boot.. no ext2fs support :) third: I have no idea about the compile problems, have you tried to google? – Karoly Horvath Sep 01 '11 at 12:27

1 Answers1

0

Do a search and replace of ext2 with my_awesome_filesystem or some such.

Benjamin Peterson
  • 19,297
  • 6
  • 32
  • 39