S.A.K.C. - SUSE Automated Kernel Compiler - Version 2.60

That would be a good idea Frederic007, but only Moderators can modify a message after it has been posted for 10 minutes. The best I could do is put a never changing link in it I guess, but otherwise, I just have to post another message at the end, like I am doing now. I think that original posters should be able to modify their message when ever they want, but it is not so here. I suppose you could make that suggestion to the forum Moderators. Until then, just read to the end and thanks so much for your comments.

Thank You,

Following is a script file called KLIST, version 1.10, which is a companion to the S.A.K.C. script and its purpose is to do the following:

  1. List all kernel source files in your default (~/Downloads) Folder.
  2. Allow you to select the kernel to compile, by entering a number from a list without knowing the exact name beforehand.
  3. Change to the default kernel compile folder (~/Kernel).
  4. Start S.A.K.C. with the name and path to the kernel source file you selected.

This latest version of KLIST validates user input as an integer, in the range of Kernel Source files found, exits if no files are found, ignores invalid entries and looks for a Q to quit if desired. More comments have been added to the script and the error messages expanded.

KLIST requires that you make the following three entries correct, shown below.

#
# Please Make Sure these names are correct - Do not include a "/" at the end...
#

# Where do your Keep Your Kernel Source Files?
kernel_folder=~/Downloads

# Where do you want to place your Compiled Kernels?
compile_folder=~/Kernel

# Where is SAKC located and what is it called  (folder/name)
sakc_name=~/bin/sakc

The new text Display Looks like this:

KLIST - Kernel Source File Lister for S.A.K.C. - V 1.10

S.A.K.C. Location/Name: /home/james/bin/sakc

Kernel Compile Folder: /home/james/Kernel
Kernel Source Folder: /home/james/Downloads

  1. linux-2.6.35.10.tar.bz2
  2. linux-2.6.35.9.tar.bz2
  3. linux-2.6.36.2.tar.bz2
  4. linux-2.6.37-rc7.tar.bz2
  5. linux-2.6.37-rc8.tar.bz2

Enter the Kernel Source File Number to Compile (q=Quit):

For KLIST to work, You have already downloaded and made active the S.A.K.C. script file.

Copy and Paste the text of this script into a text editor and save it as the file klist in your home area bin folder (~/bin/klist).

#!/bin/bash

#: Title       : klist - Kernel Source File Lister/Selector for S.A.K.C.
#: Date Created: Sun Dec 19 17:39:18 CST 2010
#: Last Edit   : Thu Dec 30 19:44:00 CST 2010
#: Author      : J. McDaniel
#: Version     : 1.10
#: Description : list kernel source files for one to be selected for use with S.A.K.C.
#: Options     : klist [kerenl_source_file.tar.bz2]
# 

#
# Written for the openSUSE forums on Thursday December 30, 2010
#

TITLE="KLIST - Kernel Source File Lister for S.A.K.C. - V 1.10"

#
# Copy and Paste the text of this script into a text editor and save 
# it as the file klist in your home area bin folder (~/bin/klist).
# This script must be marked executable to be used.  Please run 
# the following Terminal command: chmod +x ~/bin/klist
# To use klist, download the latest kernel source files from ...
# http://www.kernel.org/ into your download(s) folder.
# Open up a terminal session, change to your download(s) folder
# and run the command: klist
#

#
# Please Make Sure these names are correct - Do not include a "/" at the end...
#

# Where do your Keep Your Kernel Source Files?
kernel_folder=~/Downloads

# Where do you want to place your Compiled Kernels?
compile_folder=~/Kernel

# Where is SAKC located and what is it called  (folder/name)
sakc_name=~/bin/sakc

#
# Common Text to Display When an Error is Detected
#
function error_message {
  tput clear
  echo "$TITLE"
  echo
  echo "$1"
  echo
}
#
# Check to make sure klist was not started as Root
#
if  $UID -eq 0 ] ; then
  error_message "Please Do Not Run $0 as a Root User!"
  exit 1
fi
#
# Make sure the sakc script file exists in the folder specified
#
if  ! -e "$sakc_name" ] ; then
  error_message "The S.A.K.C. Kernel Source File Compiler: $sakc_name, was not found!"
  exit 1
fi 
#
# Determine if the compile_folder exists
#
if  -d "$compile_folder" ]] ; then
  cd "$compile_folder"
else
  error_message "The Kernel Compile Folder: $compile_folder, does not exist!"
  echo "Please create or change this folder name and start $(basename $0) again."
  echo
  exit 1
