[PlanetCCRMA] Comments and thoughts on building the 1394 drivers via the kernel rpm process

Fernando Pablo Lopez-Lezcano nando@ccrma.Stanford.EDU
Tue Jan 7 12:32:01 2003


>    Copied and annotated as I go through the process. I've spaced things out
> a bit and also put my questions and comments inside some asterisk blocks.

Ok, I'll add some comments to the relevant parts...

> - rpm -bp kernel-2.4.19-1.ll.spec (this untars and patches the kernel, does
> not built it yet)
> **********
> The Planet web page says 'rpm -ba'. So from man rpm we are doing the %prep
> step only?
> **********

Only prep, remember, those instructions were written to change some of
the kernel configuration options only so we don't need to build the
kernel at this point, just configure it differently and save the changed
configuration files so that we can rebuild it latter. 

> - cd /usr/src/redhat/BUILD/kernel-2.4.19-1.ll/linux-2.4.19/
> **********
> OK
> Question - this gets me to the top of the source code tree for the kernel.
> The ieee1394 directorto be updated is in this drivers directory, correct?

Correct. 

> - copy the i686 configuration file you want to change:
> cp configs/kernel-2.4.19-i686.config .config
> **********
> OK - File size is 35969. Date is Jan. 7, 8:02
> Is this the file we would give to the 1394 developers how have an idea about
> how to make this easier?
> **********

Yes, that .config file is the kernel configuration (ie: which modules
will be built). It is a text file so you could look at it if you wanted,
just contains options that were enabled or disabled when I configured
the kernel. 

The part about configuring the kernel that follows is not relevant. 

> Now, at this point I think I would insert the new 1394 code in the ieee1394
> driver directory. Comments?
> **********

That is correct. Here is where things start getting harder if you want
to create an rpm :-) What you (or I) should do is create a patch to the
kernel which contains the new driver. The patch is actually the
difference between what is currently there and the new code. Once you
have that patch (a text file) you can add it to the list of patches that
the spec file (the spec file is the file that tells rpm how to build the
rpm in question - /usr/src/redhat/SPECS/kernel-2.4.19-1.ll.spec in this
case) knows about and rebuild the kernel rpms. 

This is what I'd do:

- create a complete reference copy of all the source tree (so that I can
  diff agains it)
  cd /usr/src/redhat/BUILD/kernel-2.4.19/
  mkdir temp
  tar cvf - linux-2.4.19 | (cd temp; tar xvpf -)
  cd temp
  mv linux-2.4.19 ../linux-2.4.19-orig
  cd ../
  rmdir temp

- modify the drivers
  cd linux-2.4.19/drivers/ieee1394
  do all the changes you need to do there, after you are done erase all
  the temporary files or backup files (for example rm *~)

- create the patch file
  cd /usr/src/redhat/BUILD/kernel-2.4.19/
  [the following is just one line]
diff -uNr linux-2.4.19-orig/drivers/ieee1394
linux-2.4.19/drivers/ieee1394
>/usr/src/redhat/SOURCES/kernel-ieee1394.patch

- copy the previous spec file to a new spec file:
  cd /usr/src/redhat/SPECS/kernel-2.4.19-1.ll
  cp kernel-2.4.19-1.ll.spec kernel-2.4.19-1.1.ll.spec

- edit the new spec file
  * change the version number to match:
%define release 1.ll
    to
%define release 1.1.ll
  * add the patch:
# lock break for preemptible kernel patch
Patch20006: lock-break-rml-2.4.18-2.patch.txt

# patch ieee1394
Patch20100: kernel-ieee1394.patch

  * apply the patch after this:
# included in the latest low latency patch
# %patch20002 -p1

# ieee1394 patch
%patch20100 -p1

  * add a relevant comment on the changelog :-)

- at this point you are ready to rebuild. What happens next depends on
whether the patch actually added new options to the configuration
process. If it did then you need to reconfigure the kernel (as detailed
in the other email) so that those options are taken into consideration.
If not, then you are really ready to rebuild.