1. Store
  2. Apps
  3. Hardware
  4. Support
  5. Solutions

ClearFoundation

Forums
Welcome, Guest
Roll Your Own Kernel on 6.3
(1 viewing) 1 Guest
Go to bottomPage: 1
TOPIC: Roll Your Own Kernel on 6.3
#45413
Roll Your Own Kernel on 6.3 9 Months ago  
Or, "ClearOS comes with every wifi module but the one I need."


Maybe you need to do a little tweaking to the stock ClearOS kernel, or as is my case compile a hardware module that didn't come as part of the default distribution.

The first step is to install a build environment so we can compile a kernel and its modules from source code:
Code:

yum --enablerepo=clearos-developer,clearos-epel install clearos-devel



Now you'll need the kernel sources. You COULD take this opportunity to update the kernel but you will run the risk of also having to update the module tools, iptables, udev, glibc just to name a few. Clearos-devel pulls in the kernel-devel package which is where the complete source always used to come from. For some reason, it's not there anymore and we have to jump through a couple hoops to get the matching sources for the kernel we're currently running:

Code:


wget http://mirror2-houston.clearsdn.com/clearos/community/6.3.0/dev/SRPMS/kernel-2.6.32-279.2.1.v6.src.rpm
rpm2cpio kernel-2.6.32-279.2.1.v6.src.rpm > kernel.cpio
cpio -idmv < kernel.cpio
cd rpmbuild/SOURCES/
cp linux-2.6.32-279.2.1.el6.tar.bz2 /usr/src/
cd /usr/src/
tar xjf linux-2.6.32-279.2.1.el6.tar.bz2



cd to the new linux sources directory and make menuconfig. Since we're rolling our own, we can't really rely on the initramfs to help us boot. Other than the modifications you need to make, do at least the following:

1) Select "Enable loadable module support", then "Module signature verification (EXPERIMENTAL)". Disable it.
2) Then go back to the main menu, select "Cryptographic API" then "In-kernel signature checker (EXPERIMENTAL)" and disable that one too.

This will save you from a nasty bug down the road.

