Lan Barnes wrote:
It's been a long day.

My vague memory of kernel compiles was:

- add something to extraversion
- make config
- (first compile - no make clean/mrproper)
- make (vmlinuz?)
= make modules
- make install
- make modules_install

- or, make all

It's crapping out
[EMAIL PROTECTED] 2.6.15-1.1831_FC4-i686]# make all
  CHK     include/linux/version.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
make[1]: *** No rule to make target `init/main.o', needed by
`init/built-in.o'.  Stop.
make: *** [init] Error 2
[EMAIL PROTECTED] 2.6.15-1.1831_FC4-i686]#

I am _so_ tired ... and I can't find my old Red Hat notebook.

I'll see your answers in the morning.

TIA,


Why do you need to compile a kernel in the first place? Perhaps there is another way for you do get whatever it is you are working on to work.

However, since you are running Fedora Core 4, there are going to be multiple approaches to building a kernel, depending on your ultimate goal.

The first method is to grab a plain vanilla kernel from kernel.org in the form of a bzip tarball. Everything up to the point of installation can be done as a regular user. Create a build directory to put everything in. Then expand your tarball, change to the directory, and from there you have a choice of configuration options. If you do the configuration under X, you can choose to use gconfig, which uses the gtk+ toolkit for a GUI configuration tool, and tends to be associated with GNOME desktops. You invoke it with "make gconfig". Or you can use xconfig, which uses the QT widget set, and is invoked with "make xconfig" and tends to be associated with the KDE desktop. Or you can use the ncurses method by doing "make menuconfig". If all else fails you can do a "make config" which will be long, tedious amd error-prone, because you can't go back and fix mistakes and you probably won't have a clue as to what some of the options are (I know I don't).

Once you get done doing the configuration, you will save the config file (it usually gets saved for you as .config in the base directory). To build the kernel and modules issue a "make all". To see all your possible options you can issue a "make help". You'll notice that there is an option to build RPM packages. When its done building the kernel, run a "make install" to put everything in its place.

Another way to build a kernel is with an RPM. I build all my RPMs as a regular user by first overriding the default source install and build locations for rpm. In my home directory I have a little file called .rpmmacros with the following contents:

%_topdir        %(echo ${HOME}/rpm)
%_tmppath       %{_topdir}/tmp

%packager       Gus Wirth
# %_enable_debug_packages 0

This means that I have a directory called rpm under my home directory that is the top level directory for doing rpm stuff, and that I have a temporary directory under the topdir for doing, well, temporary stuff. I should probably change this back to my /tmp directory but I needed to do some troubleshooting and didn't want to risk losing info to automatic clean-up.

Under the ~/rpm directory I create the directory tree that you would normally find under /usr/src/redhat/. With that in place, I can install RPM source packages to my home directory as a regular user and then build them from there without being root.

To build a Redhat/Fedora kernel (as opposed to a plain vanilla kernel) will require a few more steps. The tricky part will be to get YOUR configuration to work as part of the deal. The first thing to do will be to grab the source RPM for the kernel and install it. You will wind up with a spec file, a compressed tarball of the original plain vanilla source, and a whole bunch of patches, plus the configuration files used by Redhat to create the final kernel. In order for you to do your own configuration you will probably want to employ a partial build option for the rpm. To start with, try:

$ rpmbuild -bp kernel.spec

from the ~/rpm/SPECS directory (if you did the .rpmmacros thing). This will do the prep phase of creating the RPM, which uncompresses the source and applies all the patches. Getting the patches applied is very important because they might change your configuration options. If you have your own patches that need to be applied to the source, you should hack the spec file and have those included as part of the rpm build process. If you apply the patches without using the spec file, you won't be able to create an rpm the usual way.

From here you have a couple options. You can go to the build directory and configure and build the kernel like in the plain vanilla scenario above. This is the easiest way to do this. The other option is to do your configuration, save the config file as something like Lan.config and then hack up the spec file to use your config file rather than the ones provided by Redhat (note that I'm getting lazy here and no longer providing step-by-step instructions). Once you have that done, you can build the new kernel by issuing:

$ rpmbuild -ba kernel-hacked-by-lan.spec

That will then build your new kernel and package it up for you. Install the RPM and you're done.

Plan on spending a few hours with this if you haven't done it before.

Gus


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to