Recompiling the Kernel

Hey guys, I have been playing around with compiling my own kernel on Arch. I have mainly been the method outlined on the Arch Wiki about customising the Kernel26 package, from ABS and using PKGBUILD. I can successfully get kernels to compile and use them problem free.
However, I'm new to this and doing it just as a learning experience and for fun. My question is, when I come to configuring the new kernel, say by using "menuconfig" or "gconfig" for example, if I were to just leave it how it is and not change any of the selections... Would this just effectively give me the standard Arch kernel when compiled?
Being new to this kernel building business I would be grateful if someone could point me toward tips on how to optimise my kernel... What I should looking for etc. Is there a way to set the settings to optimal for your system?
Thanks in advance

If you have a kernel that's working fine, boot it and try grabbing its configuration from /proc/config.gz .  The kernel in question has to have had a particular option enabled for this file to exist, but they often do (especially stock kernels).
You'll want to ungzip that and copy it to the Linux source directory (as .config) to use it.
As a side note, it's usually not worth building your own custom kernel unless you have special patches to apply, or intend to minimalize the entire configuration (and resulting modules).  The performance difference is often minor.
Since you say you're just doing it for fun, well, enjoy.  You will probably at least learn the names and corresponding kernel modules of all the hardware in your system if you go down the minimal route

