[vbox-dev] Error in building latest SVN

Larry Finger Larry.Finger at lwfinger.net
Sun Feb 10 17:00:43 GMT 2008


Larry Finger wrote:
> Frank Mehnert wrote:
>> On Friday 08 February 2008, Larry Finger wrote:
>>> In the new kernel, __attribute_used__ is not defined anywhere. It is truly
>>> deprecated in 2.6.25.
>> Please could you try the latest SVN.
> 
> Yes, the above problem is fixed.
> 
> There are at least 2 more changes in the 2.6.25 kernel that affect VirtualBox:
> 
> (1) Struct super_operations no longer has member read_inode.
> (2) The routine change_page_attr no longer exists and the module build has a missing global.
> 
> The patch file below fixes #1. I'm still working on #2.
> 
> Index: vbox/src/VBox/Additions/linux/sharedfolders/vfsmod.c
> ===================================================================
> --- vbox.orig/src/VBox/Additions/linux/sharedfolders/vfsmod.c
> +++ vbox/src/VBox/Additions/linux/sharedfolders/vfsmod.c
> @@ -296,10 +296,12 @@ sf_clear_inode (struct inode *inode)
>      the only thing that is known about inode at this point is its index
>      hence we can't do anything here, and let lookup/whatever with the
>      job to properly fill then [inode] */
> +#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 25)
>   static void
>   sf_read_inode (struct inode *inode)
>   {
>   }
> +#endif
> 
>   /* vfs is done with [sb] (umount called) call [sf_glob_free] to unmap
>      the folder and free [sf_g] */
> @@ -337,7 +339,9 @@ sf_remount_fs (struct super_block *sb, i
> 
>   static struct super_operations sf_super_ops = {
>   	.clear_inode = sf_clear_inode,
> +#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 25)
>   	.read_inode  = sf_read_inode,
> +#endif
>   	.put_super   = sf_put_super,
>   	.statfs      = sf_statfs,
>   	.remount_fs  = sf_remount_fs

The patch below fixes problem #2 above. I have placed a query request on the Linux Kernel Mailing 
List. When the responses are complete, this patch may need changing; however, it works for me.

Index: vbox/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
===================================================================
--- vbox.orig/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
+++ vbox/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
@@ -1499,6 +1499,17 @@ RTDECL(void) AssertMsg2(const char *pszF
  /* GCC C++ hack. */
  unsigned __gxx_personality_v0 = 0xcccccccc;

+/* Add the change_page_attr routine for kernels 2.6.25 or later */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+int change_page_attr(struct page *page, int numpages, pgprot_t prot)
+{
+	/* use the set_pages_* API */
+	if (pgprot_val(prot) & _PAGE_NX)
+		set_pages_nx(page, numpages);
+	set_pages_uc(page, numpages);
+	return 0;
+}
+#endif

  module_init(VBoxDrvLinuxInit);
  module_exit(VBoxDrvLinuxUnload);
Index: vbox/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
===================================================================
--- vbox.orig/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
+++ vbox/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
@@ -241,5 +241,9 @@ DECLINLINE(unsigned long) msecs_to_jiffi
  #define __attribute_used__ __used
  #endif

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+int change_page_attr(struct page *page, int numpages, pgprot_t prot);
+#endif
+
  #endif

As an answer to the implicit question posed in fixing the problem regarding the fix for 
__attribute_used__, the macro LINUX_VERSION_CODE will change when Linus changes from 2.6.24-git to 
2.6.25-rc. For the moment, I am manually changing it with this patch to the Linux source tree:

Index: linux-2.6/include/linux/version.h
===================================================================
--- linux-2.6.orig/include/linux/version.h
+++ linux-2.6/include/linux/version.h
@@ -1,2 +1,2 @@
-#define LINUX_VERSION_CODE 132632
+#define LINUX_VERSION_CODE 132633
  #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

It has to be applied AFTER the make for the kernel, but before VBox is built.

Larry





More information about the vbox-dev mailing list