HOWTO: Create a FreeBSD 8 i386 Xen PV domU

How do I get started with XEN?

The most success I've had with XEN is installing XCP but I wasn't able to install any DOMU environments on it. What is a good place to start with XEN virtualization?

Thanks.
 
Hello,

I would like to compile the latest FreeBSD release (amd64) so that I can import my current ver. 28 zfs pool in the FreeBSD DomU.

I am a little confused, and am not finding the answers online. (I have no experience compiling FreeBSD kernels)
I tried building an amd64 kernel with the XENHVM parameter, but it would not work in Xen. Xen complained that the kernel I was using was not a Xen enabled kernel.
I checked the FreeBSD handbook about building custom kernels, and all I see is info on how to setup the kernel config file for i386 architecture.

My questions are:
1) Do I edit the config file in ..../amd64/conf directory, or the ..../i386/conf directory irrespective of whether I am building an 64 bit or 32 bit kernel?
2) Can I add the XENHVM parameter to the config file, in which case how?
3) How do I go about compiling the 64 bit kernel?

Sorry for the noob questions, but I could not find this info online.

Thanks and best regards

Sandi
 
romihs said:
I would like to compile the latest FreeBSD release (amd64) so that I can import my current ver. 28 zfs pool in the FreeBSD DomU.

  1. Create new kernel config file /usr/src/sys/amd64/conf/XENHVMZFS
    Code:
    #include default kernel config with Xen support
    include XENHVM 
    #rename your config
    ident XENHVMZFS
    #reset this option which is set to empty in included config
    nomakeoption MODULES_OVERRIDE
    #set your requested modules to be build
    makeoption MODULES_OVERRIDE="zfs opensolaris"
    Note: I tried to add zfs and opensolaris modules to default MODULES_OVERRIDE option from included XENHVM config with += or =+ to be sure nothing breaks in future when empty list may be filled with something, but didn't succeed, so I clear this option first and than set my own.
  2. Compile new custom kernel
    # cd /usr/src && make buildkernel KERNCONF=XENHVMZFS
  3. Install new custom kernel
    # make installkernel KERNCONF=XENHVMZFS
  4. Reboot
    # reboot
  5. You are done

Your question is probably little OT in this thread, because is more oriented to basic kernel compilation in general than to Xen support, so new thread may be more appropriate next time.
 
ondra_knezour said:
  1. Create new kernel config file /usr/src/sys/amd64/conf/XENHVMZFS
    Code:
    #include default kernel config with Xen support
    include XENHVM 
    #rename your config
    ident XENHVMZFS
    #reset this option which is set to empty in included config
    nomakeoption MODULES_OVERRIDE
    #set your requested modules to be build
    makeoption MODULES_OVERRIDE="zfs opensolaris"
    Note: I tried to add zfs and opensolaris modules to default MODULES_OVERRIDE option from included XENHVM config with += or =+ to be sure nothing breaks in future when empty list may be filled with something, but didn't succeed, so I clear this option first and than set my own.
  2. Compile new custom kernel
    # cd /usr/src && make buildkernel KERNCONF=XENHVMZFS
  3. Install new custom kernel
    # make installkernel KERNCONF=XENHVMZFS
  4. Reboot
    # reboot
  5. You are done


Thanks for this information, I will try this out to see if I can build a kernel that will work in Xen.

Currently, I get this error when I use a kernel I built:
Code:
xc: error: elf_xen_note_check: ERROR: Not a Xen-ELF image: No ELF notes or '__xen_guest' section found.: Invalid kernel

If I use the kernel and image provided here in this thread I get the following error:
Code:
KDB: enter: panic
[thread pid 0 tid 0 ]
Stopped at      kdb_enter+0x3a: movl    $0,kdb_why
And for that reason I have been trying to build my own FreeBSD kernel.

I apologize for posting OT here.
 
Back
Top