Results 1 to 9 of 9
I am trying to build a RPM kernel but having no success with it. First off the kernel im building I can build from source so I have some kernel ...
- 09-29-2006 #1Just Joined!
- Join Date
- Sep 2006
- Posts
- 4
building a rpm kernel
I am trying to build a RPM kernel but having no success with it. First off the kernel im building I can build from source so I have some kernel experience but making an RPM I do not. This kernel goes on different servers with the same hardware pretty much so except for a SMP setting its pretty much all the same. The difference is I dont have loadable module support settings or install modules however you call it, everything is either set to (*) or () nothing at all and their OS's are all Fedora Core 1 or CentOS 3/4x versions.
This is a spec file I got from a friend
Here is the output after rpmbuild -ba kernel-2.6.17.13.spec 1>/tmp/std.out 2>stdout1.errCode:Summary: The 2.6.17.13 kernel. Name: linux Version: 2.6.17.13 Release: UP_100megs_1.0 Copyright: GPL Group: System Environment/Kernel Source http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.13.tar.gz BuildRoot: /usr/src/redhat/BUILD/%{name}-%{version} %description This is the Linux %{version} kernel compiled to work on most systems. %prep %setup # Check to see if the config file is present and copy it to .config if [ -f $RPM_BUILD_ROOT/%{version}-%{release} ]; then cp -f $RPM_BUILD_ROOT/%{version}-%{release} $RPM_BUILD_ROOT/.config else echo "No config file found. Exiting" # rm -rf $RPM_BUILD_ROOT exit 1; fi %build make dep;make bzImage %install mkdir $RPM_BUILD_ROOT/boot cp $RPM_BUILD_ROOT/arch/i386/boot/bzImage $RPM_BUILD_ROOT/boot/vmlinuz-%{version}-%{release} cp $RPM_BUILD_ROOT/System.map $RPM_BUILD_ROOT/boot/System.map-%{version}-%{release} %clean rm -rf $RPM_BUILD_ROOT %pre %post # If /etc/grub.conf is there, have grubby add the config if [ -f /etc/grub.conf ]; then # Backup the grub config cp -u /etc/grub.conf /etc/grub.conf.rpmsave # Use grubby to build new config /sbin/grubby --add-kernel=/boot/vmlinuz-%{version}-%{release} --title="Red Hat Linux (%{version}-%{release})" --copy-default --make-default -c /etc/grub.conf --args="ro root=/dev/`cat /etc/grub.conf |perl -e 'while (my $line = <STDIN>) { if ($line =~ /^#.* root=\/dev\/(.*)$/) { print $1 . "\n"; }}'`" -o /tmp/%{version}-%{release}.grub.conf # Copy the tmp file to /etc/grub.conf cp -u /tmp/%{version}-%{release}.grub.conf /etc/grub.conf ln -sf /boot/System.map-%{version}-%{release} /boot/System.map fi # If there is a lilo.conf (and no grub.conf) Add the entry if [ -f /etc/lilo.conf ]; then /usr/bin/env perl<<EOF open(LILO,'/etc/lilo.conf'); while (\$line = <LILO>) { \$line =~ /.*root=(.*)\$/; \$hd = \$1; } close(LILO); system('cp -f /etc/lilo.conf /etc/lilo.conf.rpmsave'); system('echo "image=/boot/vmlinuz-%{version}-%{release} label=%{version} read-only root=' . \$hd . '" >> /etc/lilo.conf'); EOF ln -sf /boot/System.map-%{version}-%{release} /boot/System.map fi # Udev foo for CentOS and RHES if [ ! -d /tmp/udevcheck ]; then mkdir /tmp/udevcheck fi mount --bind / /tmp/udevcheck if [ ! -c /tmp/udevcheck/dev/console ]; then mknod -m 660 /tmp/udevcheck/dev/console c 5 1 fi if [ ! -c /tmp/udevcheck/dev/null ]; then mknod -m 660 /tmp/udevcheck/dev/null c 1 3 fi umount /tmp/udevcheck %preun %postun if [ -f /boot/grub/grub.conf ]; then sed "/title Red Hat Linux (%{version}-%{release})/{N;N;d;}" /boot/grub/grub.conf > /tmp/grub.conf.tmp mv -f /boot/grub/grub.conf /boot/grub/grub.conf.rpmsave mv /tmp/grub.conf.tmp /boot/grub/grub.conf fi if [ -f /etc/lilo.conf ]; then sed "/image=\/boot\/vmlinuz-%{version}-%{release}/{N;N;N;d;}" /etc/lilo.conf > /tmp/lilo.conf.tmp mv -f /etc/lilo.conf /etc/lilo.rpmsave mv /tmp/lilo.conf.tmp /etc/lilo.conf fi %files /boot/vmlinuz-%{version}-%{release} /boot/System.map-%{version}-%{release}
http://stlhosting.com/stdout1.err
What am I doing wrong? Why does it not create an RPM?
- 09-29-2006 #2Linux User
- Join Date
- May 2003
- Location
- CA
- Posts
- 370
when you build the kernel after doing a make modules_install, you can directly run
make rpm-pkg, this will automatically create a kernel rpm package for you.
That way you do not have to muddle around with the spec file.
This is what I do and it works fine for me.Fixing Unix is better than working with Windows.
http://nikhilk.homedns.org/projects/index.html
- 09-29-2006 #3Just Joined!
- Join Date
- Sep 2006
- Posts
- 4
Are no modules think thats whats confusing the people im asking... since the make modules_install is not part of my building process this is whats confusing the rpm building I think.
- 09-29-2006 #4Linux User
- Join Date
- May 2003
- Location
- CA
- Posts
- 370
run the following in your kernel source directory:
make menuconfig
make bzImage
make modules
make modules_install
make rpm-pkg
and you should have a working rpm package at the end...
Fixing Unix is better than working with Windows.
http://nikhilk.homedns.org/projects/index.html
- 09-29-2006 #5Just Joined!
- Join Date
- Sep 2006
- Posts
- 4
Yes, if I was building in loadable module support I could but its not what I need.
make modules
The present kernel configuration has modules disabled.
Type 'make config' and enable loadable module support.
Then build a kernel with module support enabled.
make: *** [modules] Error 1
As i stated in my original message there is no module support and dont intend on building it in... sorry if you misunderstood
- 09-29-2006 #6Linux User
- Join Date
- May 2003
- Location
- CA
- Posts
- 370
so you are building everything in your kernel?
Fixing Unix is better than working with Windows.
http://nikhilk.homedns.org/projects/index.html
- 09-29-2006 #7Just Joined!
- Join Date
- Sep 2006
- Posts
- 4
Not everything just what I need. The kernels I build are for servers, not desktops so I know my hardware in and out, They all have the same hardware, theres a few that differ but the config process I use is universal so to speak for all my systems, I can build from source on 2.4 and 2.6 without issues but would like to start making RPMs so others can install these things who have no knowledge of how to build a kernel from source.
Doing so and with out loadable module support im less prone to exploits, plus the systems boot lot faster
- 10-15-2006 #8can't you just write a script to compile/install the kernel for you? that would be my personal preference, but... whatever floats your boat
Originally Posted by DigiCrime
Here's why Linux is easier than Windows:
Package Managers! Apt-Get and Portage (among others) allow users to install programs MUCH easier than Windows can.
Hardware Drivers. In SuSE, ALL the hardware is detected and installed automatically! How is this harder than Windows' constant disc changing and rebooting?
- 10-16-2006 #9Just Joined!
- Join Date
- Oct 2006
- Posts
- 3
I have faced the same problem. I find that RPM will not be built if modules are disabled. I just copy the Kernel image to /boot, edit lilo.conf, run lilo and reboot - every works fine. You could try one thing though. Configure the entire Kernel through 'make xconfig' with modules disabled. After all configuration is over, enable module support before saving - though you have module support enabled, no modules will be built. I have tried building an RPM package this way. It works. BTW, the kernel Makefile has a target 'rpm'. You can directly type 'make rpm' after 'make xconfig'.


Reply With Quote
