While I’m not sure what the deal with the above was, I ended up just getting 3.0.1-rc5 from github and compiling that, against which the VirtualBox modules built with no issues.
I’d still like to know what the deal was with the Suse packages, but at least I have VirtualBox running again.
While I’m not sure what the deal with the above was, I ended up just getting 3.0.1-rc5 from github and compiling that, against which the VirtualBox modules built with no issues.
I’d still like to know what the deal was with the Suse packages, but at least I have VirtualBox running again.
So I looked at github, but could not determine where the entire kernel source files where located. Can you post a link for kernel 3.1-rc5 by chance? DId you see my message thread here on VM’s?
Towards the end of the thread is a link to install please_try_again’s vboxdrv update script you might want to install. It basically detects when the kernel has been updated and reloads the kernel modules for VirtualBox.
Thanks for the tip on the vbox update script, I’ll check it out!
Due to the recent issue with kernel.org server being compromised, Linus temporarily moved the kernel source to github and it is available at: https://github.com/torvalds/linux
If you have any other tips one why I was unable to build with the Suse packages, that would be great. It’s really just and educational exercise now, I’d just like to know how I may have been able to resolve it so as to understand better, that’s all.
If you have any other tips one why I was unable to build with the Suse packages, that would be great. It’s really just and educational exercise now, I’d just like to know how I may have been able to resolve it so as to understand better, that’s all.
Cheers,
Relative Prime
So I had found the link to github, but I simply don’t understand its structure. Where are the entire kernel source files? As for VirtualBox I am using kernel 3.0.4 and I was able to reinstall/build the vbox drivers with no problem, but I have not tried version kernel 3.1.-rc5 yet to see if it might not work with vbox.
First off malcolmlewis, I appreciate your help very much. But often I wonder if perhaps I have simply come from another time where people were intelligent, but you did not expect that they knew all of the details for a complicated action. But, if you provided detailed instructions, a normal person could follow them with success. I was not born knowing how to compile kernel and I have never before used git to download one. Your instructions were right on to download the complete source files, thought I had no idea just what I had. So, here is what I did to compile the latest kernel 3.1-rc6, according to the text displayed.
YaST (enter Root User Password) / Software / Software Management, searched on git and when found, installed it.
I then open up a terminal session and as a standard user ran the commands:
git clone https://github.com/torvalds/linux.git
cd linux
git checkout remotes/origin/HEAD
This seemed to download the full source code, uncompressed from the github web site. It took some time to complete and much longer than downloading a compressed file. It created a folder called linux in my home area ~/linux. The HEAD command indicated I had downloaded the source to kernel 3.1-rc6. In order to compile this kernel using sakc, without modifications, I needed to compress this folder so I open another terminal session and ran the following commands:
mv linux linux-3.1-rc6
tar cjfv linux-3.1-rc6.tar.bz2 linux-3.1-rc6/
cp linux-3.1-rc6.tar.bz2 ~/Downloads
sakc
The latest kernel then did compile as normal. I guess it would be nice to know the modified command required later that would exist after kernel.org comes back online. As always thanks for your help malcolmlewis.
So its not clear why the git files need to be removed. Would they keep the next update from working, using the same folder name of linux, if they where not removed? Can we use the same original Linux folder to run git again and thus save downloading time? Now I given the archive the kernel/Head name of linux-3.1-rc6. But, otherwise it would have been just called linux. When the kernel is compiled, where does this name come from? The name of the archive or is the name linux-3.1-rc6 in the source code and thus the final kernel name would be called linux-3.1-rc6 even though the original folder was called linux? How would one know that rc6 was released or still a work in progress, like you would have seen at kernel.org? Lots of questions I know.
For the record, I am now running the new kernel 3.1-rc6 without any detected problems so far. I reloaded the latest released nVIDIA proprietary video driver 280.13 without error. I am using please_try_again’s script that re-installs the vboxdrv files anytime they are discovered as missing on a restart. AND, to see if it is working, I am running a virtual session using VirtualBox and PCLinuxOS 2011 in Firefox 6.02 just see if all is working OK. So far so good. I see no problems with VirtualBox and kernel 3.1-rc6 to report.
When you clone a git repository, you get all the information needed to
regenerate any kernel back to when Linus wrote git and put the kernel sources
into it. That is why the download was bigger than a normal compressed bz2 file.
You got kernel 3.1-rc5, -rc4, …, 3.0, 3.0-rc7, … If someone complains that
one of my drivers does not work in kernel 2.6.35, I can get the source with a
simple “git checkout v2.6.35” command. If there is a regression, and something
works in 2.6.38, but breaks in later kernels, it is easy to set up a bisection.
You merely specify the first bad kernel and the last good one. Git then picks
one in the middle and creates the sources for it. You build it, boot, and test
if it is broken. After you report good/bad, git bisects the correct half of the
source range, and you repeat until you locate the bad change. By deleting the
…git directory, you removed all that flexibility.
Here is a very crude script file that could fetch and create the kernel tarbal as well as create or update the source files. Here is what I have so far.
#!/bin/bash
#: Title : GitKernelSource
#: Date Created: Mon Sep 12 20:09:41 CDT 2011
#: Last Edit : Mon Sep 12 20:09:41 CDT 2011
#: Author : James D. McDaniel
#: Version : 1.00
#
# Git kernel Source files and or update them in ~/
#
cd ~/
if ! -d "~/linux" ]] ; then
git clone https://github.com/torvalds/linux.git
fi
cd ~/linux
git pull https://github.com/torvalds/linux.git
#
# Get Kernel Version Name for Tarball
#
kernel=$(git checkout remotes/origin/HEAD 2>&1)
size=${#kernel}
let counter=size
temp=""
while $temp != " " ]] ; do
temp=${kernel:$counter:1}
version="$temp$version"
let counter=counter-1
done
len=${#version}
version=${version:1:len-1}
version="linux-$version"
#
# Create Kernel Tarball & copy to ~/Downloads
#
cd ~/
mv linux $version
tar cjfv $version.tar.bz2 $version/
cp $version.tar.bz2 ~/Downloads
mv $version linux
exit 0
# End Of Script
Its getting late here on Monday and the Wife is complaining its time for bed. If you see anything wrong let me know and thank you in advance.
Some cool discussion here - thanks everyone for contributing. Nice job on the script James.
Malcomelewis: Might you have any insight into why I ran into the original trouble in the first post, trying to build the vbox modules against Suse’s kernel-vanilla-3.1.rc5-1.1.x86_64 sources? Of course, they build fine against kernel sources from git, and I’m good running 3.1.0-rc5 that way - but I was just curious as to what I may have been missing with the Suse sources? (I just like to figure out these little issues and be better armed for when the crop up again down the road.)
So, I put together a little better script I have called gitksf for Git Kernel Source File to Tarball Creator. Obviously getting the entire kernel source tree can be used to create all sort of kernel versions. In this case, this script will do the following for you:
Install git if it is not installed
Download the entire kernel source tree from github, where it resides today (will change in the future)
If, the source tree is present, update the tree today
Create a kernel source file tarball as you could download from kernel.org when it was up and running.
Copy the tarball to your ~/Downloads folder for use by any kernel compile script, such as sakc.
The following values can/could/should/perhaps be edited by the user before using the script:
To create the script, copy and paste the text in the following code field below into your favorite text editor and save it as the bash script file into your /home area bin folder as the file gitksf (/home/username/bin/gitksf
#!/bin/bash
#: Title : gitksf
#: Date Created: Mon Sep 12 20:09:41 CDT 2011
#: Last Edit : Tue Sep 13 17:53:41 CDT 2011
#: Author : James D. McDaniel
#: Version : 1.00
#: Description : Git Kernel Source File to Tarball Creator
#: Options : None
TITLE="gitksf - Git Kernel Source File to Tarball Creator - Version 1.00"
downloads=~/Downloads
kernel_source=~/linux
giturl=https://github.com/torvalds/linux.git
#
# Written for the openSUSE forums on Tuesday September 13, 2011 (Progammer's Day)
#
#
# Copy and Paste the text of this script into a text editor and save
# it as the file gitksf in the folder ~/bin (/home/username/bin).
# This script must be marked executable to be used. Please run
# the following Terminal command: chmod +x ~/bin/gitksf
#
#
# This is the standard GPL Statement, leave at the top of the script.
# Just use the command show_gpl after this function for it to be shown.
#
function show_gpl {
echo ""
echo "github is a bash script file written to be used with openSUSE."
echo "Copyright (C) 2011 by James D. McDaniel, jmcdaniel3@austin.rr.com"
echo ""
echo "This program is free software; you can redistribute it and/or modify"
echo "it under the terms of the GNU General Public License as published by"
echo "the Free Software Foundation; either version 2 of the License, or"
echo "(at your option) any later version."
echo ""
echo "This program is distributed in the hope that it will be useful,"
echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
echo "GNU General Public License for more details."
echo ""
echo "You should have received a copy of the GNU General Public License"
echo "along with this program; if not, write to the Free Software"
echo "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"
echo ""
}
#
# Determine if the package git is installed ****************************
#
suselinux="zypper in"
which git > /dev/null
Exit_Code=$?
if $(( Exit_Code )) -ge 1 ] ; then
tput clear
echo "The git Utility Package is not installed!"
echo
echo -n "Would you like to install the git package(y/N)? "
read CHOICE
if $CHOICE == [Yy] ]] ; then
sudo $install git
else
echo "The git Utility Package was not installed!"
exit 1
fi
fi
#
# Main Program starts here
#
clear
echo $TITLE
echo
#
# Git kernel Source files and or update them in ~/
#
cd ~/
if ! -d "$kernel_source" ]] ; then
echo "The Linux Source Folder linux does not exist. Do you wish"
echo -n "to download the entire kernel source at this time? (y/N): "
read CHOICE
if $CHOICE == [Yy] ]] ; then
git clone $giturl
else
echo
echo "Kernel Source Tarball Creation was aborted!"
echo
exit 1
fi
else
cd $kernel_source
echo "Kernel Source File Check Update in Progress ..."
echo
git pull $giturl
fi
#
# Get Kernel Version Name for Tarball
#
kernel=$(git checkout remotes/origin/HEAD 2>&1)
size=${#kernel}
let counter=size
temp=""
while $temp != " " ]] ; do
temp=${kernel:$counter:1}
version="$temp$version"
let counter=counter-1
done
len=${#version}
version=${version:1:len-1}
version="linux-$version"
#
# Create Kernel Tarball & copy to ~/Downloads
#
if ! -e "$downloads/$version.tar.bz2" ] ; then
#
# Request Permssion to proceed with Tarball Creation
#
echo
echo "Kernel/Head reports current kernel version is at: $version"
echo -n "Proceed with kernel tarball creation now? (y/N): "
read CHOICE
if $CHOICE == [Yy] ]] ; then
cd ~/
mv linux $version
echo
echo "Your kernel tarball is being created. Please wait ..."
tar cjfv $version.tar.bz2 $version/ > /dev/null
cp $version.tar.bz2 $downloads
mv $version linux
echo
echo "The kernel file $version.tar.bz2 was copied to $downloads as requested."
else
echo
echo "Kernel Tarball Creation was aborted by user!"
fi
else
echo
echo "The kernel file $downloads/$version.tar.bz2 already exists."
echo "Kernel file Tarball creation was aborted. Please run again at a later date."
fi
show_gpl
exit 0
# End Of Script
The script file gitksf must be marked executable in order to use it. Open up a terminal session and run the following command:
chmod +x ~/bin/gitksf
To use the script, open up a terminal session and run the following command:
gitksf
I would like to thank Malcomelewis and lwfinger for your help in understanding how to use git from the github website. I hope that you might find this script useful and I accept any comments or suggestions you might have concerning the bash script gitksf.
When you clone a git repository, you get all the information needed to
regenerate any kernel back to when Linus wrote git and put the kernel sources
into it. That is why the download was bigger than a normal compressed bz2 file.
You got kernel 3.1-rc5, -rc4, …, 3.0, 3.0-rc7, … If someone complains that
one of my drivers does not work in kernel 2.6.35, I can get the source with a
simple “git checkout v2.6.35” command. If there is a regression, and something
works in 2.6.38, but breaks in later kernels, it is easy to set up a bisection.
You merely specify the first bad kernel and the last good one. Git then picks
one in the middle and creates the sources for it. You build it, boot, and test
if it is broken. After you report good/bad, git bisects the correct half of the
source range, and you repeat until you locate the bad change. By deleting the
…git directory, you removed all that flexibility.
So Larry when the kernel/Head is at 3.1-rc6 as it is now, how would you building kernel 3.0.4 from it? Is that an easy question to answer? The command git show-ref seems to indicates I can go back to version refs/tags/v2.6.11 somehow. But in fact how is that done?
For some reason the git tree from github.com does not seem to contain the 3.0.4 sources. You can however use the Suse Kernel git repo, which I verified does in fact have the 3.0.1 - 3.0.4 sources:
Also, if you would like for your script, I believe git will let you build a tarball of a given version directly, see the section creating tarballs at Following Linux kernel development with git While you method certainly works just too, I thought you might find this useful.
For some reason the git tree from github.com does not seem to contain the 3.0.4 sources. You can however use the Suse Kernel git repo, which I verified does in fact have the 3.0.1 - 3.0.4 sources:
Also, if you would like for your script, I believe git will let you build a tarball of a given version directly, see the section creating tarballs at Following Linux kernel development with git While you method certainly works just too, I thought you might find this useful.
Pete
I see lots of possibilities here and I am mulling over the best way to proceed. I had actually found the link you gave me, though I have yet to digest all the information that it contains. Thanks so much for your comments.
Indeed so many things one might do with the kernel source files. Here is a different way to look at it by requesting the kernel version you want to use.
Install git if it is not installed
Download the entire kernel source tree from github, where it resides today (will change in the future)
If, the source tree is present, update the tree today
Enter the kernel version you want to create as a tarball
Create the kernel source file tarball as you could download from kernel.org when it was up and running.
Copy the tarball to your ~/Downloads folder for use by any kernel compile script, such as sakc.
The following values can/could/should/perhaps be edited by the user before using the script:
To create the script, copy and paste the text in the following code field below into your favorite text editor and save it as the bash script file into your /home area bin folder as the file sgtb (/home/username/bin/sgtb
#!/bin/bash
#: Title : sgtb
#: Date Created: Wed Sep 14 17:23:27 CDT 2011
#: Last Edit : Thu Sep 15 20:15:00 CDT 2011
#: Author : James D. McDaniel
#: Version : 1.00
#: Description : kernel source tarball creator
#: Options : none
TITLE="SGTB - SuSE Git Kernel Tarball Creator - Version 1.00"
declare -a sum
declare -a ker
downloads=~/Downloads
kernel_source=~/linux
giturl=https://github.com/torvalds/linux.git
#
# Written for the openSUSE forums on Thursday September 15, 2011
#
#
# Copy and Paste the text of this script into a text editor and save
# it as the file sgtb in the folder ~/bin (/home/username/bin).
# This script must be marked executable to be used. Please run
# the following Terminal command: chmod +x ~/bin/sgtb
#
#
# This is the standard GPL Statement, leave at the top of the script.
# Just use the command show_gpl after this function for it to be shown.
#
function show_gpl {
echo ""
echo "sgtb is a bash script file written to be used with openSUSE."
echo "Copyright (C) 2011 by James D. McDaniel, jmcdaniel3@austin.rr.com"
echo ""
echo "This program is free software; you can redistribute it and/or modify"
echo "it under the terms of the GNU General Public License as published by"
echo "the Free Software Foundation; either version 2 of the License, or"
echo "(at your option) any later version."
echo ""
echo "This program is distributed in the hope that it will be useful,"
echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
echo "GNU General Public License for more details."
echo ""
echo "You should have received a copy of the GNU General Public License"
echo "along with this program; if not, write to the Free Software"
echo "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"
echo ""
}
function kernel_version {
pattern="refs/tags/"
size=$(git show-ref 2>&1 | grep -c $pattern)
inc=1
while $inc -le $size ] ; do
temp=$(git show-ref 2>&1 | grep $pattern | sed -n $(( inc ))p)
sum$inc]=${temp:0:40}
len=${#temp}
ker$inc]=${temp:52:len-52}
let inc=inc+1
done
}
function kernel_find {
inc=1
while $inc -le $size ] ; do
if ${ker$inc]} == "$1" ] ; then
return $inc
fi
let inc=inc+1
done
return 0
}
#
# Determine if the package git is installed ****************************
#
suselinux="zypper in"
which git > /dev/null
Exit_Code=$?
if $(( Exit_Code )) -ge 1 ] ; then
tput clear
echo "The git Utility Package is not installed!"
echo
echo -n "Would you like to install the git package(y/N)? "
read CHOICE
if $CHOICE == [Yy] ]] ; then
sudo $install git
else
echo "The git Utility Package was not installed!"
exit 1
fi
fi
#
# Main Program starts here - Create and / or update kernel source files
#
clear
echo $TITLE
echo
cd ~/
if ! -d "$kernel_source" ]] ; then
echo "The Linux Source Folder linux does not exist. Do you wish"
echo -n "to download the entire kernel source at this time? (y/N): "
read CHOICE
if $CHOICE == [Yy] ]] ; then
git clone $giturl
else
echo
echo "Kernel Source Tarball Creation was aborted!"
echo
show_gpl
exit 1
fi
else
cd $kernel_source
echo "Kernel Source File Check Update in Progress ..."
echo
git pull $giturl
echo
echo -n "Kernel Source Update Complete ... Please Press <enter> To Continue!"
read CHOICE
fi
#
# Request Kernel Version to be converted into a Tarball
#
cd $kernel_source
kernel_version
cont=true
while $cont ; do
clear
echo $TITLE
echo
echo "Please Enter The Kernel Version that you wish to use."
echo
echo "Kernel Version Ranges are ${ker[1]} to ${ker$size]}:"
echo
echo -n "Please enter the kernel version to create (q=Quit): "
read CHOICE
if $CHOICE == [Qq] ]] ; then
show_gpl
exit 0
else
kernel_find "$CHOICE"
Exit_Code="$?"
if $Exit_Code -gt 0 ] ; then
echo
echo "You Have Requested a Kernel Version linux-${ker$Exit_Code]} Tarball."
echo
echo -n "Is that the Correct Kernel Version that You want to use? (y/N): "
read CHOICE
if $CHOICE == [Yy] ]] ; then
echo
echo "Please wait while your Kernel Tarball is created!"
cont=false
git archive "${sum$Exit_Code]}" | bzip2 > "$downloads/linux-${ker$Exit_Code]}.tar.bz2"
if ! -e "$downloads/linux-${ker$Exit_Code]}.tar.bz2" ] ; then
echo
echo "Your Linux Kernel Tarball was NOT created for some reason!"
echo
echo "folder/name: $downloads/linux-${ker$Exit_Code]}.tar.bz2"
show_gpl
exit 1
else
echo
echo "The Linux Kernel Tarball was created successfully!"
echo
echo "folder/name: $downloads/linux-${ker$Exit_Code]}.tar.bz2"
fi
fi
else
echo
echo -n "No Match was found...Please Press <enter> To Try Again"
read CHOICE
fi
fi
done
show_gpl
exit 0
# End Of Script
The script file gitksf must be marked executable in order to use it. Open up a terminal session and run the following command:
chmod +x ~/bin/sgtb
To use the script, open up a terminal session and run the following command:
sgtb
Just as before, I would love to hear any comments on the use of this script that you might have.
I don’t know if you are interested in using kdialog to get input from the user, but if so you could easily present them with a picklist of all the available versions with something like:
Similarly, you could display the GPL with kdialog, etc. While I kind of like keeping it just text based, kdialog does provide a nice mechanism to do this with. It’s a mixed bag for sure. (I guess you could get really fancy and let the user choose which method with a --gui option, but that might be a bit overkill.) I think the majority of users of this might like the gui though.
Oh - similarly you could use Kdialog to have them pick if they want to download the sources from github, or from the Suse Kernel git repo - now that might be pretty handy actually. (I didn’t even know until I went looking that Suse had their own git repo!)
But this is all just icing, your script is looking great.