Run lspci in another console and determine what modules you need to compile in for your SATA/PATA/ATA controller, Build these modules INTO the kernel (not as external modules):
- Your disk controller module(s)
- Ext4
- Multiple devices driver support (RAID and LVM)
- Device mapper support
- Wired network devices (optional but I'm fond of guarantees)

Now you can run make; make modules_install. There are something like 1,900 external modules in the default .config; go make yourself a cup of tea or dozen.

Copy the new bzImage to /boot somewhere and alter your /boot/grub/grub.conf to have two entries; copy and paste the original entry then modify the first one to boot your new kernel. Keep the second one in case you buggered up and need to go back and fix it later (easily accomplished with a livecd anyway but less of a pain in the arse)

You can take this opportunity to remove the pretty but uninformative (worse than useless) bootsplash by deleting everything on the kernel line after rd_NO_DM.

Reboot and try on your shiny new kernel.
kfox
Gold Boarder
Posts: 190
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
ClearOS, Xen, Gentoo articles and more!
"Appses? To god-damned hell with appses! We have no appses. In fact, we don't need appses. I don't have to show you any stinking appses!"
 
#45420
Re: Roll Your Own Kernel on 6.3 9 Months ago  
Hi, whilst you can go this route, you are building direct from the kernel source tar ball...rather than using the RPM spec and the additional patches and packaging that goes with it. The bandwidth IMQ patch is the notable omission if you go this route

If you want to amend a kernel config, setup your devel environment, install the kernel-xxx.src.rpm, edit the config within ~/rpmbuild/SOURCES/config-generic, and then rebuild directly using the spec file

Going this route would also fix the module signing issue you discovered by doing it direct from source

Out of curiosity - which wireless module did you need support for? (Elrepo.org provide el6 kmod rpms for wireless cards which may have provided a shorter fix)
Tim Burgess
Moderator
Posts: 5802
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#45427
Re:Roll Your Own Kernel on 6.3 9 Months ago  
I went through the trouble of rpm2cpio because this is what I get when I try to install the SRPM:

Code:

 rpm -iv kernel-2.6.32-279.2.1.v6.src.rpm 
kernel-2.6.32-279.2.1.v6
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root



And it doesn't seem to install anywhere so I figured rather than make the mockbuild user and group I may as well bulldoze over RPM.

I was hoping the patches would have already been applied, is there a file or script in the RPM dump that does them all automagically?
kfox
Gold Boarder
Posts: 190
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
ClearOS, Xen, Gentoo articles and more!
"Appses? To god-damned hell with appses! We have no appses. In fact, we don't need appses. I don't have to show you any stinking appses!"
 
#45432
Re: Roll Your Own Kernel on 6.3 9 Months ago  
Tim Burgess wrote:
Out of curiosity - which wireless module did you need support for? (Elrepo.org provide el6 kmod rpms for wireless cards which may have provided a shorter fix)
rt2800pci with RT3090 support enabled
kfox
Gold Boarder
Posts: 190
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
ClearOS, Xen, Gentoo articles and more!
"Appses? To god-damned hell with appses! We have no appses. In fact, we don't need appses. I don't have to show you any stinking appses!"
 
#45436
Re:Roll Your Own Kernel on 6.3 9 Months ago  
The old "kernel-sourcecode" RPM was handy for manual kernel builds. That upstream package actually went away in version 5.x, but we kept it alive for ClearOS 5.x. We decided to follow along with upstream for version 6.

I can't seem to find the knowledge base article that described the new way to produce what was in kernel-sourcecode. The article was on redhat.com but the links have since all changed. No matter, my notes still have the meat and potatoes of the procedure.

Download and install the kernel src.rpm, then run:

Code:


# rpmbuild -bp --target=i686 kernel-2.6.spec
# cp -a /usr/src/redhat/BUILD/kernel-x.y.z/linux-x.y.z /usr/src
# ln -s /usr/src/linux-x.y.z /usr/src/linux



That will put the fully patched kernel into /usr/src/linux-x.y.z. Though the paths are now slightly different, it looks about right. Keep in mind the procedure is coming from an old personal document. Perhaps it should go into an up-to-date howto
Peter Baldwin
Developer
Posts: 1571
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#45442
Re:Roll Your Own Kernel on 6.3 9 Months ago  
Excellent, thank you. WIll try soon.
kfox
Gold Boarder
Posts: 190
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
ClearOS, Xen, Gentoo articles and more!
"Appses? To god-damned hell with appses! We have no appses. In fact, we don't need appses. I don't have to show you any stinking appses!"
 
#45492
Re:Roll Your Own Kernel on 6.3 9 Months ago  
(Elrepo.org provide el6 kmod rpms for wireless cards which may have provided a shorter fix)
Their rt3090sta does not play with your kernel. Intended for kernel 2.6.32-71.el6.x86_64; when brought into the clear kernel's module tree and depmodded:
Code:

# modprobe rt3090sta
FATAL: Error inserting rt3090sta (/lib/modules/2.6.32-279.2.1.v6.x86_64/kernel/drivers/net/wireless/rt2x00/rt3090sta.ko): Unknown symbol in module, or unknown parameter (see dmesg)



Though the paths are now slightly different, it looks about right.
Yup, very close, thanks.

Code:

# yum install xmlto asciidoc elfutils-libelf-devel binutils-devel newt-devel python-devel "perl(ExtUtils::Embed)" hmaccalc
# rpmbuild -bp --target=x86_64 SPECS/kernel.spec

kfox
Gold Boarder
Posts: 190
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
ClearOS, Xen, Gentoo articles and more!
"Appses? To god-damned hell with appses! We have no appses. In fact, we don't need appses. I don't have to show you any stinking appses!"
 
#45500
Re:Roll Your Own Kernel on 6.3 8 Months, 4 Weeks ago  
The kmod rpm needs rebuilding first before you can install (because the ClearOS kernel is not ABI compatible with el6)

This then means that one module will work for a single set of 2.6.32.x kernel releases, and prevents the need to recompile everytime you run a kernel upgrade

Anyhow, just tried to rebuild rt3090sta and it failed, the other rtXXXXsta drivers work OK...i'll investigate!
Tim Burgess
Moderator
Posts: 5802
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
  get the latest posts directly to your desktop