fi
#
# Determine if a kernel file name was given at start
#
if  $# -eq 0 ] ; then
#
# Determine if the kernel_folder (default is ~/Downloads) Exists
#
  if  -d "$kernel_folder" ]] ; then

    menu=true

    while $menu ; do

      tput clear
      echo "$TITLE"
      echo
      echo "S.A.K.C. Location/Name: $sakc_name"
      echo
      echo " Kernel Compile Folder: $compile_folder"
      echo " Kernel Source  Folder: $kernel_folder"
      echo 

      counter=0
      declare -a kernels
#
# Find and display all files that start with linux* and end with .tar.bz2
#
      for i in "$kernel_folder"/linux*.tar.bz2 ; do 
#
# Determine if the kernel source file exists
#
    if  -f $i ] ; then

      let counter=counter+1
      kernels$counter]=$i 
      echo " $counter) $(basename ${kernels$counter]})"

    fi

      done
#
# Determine if any Kernel Source Files were found
#
      if  $counter -eq 0 ]]; then

    echo
    echo "No Kernel Source Files were found in $kernel_folder!"
    echo
    exit 1

      fi
#
# Main Program Prompt Displayed Here
#
      echo
      echo -n "Enter the Kernel Source File Number to Compile (q=Quit): "
      read CHOICE
#
# Determine if input ($CHOICE) is an integer number and in range, look for Q to 
# Quit. If menu is not set to false, the menu will just be redisplayed as you 
# did not enter a valid menu option number for a kernel source file to compile.
#
      if  $CHOICE =~ ^[0-9]+$ ]] ; then
    if  $CHOICE -le $counter ]] &&  $CHOICE -gt 0 ]]; then
      menu=false
    fi
      else
    if  $CHOICE == [Qq] ]] ; then
      exit 0
    fi
      fi

    done

    $sakc_name ${kernels$CHOICE]}

  else
#
# The Kernel Source File Folder (default=~/Downloads) was not found
#
    error_message "The Kernel Source File Folder: $kernel_folder, does not exist!"
    exit 1

  fi

  exit 0

else

#
# For this to be used, you suplied the full name/path to the kernel 
# and just switched to your kernel compile folder
#
  $sakc_name %1

fi

exit 0
# End Of Script

This script must be marked executable to be used. Please run the following Terminal command:

chmod +x ~/bin/klist
                          To use klist, download the latest kernel source files from ... 

The Linux Kernel Archives

and save the source file into your downloads folder. Open up a terminal session and run the command:

klist

Again, you must already have the S.A.K.C. script file on your computer before you can use klist. If you have any comments, problems or requests, please let me know.

Thank You,

Before:
TNX
Then:
TNX very much !!!
This tool make me free to try all the config that i want without loosing time.
On i7 950 near 10min for compile lol!
Tried and work perfectly.

Before:
TNX
Then:
TNX very much !!!
This tool make me free to try all the config that i want without loosing time.
On i7 950 near 10min for compile lol!
Tried and work perfectly.
You are very welcome giostark and thanks for the kind words.

Thank You,

Motivated by a problem discussed here - Kernel 2.6.37-rc8 and Display problem(s), I used the above procedure to re-install kernel 2.6.37-rc7. This was my first attempt at S.A.K.C, and I experienced a few problems (most likely mine own inexperience):

  1. After following the script install, I located and downloaded the kernel (2.6.37-rc7.tar.bz2) - successfully.

  2. I let the prompt on review in GUI sit for a bit (inattention). When I responded, I received error 127. Cause: “make” command not found. Resolution: installed “make”.

  3. Repeated code 127 failure necessitated removal of the decompressed folder.

  4. Next attempt presented failure code “2”. Cause: “gcc” command not found. Resolution: installed “gcc”.

  5. Succeeding attempt, I elected to review the specifications/configuration in a GUI. Received failure code “2”, saved the log.

  6. Finally, bypassing review, successfully compiled kernel, 34 minutes (on an i5-430, 4G, openSUSE 11.3 kernel 2.6.34.7-07.1).

I have no metric to compare the compile timings. The missing module(s) troubled me, so I checked two other DVD-installed 11.3 PC’s: both “make” and “gcc” absent. While one may make the case that these packages should have been present, may I suggest including checks for such in your next (or some future) iteration of S.A.K.C ?

One last thought: I am writing this whilst running on the S.A.K.C.-generated kernel, but a check in YAST Software Management shows no awareness of this kernel. Further, the kernel tar.bz2 generated the 2.6.36-rc7-0.7 kernel. As YAST is not aware of this kernel, and I suppose zypper is equally blind, is there any way to update from -rc7-0.7 to -rc7-28.1 (or any other update version) ? I noticed some patch files (.bz2, .bz2.sign, .gz and .gz.sign) in the archives.