Similar Messages

  • How to recompile the kernel

    I have a problem in recompiling the kernel. I am not able to see the steps to recompile the kernal . I am using Redhat Linux 7.1 and i have installed Oracle 8i and i have modified the kernal parameters . after modifying i must recompile the Kernel .
    Can anyone give me steps to recompile the Kernel.

    Red Hat has the required directions for kernel compiling here:
    http://www.redhat.com/docs/manuals/linux/RHL-7.1-Manual/custom-guide/kernel-modularized.html

  • How do you recompile the kernel for oracle linux 6.3

    Hello,
    I have installed Oracle linux 6.3 default settings on x86_64 bit pc
    I have some questions:
    1. What public yum repositories contain the oracle linux 6.3 kernel source code ?
    2. Is the oracle linux 6.3 kernel source code on OracleLinux-R6-U3-src-dvd1.iso or OracleLinux-R6-U3-src-dvd2.iso , can I use this to recompile a new kernel ?
    3. Do you have the steps/commands needed to set options and compile a installable kernel[rpm] on oracle linux 6.3 x86_64.
    4. What gui tools are available in the desktop to manage settings e.g sound/volume or to install additional gui utilities.
    5. Is there some documentation help on using the oracle linux desktop ?. If so where is it located .
    Thankyou
    Glenn

    Glenn D. wrote:
    1. What public yum repositories contain the oracle linux 6.3 kernel source code ?None of them. The Oracle Linux kernel source code can be found here:
    https://oss.oracle.com/ol6/SRPMS/
    https://oss.oracle.com/ol6/SRPMS-updates/
    And our git repositories are here:
    https://oss.oracle.com/git/
    The default kernel in OL6.3 is here:
    https://oss.oracle.com/git/?p=linux-uek-2.6.39.git;a=summary
    2. Is the oracle linux 6.3 kernel source code on OracleLinux-R6-U3-src-dvd1.iso or OracleLinux-R6-U3-src-dvd2.iso , can I use this to recompile a new kernel ?Actually, I have no idea which DVD the source code is on.
    3. Do you have the steps/commands needed to set options and compile a installable kernel[rpm] on oracle linux 6.3 x86_64.No, you'd need to decide that for yourself. The kernel source is complex and can be very tricky to recompile.
    4. What gui tools are available in the desktop to manage settings e.g sound/volume or to install additional gui utilities.Wow, topic shift. GNOME Control Center manages settings and installing new utilities is done by Pirut.
    5. Is there some documentation help on using the oracle linux desktop ?. If so where is it located .Oracle Linux isn't intended to be used as a desktop. All the documentation is here:
    https://linux.oracle.com/documentation/
    http://docs.oracle.com/cd/E37670_01/index.html

  • Recompiling the kernel for a single driver/patch

    Hi,
    I've just successfully compiled a kernel in order to use saaros's sentelic touchpad patch. My question is: do I really have to do that every time I want to update the kernel? eg, I can't build that one driver as a separate module? Also, is it possible to distribute the binary files and use them with a stock kernel? How likely is it that this code will make its way into the official source?
    Thanks, Jamie
    Last edited by JamieKitson (2012-02-25 17:39:40)

    Have a look at this if you haven't already.
    https://github.com/saaros/sentelic/issues/2
    I am not familiar with this patch but you may be able to build under /usr/src/linux. Of course install linux-headers etc first.
    Good luck!

  • How to recompile the Intel Solaris kernel

    HI,
    I installed Intel solaris on x86 system. As per the manual U should change parameters in /etc/system file to configure semaphores and kernel memory . After updating the /etc/system file ,restart is required to take parameters in effect. But even after reboot the system is not getting configured as per the /etc/system settings.
    Is there any other way to recompile the kernel?
    Please let me know on [email protected]
    Thanks in Advance,
    Sagar

    You never recompile the Solaris kernel. Exactly what are you putting in /etc/system? How are you determining whether or not the changes took effect? What release of Solaris?

  • How to compile a kernel module without recompiling the whole kernel?

    Hi,
    I'm pretty sure my question is a bit newbish, still I haven't been able to found any information/solution to my problem in 3days.
    The kernel I use doesn't come with the module I need for my hardware and I would like to know if there's a way to compile it without having to make a new kernel myself (since compiling the kernel takes ages on my machine).
    Even if your answer is a "Let me Google that for you", I'm so desperate that I'll be happy to see it.
    Thank you all in advance for your answers!

    Do you have a /proc/config.gz that you could use? Otherwise I don't know. I mean, many modules should be compilable simply with the system-installed kernel headers, but not all native modules might follow that rule.
    Unfortunatel most of what you find on the web talks about how to create new modules which can be compild against the installed kernel tree, not about how to compile one of the native kernel modules against it.
    Actually, try what those links suggest.
    Skip the configuration part, and just do:
    make -C /lib/modules/`uname -r`/build M=$(PWD)/drivers/video modules
    (maybe `make -C /lib/modules/`uname -r`/build M=$(PWD)/drivers/video clean` first )
    EDIT: Meh, that uses your config and won't build that driver... there must be some way though
    EDIT2: Try:
    make -C /lib/modules/`uname -r`/build M=$(PWD)/drivers/video modules CONFIG_FB_VT8623=m CONFIG_FB_SVGALIB=m
    The problem though is, that they might have removed some of the dependencies of the module, so if it doesn't compile, you'll have to recompile the kernel.
    Good thing is though, you can use their .config as base (found in /usr/src/linux-..../.config)
    You can also check if your config "supports" your module by putting it into the kernel source tree, running `make menuconfig` and typing /8623 and pressing enter.
    The last line in that screen should read:
    Selects: <list of options>
    As long as all of those options are either =y or =m, you're good. SVGALIB can be =n because it's part of drivers/video/ and you can compile it together with  your module.
    Last edited by Blµb (2012-03-02 15:14:16)

  • [SOLVED]How to patch the kernel? And other questions

    Like the same user who started this thread I'm suffering from hibernation resuming troubles using kernel 2.6.38. In that thread was posted a soluttion that involves patching the kernel.
    The patch to apply is this:
    http://git.kernel.org/?p=linux/kernel/g … e3e9fc8684
    Waiting for the bug to be corrected and a new version supplied is not an option, because this laptop is my main computer and I heavly rely on hibernation.
    Here's my trouble now. I don't know if it is possible to patch without recompiling the whole kernel, or it has to be compiled with that patch applied. I have seen the archlinux's wiki guide about compiling the kernel, but found nothing about applying patches (maybe I didn't searched with enought depth).
    In case there is needed a full compilation, should I use the vanilla kernel, the Arch Linux one or any of the AUR ones (I said AUR because they're the first that came to my mind)? Should i expect a performance gain with this (apart from fixing the hibernation bug)?
    Maybe i'm just doing a bunch of dumb questions, and the only thing I need is to search deeply on the wiki. In that case, please tell me. If not, I rather get some answers around kernel patching and / or compiling questions.
    Edit: In addittion, it is possible that all this questions are just newbie ones, I don't know, but as I am willing to learn from this I will appreciate any info or documentation about it.
    Thank you.
    Last edited by ethail (2011-04-12 06:30:48)

    From the source tree (/usr/src/linux-whatever) execute
    patch -p1 < /path/to/fix.patch
    then recompile kernel from the source tree.
    Basically that consists of executing the following commands from the source tree:
    make menuconfig
    make
    make modules_install
    cp -v System.map /boot/System.map-CUSTOM
    cp -v arch/x86/boot/bzImage /boot/vmlinuz-CUSTOM
    mkinitcpio -k 2.6.38-CUSTOM -g /boot/kernel-CUSTOM.img
    and you need to add menu entry in /boot/grub/menu.lst
    -k 2.6.38-CUSTOM should corespond to /lib/modules/2.6.38-CUSTOM (replace 2.6.38-CUSTOM with the name of your module directory, name depends on the kernel version and suffix that you gave in menuconfig). Regarding kernel configuration in menuconfig - I can't help you, you could use arch stock kernel config (zcat /proc/config.gz > /usr/src/linux-whatever/.config)
    I do these kind of things this way - maybe someone else have a more elegant solution.

  • Automatic recompiling of kernel module after kernel update.

    Hello everyone,
    i tried to search for it but without success...
    my question is - is it possible to set it up somehow that aur package would recompile after kernel update?
    The package I would like to rebuild is rt3090 which is module for my wifi card. It is very annoying to rebuild it manually. I know that my fglrx module does it automaticaly but how to set it?
    Thank all of you for any advise.

    Thank you :-) It looks ok, I will try DKMS as soon as I get some free time. If there was any problem, I would tell you.
    BTW: I use catalyst mainly because of saving energy management, which is of course better for my netbook. My card is too new to be fully supported by the opensource driver.
    EDIT:
    I solved the situation by upgrading my system, I tried in-kernel module rt2800pci. In the previous kernels it didn't work well with my crappy ralink rt3090 wifi card, but that's been improved :-) so I do not need rebuild the package anymore even because this module isn't compatible with newest kernel.
    I also learnt how to write my own hook from archwiki (https://wiki.archlinux.org/index.php/Mkinitcpio) so if the new module didn't work I would try it.
    The final solution = replace module rt3090sta by rt2800pci.
    Thanks! Arch has very powerful community :-)
    Last edited by h@lf@rk (2012-06-02 18:34:17)

  • Manually compiling the kernel aith PKGBUILD

    Hi!
    I am at the moment trying to recompile my kernel using the Arch Package management. So i picked a HowTo ( http://wiki.archlinux.de/?title=Eigener … _erstellen (It's german)) and followed it. The kernel was compiled and the kernel26custom-2.6.23-1-i686.pkg.tar.gz was created, but i can't install it. When i try to do it, the error output is as follows:
    pacman -U kernel26custom-2.6.23-1-i686.pkg.tar.gz
    Lade Paketdaten ... Fertig.
    Prüfe Abhängigkeiten... Fertig.
    Räume auf... Fertig.
    (1/1) Pruefe auf Dateikonflikte [####################################################] 100%
    Fehler: Konnte Vorgang nicht vorbereiten (In Konflikt stehende Dateien)
    kernel26custom: /lib/modules/2.6.23-ARCH/build existiert im Dateisystem
    kernel26custom: /lib/modules/2.6.23-ARCH/kernel/arch/i386/crypto/aes-i586.ko existiert im Dateisystem
    kernel26custom: /lib/modules/2.6.23-ARCH/kernel/arch/i386/crypto/twofish-i586.ko existiert im Dateisystem
    kernel26custom: /lib/modules/2.6.23-ARCH/kernel/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.ko existiert im Dateisystem
    kernel26custom: /lib/modules/2.6.23-ARCH/kernel/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.ko existiert im Dateisystem
    kernel26custom: /lib/modules/2.6.23-ARCH/kernel/arch/i386/kernel/cpu/cpufreq/e_powersaver.ko existiert im Dateisystem
    [...]about 1000 Lines follow which files already exist in the file system)[...]
    kernel26custom: /usr/src/linux-2.6.23-ARCH/sound/soc/at91/Kconfig existiert im Dateisystem
    kernel26custom: /usr/src/linux-2.6.23-ARCH/sound/soc/codecs/Kconfig existiert im Dateisystem
    kernel26custom: /usr/src/linux-2.6.23-ARCH/sound/soc/pxa/Kconfig existiert im Dateisystem
    kernel26custom: /usr/src/linux-2.6.23-ARCH/sound/soc/s3c24xx/Kconfig existiert im Dateisystem
    kernel26custom: /usr/src/linux-2.6.23-ARCH/sound/soc/sh/Kconfig existiert im Dateisystem
    kernel26custom: /usr/src/linux-2.6.23-ARCH/sound/sparc/Kconfig existiert im Dateisystem
    kernel26custom: /usr/src/linux-2.6.23-ARCH/sound/usb/Kconfig existiert im Dateisystem
    kernel26custom: /usr/src/linux-2.6.23-ARCH/usr/Kconfig existiert im Dateisystem
    Fehler aufgetreten, keine Pakete wurden aktualisiert.
    The rough translation of this error is, that a lot files were found that already exist and won't be replaced. I am a bit afraid to uninstall my current kernel package and install mine, i don't want to break my system...Or can i safely just rm -r  the kernel sources in /usr/src/linux-2.6.23-ARCH ?
    Thanks in advance, Hauke

    somairotevoli wrote:
    try pacman -Uf kernel26custom-2.6.23-1-i686.pkg.tar.gz
    that will force to replace those files.
    Wait, now! That is really not a very good idea, you'd get (possibly) quite a mess. The problem is that your custom compilation is using the same library path as the stock kernel, so the best thing would be to fix your PKGBUILD to put its modules in /lib/modules/2.6.23-custom (for example). I'm afraid I can't off the top of my head tell you how to do that, but maybe someone else can ...?
    If the wiki page is missing this information it would be nice if someone could fix it. You could have a look at the English wiki page(s) - maybe there's something there?

  • [Solved] Recompile Existing Kernel

    Hello,
    I just want to recompile my existing kernel, and I do the zcat /proc/config.gz > .config thing and the make oldconfig thing, but still when I recompile I get an error about not finding root device...
    Pretty much, I just want to recompile my kernel the way it is. Just take some stuff that I don't use out of it. How can I do that?
    Thanks for the help.
    PS: Does anyone know how to setup RAID hardware on arch, a friend is wondering.
    Last edited by haxit (2008-09-15 23:04:09)

    haxit wrote:Ok, so how can I do this alongside my kernel?
    ...and modify the .config file?

  • Unable to load the kernel module 'nvidia.ko' [SOLVED]

    After my most recent kernel upgrade, I can't get my GUI to run. I've tried reinstalling the nvidia driver to no avail.
    Any insight would be greatly appreciated. I'm using a GeForce 8400 GS
    cat /var/log/nvidia-installer.log
    ERROR: Unable to load the kernel module 'nvidia.ko'. This happens most
    frequently when this kernel module was built against the wrong or
    improperly configured kernel sources, with a version of gcc that differs
    from the one used to build the target kernel, or if a driver such as
    rivafb/nvidiafb is present and prevents the NVIDIA kernel module from
    obtaining ownership of the NVIDIA graphics device(s), or NVIDIA GPU
    installed in this system is not supported by this NVIDIA Linux graphics
    driver release.
    Please see the log entries 'Kernel module load error' and 'Kernel
    messages' at the end of the file '/var/log/nvidia-installer.log' for
    more information.
    -> Kernel module load error: insmod: error inserting './usr/src/nv/nvidia.ko':
    -1 No such device
    -> Kernel messages:
    NVRM: This can occur when a driver such as nouveau, rivafb,
    NVRM: nvidiafb, or rivatv was loaded and obtained ownership of
    NVRM: the NVIDIA device(s).
    NVRM: Try unloading the conflicting kernel module (and/or
    NVRM: reconfigure your kernel without the conflicting
    NVRM: driver(s)), then try loading the NVIDIA kernel module
    NVRM: again.
    NVRM: No NVIDIA graphics adapter probed!
    NVRM: The NVIDIA probe routine was not called for 1 device(s).
    NVRM: This can occur when a driver such as nouveau, rivafb,
    NVRM: nvidiafb, or rivatv was loaded and obtained ownership of
    NVRM: the NVIDIA device(s).
    NVRM: Try unloading the conflicting kernel module (and/or
    NVRM: reconfigure your kernel without the conflicting
    NVRM: driver(s)), then try loading the NVIDIA kernel module
    NVRM: again.
    NVRM: No NVIDIA graphics adapter probed!
    NVRM: The NVIDIA probe routine was not called for 1 device(s).
    NVRM: This can occur when a driver such as rivafb, nvidiafb or
    NVRM: rivatv was loaded and obtained ownership of the NVIDIA
    NVRM: device(s).
    NVRM: Try unloading the rivafb, nvidiafb or rivatv kernel module
    NVRM: (and/or reconfigure your kernel without rivafb/nvidiafb
    NVRM: support), then try loading the NVIDIA kernel module again.
    NVRM: No NVIDIA graphics adapter probed!
    ERROR: Installation has failed. Please see the file
    '/var/log/nvidia-installer.log' for details. You may find suggestions
    on fixing installation problems in the README available on the Linux
    driver download page at www.nvidia.com.
    Last edited by wsims (2010-06-22 15:06:04)

    if you used the packages from repos, the blacklist is done automatically in nvidia,
    $ pacman -Qo /etc/modprobe.d/nouveau_blacklist.conf
    /etc/modprobe.d/nouveau_blacklist.conf is owned by nvidia 195.36.31-1
    $ cat /etc/modprobe.d/nouveau_blacklist.conf
    blacklist nouveau
    but i guess you just want to mess your system by using unsupported and very bad ways and you are way smarter than the devs if you used that installer
    Last edited by wonder (2010-06-22 14:10:01)

  • MacBook Windows7 install failing - ntkrnlpa.exe - "Windows failed to load because the kernel is missing, or corrupt."

    Trying to do BootCamp Windows-7 install on my MacBook (running 10.5.x).
    Detailed progress notes here. Latest: "Windows failed to load because the kernel is missing, or corrupt." (ntkrnlpa.exe) Hit `Enter` to continue, make next selection, but it comes back to error message. So shut down (power button) then reboot with Windows DVD still in there. Ended up with same error!

    Best thing to do is nuke the drive, then reinstall Vista again.
    I know this is a long process but should get you back running again.
    Linux makes odd partitions that recovery does not understand and they don't get deleted properly, boot and nuke will take care of that.

  • [SOLVED]Unable to boot into the kernel I compiled, kernel panic

    I try to compile a kernel myself and boot into it, and I use virtualbox to test it. (arch guest inside my arch host)  I first copy /proc/config.gz of my guest system to the linux source code directory, rename it to .config, and just compile it. After that I copy the image under arch/x86/bzImage to /boot directory, then I follow the instruction given by the arch wiki to create an entry in grub. Here is my /etc/grub.d/40-custom:
    #!/bin/sh
    exec tail -n +3 $0
    menuentry 'Custom Entry' {
    set root=(hd0,msdos1)
    echo 'Loading Modified Linux'
    linux /boot/vmlinuz-modified
    echo 'Loading initial ramdisk ...'
    initrd /boot/initramfs-linux.img
    following is this command:
    grub-mkconfig -o /boot/grub/grub.cfg
    But after reboot I cannot boot into the new kernel, it shows "unable to mount root fs on unknown-block(0,0):
    https://img.vim-cn.com/e5/5227d8d4cc07c … ce81ee.png (choose "Advanced Option for Archlinux-> With Linux Modified")
    https://img.vim-cn.com/a9/12869edfbbca1 … 649380.png (choose "Custom Entry" on the first page directly)
    I have searched for a while but didn't find a solution. Is there anything I'm doing wrong, please?
    Last edited by Frefreak (2015-05-07 10:48:05)

    Head_on_a_Stick wrote:
    Frefreak wrote:I think I did compress it, if I remember correctly. (I actually built it several times)
    I am referring to /proc/config.gz -- this is a gzip archive and needs to be decompressed before you can use it to compile your kernel image.
    This isn't strictly true, it just makes the process easier because you're starting with a sane .config (assuming you're booted into one of Arch's official kernels at least). You can start from scratch, but you need to know what you're doing.
    Frefreak wrote:Ok, I'll rebuild everything from the beginning later.
    No need to rebuild everything, just generate an initramfs for the custom kernel. The initramfs contains modules that are specific to a the kernel image that they were generated for; this is probably why /boot/initramfs-linux.img isn't working for you.

  • How could i get the kernel and user cpu usage for each process

    Hi all,
    In order to monitor the system CPU usage, I would like write a script to gather the kernel and user CPU usage for each process, like the prstat or top does. As always missing the shortlived kernel usage, prstat or top cann't get the precise CPU usage. I checked with the dtrace syscall, proc and fbt provider, but don't get which one is useful.
    Please provide your comments and suggestion.
    Thanks in adv

    mail2sleepy wrote:
    As I've studied the "dtrace" for a while, and seems Sun gives a pretty high score on this new feature.....I do want to know whether there's some probe can work for it, like writing a "dtrace" version prstat.You can write a prstat without dtrace. Because that's just polling at specific intervals and reading some process structures from /proc. You could have dtrace fire a probe every 5 seconds and read the same thing, but it wouldn't really be using any features of dtrace. Trhying to write it "in dtrace" doesn't make much sense.
    What you could do that would be harder via other methods is to fire a probe at process exit that displayed the process information including total CPU time. They could print exactly when processes exited. Doing that without dtrace would be very difficult.
    Darren

  • How to get cwd of the current process in the kernel in Solaris 8

    Hi, everyone
    Does any one know how to get the path name of the current working directory of the current process in the kernel in Solaris8 ?
    I searched the forum and got some related links, but none of them gives a clear solution.
    Sample code can help a lot!
    Thank you!

    NiuLin wrote:
    Thanks for the reply.
    What the user structure contains is the vnode pointer of the cwd, but I want go get the pathname of it, like /export/home/abc/.First, all you can get is a path name - there can be more than one. And then there's the problem of determining the path name you want if the process is running under chroot.
    Assuming you don't have to deal with those, there's this thread:
    http://forum.java.sun.com/thread.jspa?threadID=5084620&messageID=9298124
    Of course, that thread doesn't say how to do that. But it appears to be part of Solaris 10.
    I once had to solve this same problem for a Linux kernel module I wrote, so I know it's theoretically possible. But I also know it's not as simple as it seems it should be, and any results you do get are not guaranteed to be unique and, IIRC, not even correct in some cases.
    Sorry I can't be more specific than that right now.

Maybe you are looking for