tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: XEN modules?



I know there's some magic somewhere in the Makefiles that automatically builds both "normal" and XEN variants of the modules for amd64 (and, for i386, there's a PAE variant, too)! But I can't seem to find the magic!

Anyway, it seems to me that, when building the XEN (or PAE) variants of each module, they should be built with -DXEN (or -DPAE) options. There is at least one source file, compiled into the compat module, which has some code conditional on XEN. (For those who care, it is the compat_60 x86 code for updating AMD cpu_ucode.)

Based on log files, we're currently not defining XEN or PAE for the modules builds. As a result the XEN variant of the compat module does not contain the required code, preventing use of the 6.0 cpuctl command.

So,

1. Would it be reasonable to define the XEN and PAE macros when building
  the module variants?

Still need an answer to this question...

2. What would it take to make it happen?

Add

	CPPFLAGS+=	-DXEN (or PAE)

to the appropriate *.mk files?  (See #3 below)  These files already have

	XEN=	1
  and	PAE=	1

3. Where's the magic?  :)

OK, found the magic.  It's in

	src/sys/modules/arch/x86/amd64-xen/bsd.amd64-xen.mk
	src/sys/modules/arch/x86/i386-xen/bsd.i386-xen.mk
 and	src/sys/modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk


If the answer to Question #1 is "Yes, it's reasonable" then I can take care of making the changes.


Follow-on question: the changes identified above have the desired effect, and code conditioned on XEN is now being built. Unfortunately, that has exposed the next problem!

The XEN-specific code has a

	#include "xen/intrptrs.h"

which for kernel builds would be found due to a sym-link in the kernel's object directory:

	xen -> /build/netbsd-compat/src/sys/arch/xen/include

This symlink doesn't exist in the module's object directory, so the #include fails.

It would appear that I might need to add some more magic to create the xen (and/or pae) symlink for the modules. It looks like this is handled in share/mk/bsd.klinks.mk but it's not exactly clear what I should add. And I can't seem to find where the kernel Makefiles make this happen, so no examples from which to borrow. I can't tell if I should (a) set XEN_BUILD to something (to what?), (2) override an existing value of KLINK_MACHINE, or (3) just update KLINK_FILES? (And what is xen-ma used for, anyway?)

Again, any clue/help would be greatly appreciated.

(As you all can probably tell from this thread, I'm far from an expert when it comes to our build infrastructure...)



+------------------+--------------------------+----------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+


Home | Main Index | Thread Index | Old Index