This is a great tool for handling multiple diverse kernels, while letting YAST manage the official stuff. This is, of course, a definite advantage allowing preservation of the supported and/or “working” versions!

Hello SeanMc98 and thanks for giving SAKC a try. Normally, to use SAKC, I recommend you go into YaST / Software Management, select the View button and go to patterns. In pattern mode, elect to install Base Development, C++ Development and Kernel Development as patterns. Anyone wanting to compile a kernel from scratch would need these installed which installs many files for you.

Next, to the issue of uninstalling an Installed kernel. Well, any kernel you install outside of YaST, can not be removed by YaST. That means, that once you are done with using an older kernel; you remove the two entries it makes in your grub menu.lst file, you delete the three kernel files it creates in your /boot folder and removed the entire kernel compile folder. Finally you can get rid of the bz2 file if you like.

The good thing is it does not do away with any of your kernels installed from YaST, you can use any kernels you have saved or can be downloaded from the kernel.org web site and I feel you are much more in control using the kernel configuration GUI from SAKC, if you know what you are looking for. For instance I have been enabling the CGGROUP to use another kernel speed up I came up with. I have went through and disabled all experimental entries. I even went in and enabled floppy disk support, which had been disabled by default.

Thank You,

Hi where can i download the tool? it looks to me like a bash script. but i place for download or even a repo in the buildservice would be nice.

l1zard Hi where can i download the tool? it looks to me like a bash script. but i place for download or even a repo in the buildservice would be nice.
SAKC is just a bash script file. Message #17 in this thread caries the most recent version of this script. Just copy and past the contents of the code block into a text editor and save the file as the name sakc in the folder ~/bin, which is in your home bin folder. Then, execute the following command to make it executable:


chmod +x ~/bin/sakc

To run SAKC, just open up anther terminal session and type the command:

sakc /path/kernel-version.tar.bz2

In order to compile your own kernel, you need to first download the latest kernel file from:

The Linux Kernel Archives

In order to be able to compile a kernel file you need to load the kernel development, base development and C++ development files into your PC. You can do that running YaST / Software / Software Management, select the View button on the top left and select Patterns. Then check off the Base, C++ and Kernel Development tools and allow them to be installed.

I will look into placing the file into the OBS build, but I was thinking you had to add any person to the list to be able to download your files, but I could be wrong about that.

I use SAKC all of the time and it has been working very well for me. I also include the program KLIST, a script that helps maintain the folder system for kernel compiles and to allow easy selection of the kernel you want to compile when you have downloaded a lot of them for testing.

Thank You,

hmm ok maybe i wasn’t clear about this in the first place.

i was thinking about somethink like you put in a git repository. so it would be easy to download or commit to this project or to keep track of different versions and bugs.
just a thought :wink: what do you think about this idea?

I think it compiles it with the GNU C Compiler. I was thinking that it would be great if I install the Intel C Compiler to be able to compile with it to get some serious performance boost…

aliancemd I think it compiles it with the GNU C Compiler. I was thinking that it would be great if I install the Intel C Compiler to be able to compile with it to get some serious performance boost…
I am not sure about that aliancemd. You would need to do it normally and then do it as you suggest to see if there was any difference, but I did not think you could compile it without the original intended compilers. I must say though I am surely not the expert in that area. If you do accomplish any thing outstanding, remember where you found SAKC and share that information here with your friends and good luck.

Thank You,

Many TNX

I have followed this thread during the for many days. I was a little apprehensive about trying out a simple Kernel Update. I did, using S.A.K.C ver2.10 and KLIST 2.10, and my response is WOW !!! You have produced what is, to my aged and fast diminishing mind, the most erudite set of instructions enabling the latest Kernel to be compiled without problems if followed as you suggest.

My system took 63 minutes to compile the latest Kernel - Linux 2.6.38-rc5-20-desktop x86_64 on my openSUSE desktop PC based on openSUSE 11.4 RC 1 (x86_64) running KDE:4.6.00 (4.6.0)

A great success with no hiccups whatsoever worked like a charm. Thankyou

AMD Athlon™ 64 X2 Dual Core Processor 4600+ 4GB Memory Nvidia GeForce 6800 GS with 500Mb graphics Memory. 2D driver:nouveau 3D driver:swrast (No 3D Acceleration) (7.10))

Many TNX

I have followed this thread during the for many days. I was a little apprehensive about trying out a simple Kernel Update. I did, using S.A.K.C ver2.10 and KLIST 2.10, and my response is WOW !!! You have produced what is, to my aged and fast diminishing mind, the most erudite set of instructions enabling the latest Kernel to be compiled without problems if followed as you suggest.

