Patch to support linux kernels >= 2.6.31

Postings relating to old VirtualBox pre-releases
Post Reply
typerlc
Posts: 22
Joined: 20. Jun 2009, 15:32
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: WinXP

Patch to support linux kernels >= 2.6.31

Post by typerlc »

Despite an over-zealous moderator deleting my original report, I will post the fix to allow vbox3beta1 to run on kernels >= 2.6.31. This patch should also work on >= 2.6.28.

It migrates from the obsolete net_device.open etc. to the new net_device_ops.open etc.

sasquatch, please re-read your moderating rules and the stickies defining the purpose of this forum and don't delete this post. vbox3 will have to deal with this because kernel 2.6.31 is scheduled for September 09. On this and later kernels, vbox3 will no longer work unless a fix is applied. This will in the vicinity of the vbox 3 release so should be catered for.

The patch needs to be applied to /usr/share/virtualbox/src/vboxnetadp/linux/VBoxNetAdp-linux.c, then "/etc/init.d/vboxdrv setup" rerun.

Code: Select all

--- VBoxNetAdp-linux.c.v300b1.orig      2009-06-21 13:57:37.838899175 +1000
+++ VBoxNetAdp-linux.c  2009-06-21 14:05:56.328151961 +1000
@@ -161,15 +161,20 @@
     return &pPriv->Stats;
 }

+static const struct net_device_ops vboxNetAdpNetDevOps =
+{
+    .ndo_open = vboxNetAdpLinuxOpen,
+    .ndo_stop = vboxNetAdpLinuxStop,
+    .ndo_start_xmit = vboxNetAdpLinuxXmit,
+    .ndo_get_stats = vboxNetAdpLinuxGetStats,
+};
+
 static void vboxNetAdpNetDevInit(struct net_device *pNetDev)
 {
     PVBOXNETADPPRIV pPriv;

     ether_setup(pNetDev);
-    pNetDev->open = vboxNetAdpLinuxOpen;
-    pNetDev->stop = vboxNetAdpLinuxStop;
-    pNetDev->hard_start_xmit = vboxNetAdpLinuxXmit;
-    pNetDev->get_stats = vboxNetAdpLinuxGetStats;
+    pNetDev->netdev_ops = &vboxNetAdpNetDevOps;

     pPriv = netdev_priv(pNetDev);
     memset(pPriv, 0, sizeof(*pPriv));
Richard
Leak
Posts: 242
Joined: 31. Mar 2009, 13:00
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian Testing, Windows XP, Windows Server 2003/2008 R2

Re: Patch to support linux kernels >= 2.6.31

Post by Leak »

No offense, but that is something that should go into the bugtracker, where you can also attach the patch as a file.
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Re: Patch to support linux kernels >= 2.6.31

Post by frank »

A similar patch was applied to SVN yesterday.
typerlc
Posts: 22
Joined: 20. Jun 2009, 15:32
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: WinXP

Re: Patch to support linux kernels >= 2.6.31

Post by typerlc »

Leak wrote:No offense, but that is something that should go into the bugtracker, where you can also attach the patch as a file.
First of all, according to the stickies in this forum, this forum *is* the correct place to report bugs. In fact, it says don't report it to the bug tracker.

Second, I already reported this issue in the bugtracker for 2.2.4.

Why is everyone so nasty around here? A simple "thanks for the patch" wouldn't go astray.
typerlc
Posts: 22
Joined: 20. Jun 2009, 15:32
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: WinXP

Re: Patch to support linux kernels >= 2.6.31

Post by typerlc »

Some people have reported problems applying the patch, presumably because of formatting problems when posting on the forum.

So the attached file is the same patch, but should work correctly.
Attachments
VBoxNetAdp-linux.c.v300b1.net_device_ops.patch.gz
(446 Bytes) Downloaded 38 times
klaus_ph
Posts: 29
Joined: 9. May 2008, 00:44

Re: Patch to support linux kernels >= 2.6.31

Post by klaus_ph »

typerlc wrote:Some people have reported problems applying the patch, presumably because of formatting problems when posting on the forum.
So the attached file is the same patch, but should work correctly.
hi typercl
thanks for the patch. but it does'nt work for my sles11.
(the patch for itself works perfectly ;-)

for someone, who wants to read: vbox-install.log
http://allegronet.de/vbox-install.log (160kb)

It may depend from this circumstances:
here works SLES 11 (not opensuse_something)
from boot.msg:
Inspecting /boot/System.map-2.6.27.23-0.1-pae
Cannot find map file.
No module symbols loaded - kernel modules not enabled.


yours
klaus
basicly born on os/2, later ecs2. matureness on linux, loving real servers from ibm ;-)
bytheway: I HATE deleting of msg, unequal if mine or not. in german forums (qnap/os2_org) this happens. I wish, this would be NOT happen in virtualbox_forum!
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Re: Patch to support linux kernels >= 2.6.31

Post by frank »

klaus_ph wrote:thanks for the patch. but it does'nt work for my sles11.
Don't apply this patch because your 2.6.27 kernel doesn't need it.
klaus_ph
Posts: 29
Joined: 9. May 2008, 00:44

Re: Patch to support linux kernels >= 2.6.31

Post by klaus_ph »

Frank Mehnert wrote:
klaus_ph wrote:thanks for the patch. but it does'nt work for my sles11.
Don't apply this patch because your 2.6.27 kernel doesn't need it.

it would be charming idea, to make this work with "modern" kernel.
sorry; I can't change my sles11 (nobody can and will do this ;-)

yours klaus
basicly born on os/2, later ecs2. matureness on linux, loving real servers from ibm ;-)
bytheway: I HATE deleting of msg, unequal if mine or not. in german forums (qnap/os2_org) this happens. I wish, this would be NOT happen in virtualbox_forum!
kebabbert
Volunteer
Posts: 321
Joined: 31. May 2008, 10:00
Primary OS: OpenSolaris 11
VBox Version: OSE other
Guest OSses: WinXP, RedHat, Ubuntu

Re: Patch to support linux kernels >= 2.6.31

Post by kebabbert »

Thanks for the patch! :D
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Re: Patch to support linux kernels >= 2.6.31

Post by frank »

3.0.0 Beta 2 contains a similar patch.
klaus_ph
Posts: 29
Joined: 9. May 2008, 00:44

Re: Patch to support linux kernels >= 2.6.31

Post by klaus_ph »

Frank Mehnert wrote:3.0.0 Beta 2 contains a similar patch.
please look on http://forums.virtualbox.org/viewtopic.php?f=15&t=19159
;-)
basicly born on os/2, later ecs2. matureness on linux, loving real servers from ibm ;-)
bytheway: I HATE deleting of msg, unequal if mine or not. in german forums (qnap/os2_org) this happens. I wish, this would be NOT happen in virtualbox_forum!
Post Reply