Re: patch fr1-2.17 does not work with kernel 2.4.30

"Peter T. Breuer" <[email protected]>
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
"Also sprach Stephan von Krawczynski:"
> On Thu, 7 Apr 2005 14:15:47 +0200 (MET DST)
> "Peter T. Breuer" <[email protected]> wrote:
> 
> > "Also sprach Stephan von Krawczynski:"
> > > I just tried your latest 2.17 right according to the readme for a test.
> > 
> > I'm also wondering if you really turned on the CONFIG_MD_BITMAP and
> > CONFIG_MD_FR1 options for the kernel compile ... but still, sice I
> > cannot see the error message in the code, the question is moot for the
> > moment :(
> 
> I digged deeper into the issue, and I guess this is the whole point of the
> story.
> If one does exactly what it written in the README he ends up having no
> FR1/Bitmap support at all inside the modules.

Well, one has to turn on support in the kernel. Oh - I see, you are not
using the patch "in place in the kernel" but using the external make
facility "standalone" instead. I'd forgotten that existed. Apologies.

Yes, that may need some changing. I see the makefile does:

   $(MAKE) -C $(BUILD) -f ../../src/Makefile $@

which does

   CPPFLAGS := -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB $(SMPOPTS) \
               -I$(LPATH) -I$(HPATH)

   CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
                -fno-strict-aliasing -fno-common

and then 

    $(MAKE) TOPDIR=$(LINUXDIR) -C drivers/md fr1.o md.o bitmap.o

I would IMAGINE that one needs to add -DCONFIG_MD_MODULE and
-DCONFIG_MD_BITMAP_MODULE and -DCONFIG_MD_FR1_MODULE to those flags.
Let's see ...

Ah, well, anyway, it won't work standalone because the makefile
applies the wrong patch by default.  Let me change that (repoints link)
...

OK. That's all good:


  make LINUXDIR=/usr/local/src/linux-2.4.30
  ...
  cc -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB
  -I/var/home/oboe/ptb/lang/c/fr1/fr1-2.17/build/2.4.30-SMP/include
  -I/usr/local/src/linux-2.4.30/include -DCONFIG_MD_MODULE
  -DCONFIG_MD_BITMAP -DCONFIG_MD_FR1_MODULE -Wall -Wstrict-prototypes
  -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common
  -DKBUILD_BASENAME=raid1  -c -o raid1.o raid1.c
  ld -r -o fr1.o raid1.o
  cc -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB
  -I/var/home/oboe/ptb/lang/c/fr1/fr1-2.17/build/2.4.30-SMP/include
  -I/usr/local/src/linux-2.4.30/include -DCONFIG_MD_MODULE
  -DCONFIG_MD_BITMAP -DCONFIG_MD_FR1_MODULE -Wall -Wstrict-prototypes
  -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common
  -DKBUILD_BASENAME=md  -c -o md.o md.c
  cc -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB
  -I/var/home/oboe/ptb/lang/c/fr1/fr1-2.17/build/2.4.30-SMP/include
  -I/usr/local/src/linux-2.4.30/include -DCONFIG_MD_MODULE
  -DCONFIG_MD_BITMAP -DCONFIG_MD_FR1_MODULE -Wall -Wstrict-prototypes
  -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common
  -DKBUILD_BASENAME=bitmap  -c -o bitmap.o bitmap.c
  make[2]: Leaving directory
  `/var/home/oboe/ptb/lang/c/fr1/fr1-2.17/build/2.4.30-SMP/drivers/md'
  make[1]: Leaving directory
  `/var/home/oboe/ptb/lang/c/fr1/fr1-2.17/build/2.4.30-SMP'

  % nm md.o | grep notify
  00005d68 T md_notify_reboot
  00000bfc t notify_device
  00000c60 t unnotify_device

  % nm raid1.o | grep bitmap
           U bitmap_destr
           U bitmap_init
  0000146c t raid1_create_bitmap
  00001514 t raid1_remove_bitmap
  00001570 t raid1_start_bitmap

  

> Effectively the README file does not match the patch at all. If you "make" then
> you end up with modules inside build/2.4.30/drivers/md, but these do not
> contain any new features because the CONFIG_MD_FR1|BITMAP is not set anywhere.

True. But then you are following instructions that do not apply to you
because the patch that they are for does not apply to your kernel!

That was about the only change I made in doing the 2.4.30 patch - I
made all the source code additions dependent on kernel configuration
variables, CONFIG_MD_blah. 

> Can you explain how you intended to use the patch for 2.4? I guess the README
> talks about older versions that probably worked different ...
> The 2.4.30 patch looks like one should apply it directly inside the
> kernel-source-tree and not somewhere outside in /tmp or whereever.


Well, yes, I had forgotten that one could compile the patch outside of
the kernel tree. I'm sorry about that. Just change the src/Makefile
so that it reads:

  CPPFLAGS := -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB $(SMPOPTS) \
              -I$(LPATH) -I$(HPATH) \
              -DCONFIG_MD_MODULE -DCONFIG_MD_BITMAP -DCONFIG_MD_FR1_MODULE

(the last line being the new one, and there being a backslash added at
the END of the previous line)

> Only inside the kernel-source you will be able to do "make menuconfig" and set
> the new options from the patched Config.in.

Sure.

> Can you describe your idea how to apply the patches in detail?
> What I did is simply take the tgz, untar it in /tmp, look at the LINUXDIR (is
> correct anyway) and do "make".
> After that I get a /tmp/fr1-2.17/build/2.4.30/drivers/md directory where the
> modules are. But they do not contain the support functions they should...

Try the change in src/Makefile I suggested above. And repoint the link:

(in the patches directory)

    rm linux-2.4.generic.patch
    ln -s linux-2.4.30.patch linux-2.4.generic.patch

Sorry about that.

Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.