My system took 63 minutes to compile the latest Kernel - Linux 2.6.38-rc5-20-desktop x86_64 on my openSUSE desktop PC based on openSUSE 11.4 RC 1 (x86_64) running KDE:4.6.00 (4.6.0)

A great success with no hiccups whatsoever worked like a charm. Thankyou

AMD Athlon™ 64 X2 Dual Core Processor 4600+ 4GB Memory Nvidia GeForce 6800 GS with 500Mb graphics Memory. 2D driver:nouveau 3D driver:swrast (No 3D Acceleration) (7.10))
You are very welcome hawkshead and thanks for the kind words. It was my hope that SAKC would allow anyone to do a major kernel update/replace if they wanted to without doing any harm to their system and retaining their existing kernel should they want or need to drop back to the original version. The only issue as it were is no automatic removal of kernels you do not want any more. This happens when users install several release candidates onto their PC before the final comes out. Should you desire info on how to manually get rid of a compiled kernel you no longer want, just ask.

Thank You,

Does the script use the -j4 option for “make” on a dual core or is the athlon slower than I think? Never had an AMD chip but it seems a bit long. I think best performance is two threads per chip (“make -j[2*number of cores]”), but of course if you want to do stuff in the background it might be just as well to leave it alone, and that is just something I picked up from the linux kernel in a nutshell pdf so I’m definitely not sure what’s optimal.

Edit: The pdf is here, Linux Kernel in a Nutshell, chapter 4 covers the -j option http://www.kernel.org/pub/linux/kernel/people/gregkh/lkn/lkn_pdf/ch04.pdf

Yes malcolm81 it does. Here is the coding that does that from SAKC.

#
# Set Number of Compile Jobs based on number of CPU's times two
#
Number_CPUS=$(grep "processor" /proc/cpuinfo | wc -l)
Jobs=$(($Number_CPUS+$Number_CPUS))

make -j$Jobs

Thank You,

Hi James, just a TY for the script, I upgraded my kernel last night:

stephen@home:~> uname -a
Linux home 2.6.37.2-0.6-default #1 SMP Sun Mar 6 04:19:32 GMT 2011 i686 athlon i386 GNU/Linux

It all went painlessly (127 minutes though!)

Hi James, just a TY for the script, I upgraded my kernel last night:
stephen@home:~> uname -a Linux home 2.6.37.2-0.6-default #1 SMP Sun Mar 6 04:19:32 GMT 2011 i686 athlon i386 GNU/Linux
It all went painlessly (127 minutes though!)
Happy to hear of your success and thanks for your kind words. So a couple of hours is kind of long and longer than I have had to wait on my PC, but oldcpu may have the record with 600 minutes, or 10 hours with a virtual desktop setup on one of his PC’s. My very first compile took right at an hour, but I have an Intel i7 2600K Sandy Bridge CPU that clocks in at eight minutes. Oddly, right after I purchased this new motherboard & CPU, I found out three days later it was being recalled by Intel due to a defect in the motherboard chipset. It is hard to stay ahead in this industry it would seem.

Thank You,

Hi Jdmcdaniel3, since grub is a dependency that is not fulfilled on my system (trustedgrub instead) would this influence the script? Normally with trusted grub the process should compile as well as with grub, or am I wrong?

Hi Jdmcdaniel3, since grub is a dependency that is not fulfilled on my system (trustedgrub instead) would this influence the script? Normally with trusted grub the process should compile as well as with grub, or am I wrong?
So the last function in SAKC is to do a MAKE INSTALL as a root user. This then places the new kernel in boot AND adds an entry into your grub menu.lst file. So, I am unsure if a trusted grub setup would prevent this though the action of SAKC is done as a root user. Can I assume you have not tried this to see what happens?

Thank You,

Assuming that the trustedgrub breaks the normal install, you could still use the majority of the script. The “make install” installs the kernel using the “installkernel” script at /sbin/installkernel. I am not positive, but I think if you modified that so that the section that sets up the boot loader configuration works with trustedgrub then make install would work just fine. The kernel Makefile has a INSTALLKERNEL variable in it which is set to “installkernel”, my bet is that if you set that to a new script then that would work fine without having to change anything in the /sbin/ directory.

I would probably try to just comment out the part at the end of installkernel that sets up the bootloader, and then try to configure the bootloader by hand, and if that gets to be a chore then figure out how to do it by editing the script.

So long story short, if “make install” with trustedgrub won’t work you could try to either edit /sbin/installkernel or you could edit a copy of it and edit the kernel’s Makefile so that INSTALLKERNEL points to the new script. There might be a way to set the INSTALLKERNEL value from the command line while calling make, but I’m not sure what it is.