Skip to contentSkip to conversation

xen 4.3.0 recipe and updated xen-image-minimal

PATCH Superseded Chris Patterson 3 participants 18 messages Aug 30, 2013 – Sep 9, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover xen 4.3.0 recipe and updated xen-image-minimal

This set of patches should provide a user with the ability to generate a xen 4.3.0 based dom0 image.

[NOTES]

With these patches, xen-image-minimal requires "xen" and "aufs" to be present in DISTRO_FEATURES to function correctly.

[DISTRO TESTING]

This image has been tested using:

machine=sugarbay
DISTRO_FEATURES += " aufs xen"

[BUILDING IMAGE]

bitbake xen-image-minimal

[QEMU BUILD TESTING]

To start up and test core-image-xen using kvm on hardware supporting nested virtualization:

kvm -hda deploy/images/xen-image-minimal-sugarbay.hddimg -cpu host -no-kvm-irqchip -m 4096 -net nic,model=e1000 -net user -serial stdio

..or..

kvm -hdc deploy/images/xen-image-minimal-sugarbay.iso -cpu host -no-kvm-irqchip -m 4096 -net nic,model=e1000 -net user -serial stdio

[XEN TESTING]

To test the runtime core-image-xen and boot a debian PV virtual machine:

# bring up networking
ifconfig eth0 up
brctl addbr br0
brctl addif br0 eth0
udhcpc -i br0
# place test debian vm in /test/debian
mkdir -p /test/debian
cd /test/debian
# pull example kernel, initrd
wget http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/xen/initrd.gz
wget http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/xen/vmlinuz
# create 4G disk
truncate -s 4096M disk.img

cat > debian.cfg << EOF
kernel = "/test/debian/vmlinuz"
ramdisk = "/test/debian/initrd.gz"
extra = "debian-installer/exit/always_halt=true -- console=hvc0" vif = ['bridge=br0']
memory = "256"
name = "debian"
disk = ['file:/test/debian/disk.img,xvda,w']
EOF

xl -v create -d debian.cfg

xl console debian

Chris Patterson (4):
linux-yocto: add kernel fragment and scc for xen dom0 kernel support.
linux-yocto: add optional support for aufs and xen using
DISTRO_FEATURES.
xen: add 4.3.0 recipe.
xen-image-minimal: update image to support xen 4.3.0 base with xl
toolstack.

 recipes-extended/images/xen-image-initramfs.bb     |   17 +
 recipes-extended/images/xen-image-minimal.bb       |   55 +-
 .../initrdscripts/files/init-boot-xen.sh           |  205 +++++++
 .../initrdscripts/initramfs-boot-xen_1.0.bb        |   16 +
 recipes-extended/xen/xen_4.3.0.bb                  |  623 ++++++++++++++++++++
 recipes-kernel/linux/linux-yocto/xen.cfg           |   53 ++
 recipes-kernel/linux/linux-yocto/xen.scc           |    4 +
 recipes-kernel/linux/linux-yocto_3.4.bbappend      |    6 +
 recipes-kernel/linux/linux-yocto_3.8.bbappend      |    6 +
 9 files changed, 978 insertions(+), 7 deletions(-)
 create mode 100644 recipes-extended/images/xen-image-initramfs.bb
 create mode 100644 recipes-extended/initrdscripts/files/init-boot-xen.sh
 create mode 100644 recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb
 create mode 100644 recipes-extended/xen/xen_4.3.0.bb
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.scc
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/4 linux-yocto: add kernel fragment and scc for xen dom0 kernel support.

---
 recipes-kernel/linux/linux-yocto/xen.cfg |   53 ++++++++++++++++++++++++++++++
 recipes-kernel/linux/linux-yocto/xen.scc |    4 +++
 2 files changed, 57 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.scc
recipes-kernel/linux/linux-yocto/xen.cfg new file +53 -0
new file mode 100644
index 0000000..f9cfb6a
@@ -0,0 +1,53 @@
+..........................................................................
+.                                WARNING
+.
+. This file is a kernel configuration fragment, and not a full kernel
+. configuration file.  The final kernel configuration is made up of
+. an assembly of processed fragments, each of which is designed to
+. capture a specific part of the final configuration (e.g. platform
+. configuration, feature configuration, and board specific hardware
+. configuration).  For more information on kernel configuration, please
+. consult the product documentation.
+.
+..........................................................................
+
+CONFIG_PARAVIRT_GUEST=y
+# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
+CONFIG_XEN=y
+CONFIG_XEN_DOM0=y
+CONFIG_XEN_PRIVILEGED_GUEST=y
+CONFIG_XEN_PVHVM=y
+CONFIG_XEN_MAX_DOMAIN_MEMORY=500
+CONFIG_XEN_SAVE_RESTORE=y
+# CONFIG_XEN_DEBUG_FS is not set
+CONFIG_PARAVIRT=y
+# CONFIG_PARAVIRT_SPINLOCKS is not set
+CONFIG_PARAVIRT_CLOCK=y
+# CONFIG_PARAVIRT_DEBUG is not set
+CONFIG_PCI_XEN=y
+CONFIG_XEN_PCIDEV_FRONTEND=m
+CONFIG_XEN_BLKDEV_FRONTEND=m
+CONFIG_XEN_BLKDEV_BACKEND=m
+CONFIG_XEN_NETDEV_FRONTEND=m
+CONFIG_XEN_NETDEV_BACKEND=m
+CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
+CONFIG_HVC_XEN=y
+CONFIG_HVC_XEN_FRONTEND=y
+CONFIG_XEN_WDT=m
+CONFIG_XEN_FBDEV_FRONTEND=y
+# Xen driver support
+CONFIG_XEN_BALLOON=y
+CONFIG_XEN_SCRUB_PAGES=y
+CONFIG_XEN_DEV_EVTCHN=m
+CONFIG_XEN_BACKEND=y
+CONFIG_XENFS=m
+CONFIG_XEN_COMPAT_XENFS=y
+CONFIG_XEN_SYS_HYPERVISOR=y
+CONFIG_XEN_XENBUS_FRONTEND=y
+CONFIG_XEN_GNTDEV=m
+CONFIG_XEN_GRANT_DEV_ALLOC=m
+CONFIG_SWIOTLB_XEN=y
+CONFIG_XEN_PCIDEV_BACKEND=y
+CONFIG_XEN_PRIVCMD=m
+CONFIG_XEN_ACPI_PROCESSOR=m
+CONFIG_PCI_STUB=y
recipes-kernel/linux/linux-yocto/xen.scc new file +4 -0
new file mode 100644
index 0000000..6c68bda
@@ -0,0 +1,4 @@
+define KFEATURE_DESCRIPTION "Xen Dom0 Support"
+define KFEATURE_COMPATIBILITY board
+
+kconf non-hardware xen.cfg
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 1/4] linux-yocto: add kernel fragment and scc for xen dom0 kernel support.

recipes-kernel/linux/linux-yocto/xen.cfg

Quoted 12 lines · Chris Patterson
---
 recipes-kernel/linux/linux-yocto/xen.cfg |   53 ++++++++++++++++++++++++++++++
 recipes-kernel/linux/linux-yocto/xen.scc |    4 +++
 2 files changed, 57 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.scc
recipes-kernel/linux/linux-yocto/xen.cfg new file +0 -0
new file mode 100644
index 0000000..f9cfb6a

Nice. The fragment looks good. I'd actually like to bump this up to the level of in-tree support that we have for KVM.

And by that, I mean that I can merge this to the meta branch of the linux-yocto kernel (and also found in the tracking yocto-kernel-cache repository).

Once there, it can be built and tested standalone, as well as shared by other feature fragments. You'd then be able to just enable it via a KERNEL_FEATURES entry, just like KVM.

Cheers,

Bruce

Quoted 71 lines
recipes-kernel/linux/linux-yocto/xen.cfg new file +53 -0
@@ -0,0 +1,53 @@
+..........................................................................
+.                                WARNING
+.
+. This file is a kernel configuration fragment, and not a full kernel
+. configuration file.  The final kernel configuration is made up of
+. an assembly of processed fragments, each of which is designed to
+. capture a specific part of the final configuration (e.g. platform
+. configuration, feature configuration, and board specific hardware
+. configuration).  For more information on kernel configuration, please
+. consult the product documentation.
+.
+..........................................................................
+
+CONFIG_PARAVIRT_GUEST=y
+# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
+CONFIG_XEN=y
+CONFIG_XEN_DOM0=y
+CONFIG_XEN_PRIVILEGED_GUEST=y
+CONFIG_XEN_PVHVM=y
+CONFIG_XEN_MAX_DOMAIN_MEMORY=500
+CONFIG_XEN_SAVE_RESTORE=y
+# CONFIG_XEN_DEBUG_FS is not set
+CONFIG_PARAVIRT=y
+# CONFIG_PARAVIRT_SPINLOCKS is not set
+CONFIG_PARAVIRT_CLOCK=y
+# CONFIG_PARAVIRT_DEBUG is not set
+CONFIG_PCI_XEN=y
+CONFIG_XEN_PCIDEV_FRONTEND=m
+CONFIG_XEN_BLKDEV_FRONTEND=m
+CONFIG_XEN_BLKDEV_BACKEND=m
+CONFIG_XEN_NETDEV_FRONTEND=m
+CONFIG_XEN_NETDEV_BACKEND=m
+CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
+CONFIG_HVC_XEN=y
+CONFIG_HVC_XEN_FRONTEND=y
+CONFIG_XEN_WDT=m
+CONFIG_XEN_FBDEV_FRONTEND=y
+# Xen driver support
+CONFIG_XEN_BALLOON=y
+CONFIG_XEN_SCRUB_PAGES=y
+CONFIG_XEN_DEV_EVTCHN=m
+CONFIG_XEN_BACKEND=y
+CONFIG_XENFS=m
+CONFIG_XEN_COMPAT_XENFS=y
+CONFIG_XEN_SYS_HYPERVISOR=y
+CONFIG_XEN_XENBUS_FRONTEND=y
+CONFIG_XEN_GNTDEV=m
+CONFIG_XEN_GRANT_DEV_ALLOC=m
+CONFIG_SWIOTLB_XEN=y
+CONFIG_XEN_PCIDEV_BACKEND=y
+CONFIG_XEN_PRIVCMD=m
+CONFIG_XEN_ACPI_PROCESSOR=m
+CONFIG_PCI_STUB=y
recipes-kernel/linux/linux-yocto/xen.scc new file +4 -1
new file mode 100644
index 0000000..6c68bda
@@ -0,0 +1,4 @@
+define KFEATURE_DESCRIPTION "Xen Dom0 Support"
+define KFEATURE_COMPATIBILITY board
+
+kconf non-hardware xen.cfg
--

1.7.10.4

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#3 lore raw

Re: [PATCH 1/4] linux-yocto: add kernel fragment and scc for xen dom0 kernel support.

That'd be great. There are a couple areas that could perhaps use some work, as the fragment is a little excessive in some of the options and/or could be broken up a little better, if desired. On this topic, I have a couple questions that would help steer me in the right direction in the future:

1) One thing that's not immediately clear for me is the question of how to best handle a case where a CONFIG_XXX option may in one instance, be desirable to be built in - vs being a module in another? Doing a quick test seems to imply the first defined instance is the one used, but I'm not sure if there are any well defined rules for conflict resolution. The reason I'm asking is there are CONFIG_XXX=y instances in this config - some of which need to be built in, some required, and some just *preferably* built in for various use cases. Specifically CONFIG_XEN_PCIDEV_BACKEND=y provides some useful functionality before a module could otherwise be loaded (prevent a pci device from being owned by a linux driver).

2) The other thing I am curious about is how to negotiate the inclusion of a KERNEL_FEATURES which has a number of built-in bits. The approach used by kvm is to effectively always enable the fragment if one is including meta-virtualization. This in and of itself isn't really polluting the target image for those that don't want KVM, because they likely simply don't include the built kvm modules (ignoring CONFIG_TUN=y). However, when you have the =y cases, the user of the layer doesn't have a choice without going through and commenting out the KERNEL_FEATURES_append...? This was the reasoning I took for choosing the base_contains() functionality instead of just including it like the other bits (ebtables, vswitch, etc.). Is the goal for the layer's linux-yocto bbappend to support a "generic" kernel (by default) to support all of its packages/images?

Take care,
-Chris

#4 lore raw

Re: [PATCH 1/4] linux-yocto: add kernel fragment and scc for xen dom0 kernel support.

Quoted 5 lines · Chris Patterson

That'd be great. There are a couple areas that could perhaps use some work, as the fragment is a little excessive in some of the options and/or could be broken up a little better, if desired. On this topic, I have a couple questions that would help steer me in the right direction in the future:

Quoted 10 lines

1) One thing that's not immediately clear for me is the question of how to best handle a case where a CONFIG_XXX option may in one instance, be desirable to be built in - vs being a module in another? Doing a quick test seems to imply the first defined instance is the one used, but I'm not sure if there are any well defined rules for conflict resolution. The reason I'm asking is there are CONFIG_XXX=y instances in this config - some of which need to be built in, some required, and some just *preferably* built in for various use cases. Specifically CONFIG_XEN_PCIDEV_BACKEND=y provides some useful functionality before a module could otherwise be loaded (prevent a pci device from being owned by a linux driver).

It should be last through the gate that wins, which gives the fragment that includes another one a chance to tweak and override what it doesn't like.

If you were really seeing first one being set, then something has broken and I'll hunt it down, I never assume that something hasn't managed to break itself, but it should still be behaving as it has before.

What you may have seen is that KERNEL_FEATURES and .scc files on a SRC_URI are applied in a particular order. .scc files and then KERNEL_FEATURES, so if you want to override a feature, you need to do it with another features.

So in your case, you can have that base fragment sets the requirements as built in, that's a good start. You could then have a secondary fragment which sets the preferable options, and more fragments that had completely optional values. Leaving the recipes and higher level fragments to chose the mix they want.

Alternatively, you can set them all in the single fragment like it is, and then the including feature can always override, or from recipe space additional features be triggered override the values.

Quoted 13 lines

2) The other thing I am curious about is how to negotiate the inclusion of a KERNEL_FEATURES which has a number of built-in bits. The approach used by kvm is to effectively always enable the fragment if one is including meta-virtualization. This in and of itself isn't really polluting the target image for those that don't want KVM, because they likely simply don't include the built kvm modules (ignoring CONFIG_TUN=y). However, when you have the =y cases, the user of the layer doesn't have a choice without going through and commenting out the KERNEL_FEATURES_append...? This was the reasoning I took for choosing the base_contains() functionality instead of just including it like the other bits (ebtables, vswitch, etc.). Is the goal for the layer's linux-yocto bbappend to support a "generic" kernel (by default) to support all of its packages/images?

An excellent point .. and yes, a layer shouldn't really be setting values like this
unless it was single purpose. If we have Xen and KVM both active and available via meta-virt, then we really don't want that.

I'd convert KVM to trigger via a IMAGE or DISTRO feature as well, just as you've done with your fragments.

Cheers,

Bruce

Quoted 3 lines

Take care,
-Chris

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#5 lore raw

Re: [PATCH 1/4] linux-yocto: add kernel fragment and scc for xen dom0 kernel support.

I went back and double checked - you are right - last fragment wins as you expected. I typo'd something in my test :) Thanks for the clarification, that makes more sense to me now.

Quoted 97 lines · Bruce Ashfield
Quoted 1 line · Chris Patterson

That'd be great. There are a couple areas that could perhaps use some

work,

Quoted 1 line

as the fragment is a little excessive in some of the options and/or

could be

Quoted 4 lines

broken up a little better, if desired. On this topic, I have a couple questions that would help steer me in the right direction in the future:

1) One thing that's not immediately clear for me is the question of how

to

Quoted 2 lines

best handle a case where a CONFIG_XXX option may in one instance, be desirable to be built in - vs being a module in another? Doing a quick

test

Quoted 1 line

seems to imply the first defined instance is the one used, but I'm not

sure

Quoted 1 line

if there are any well defined rules for conflict resolution. The reason

I'm

Quoted 2 lines

asking is there are CONFIG_XXX=y instances in this config - some of which need to be built in, some required, and some just *preferably* built in

for

Quoted 3 lines

various use cases. Specifically CONFIG_XEN_PCIDEV_BACKEND=y provides some useful functionality before a module could otherwise be loaded (prevent a pci device from being owned by a linux driver).

It should be last through the gate that wins, which gives the fragment that includes another one a chance to tweak and override what it doesn't like.

If you were really seeing first one being set, then something has broken and
I'll hunt it down, I never assume that something hasn't managed to break itself, but it should still be behaving as it has before.

What you may have seen is that KERNEL_FEATURES and .scc files on a SRC_URI are applied in a particular order. .scc files and then KERNEL_FEATURES,
so if you want to override a feature, you need to do it with another features.

So in your case, you can have that base fragment sets the requirements as built in, that's a good start. You could then have a secondary fragment which
sets the preferable options, and more fragments that had completely optional
values. Leaving the recipes and higher level fragments to chose the mix they
want.

Alternatively, you can set them all in the single fragment like it is, and then
the including feature can always override, or from recipe space additional features be triggered override the values.

Quoted 2 lines

2) The other thing I am curious about is how to negotiate the inclusion

of a

Quoted 1 line

KERNEL_FEATURES which has a number of built-in bits. The approach used

by

Quoted 3 lines

kvm is to effectively always enable the fragment if one is including meta-virtualization. This in and of itself isn't really polluting the target image for those that don't want KVM, because they likely simply

don't

Quoted 2 lines

include the built kvm modules (ignoring CONFIG_TUN=y). However, when you have the =y cases, the user of the layer doesn't have a choice without

going

Quoted 2 lines

through and commenting out the KERNEL_FEATURES_append...? This was the reasoning I took for choosing the base_contains() functionality instead

of

Quoted 2 lines

just including it like the other bits (ebtables, vswitch, etc.). Is the goal for the layer's linux-yocto bbappend to support a "generic" kernel

(by

Quoted 1 line

default) to support all of its packages/images?

An excellent point .. and yes, a layer shouldn't really be setting values like this
unless it was single purpose. If we have Xen and KVM both active and available
via meta-virt, then we really don't want that.

I'd convert KVM to trigger via a IMAGE or DISTRO feature as well, just as you've
done with your fragments.

Cheers,

Bruce

Quoted 3 lines

Take care,
-Chris

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

#6 lore raw

Re: [PATCH 1/4] linux-yocto: add kernel fragment and scc for xen dom0 kernel support.

In reply to Bruce Ashfield

Bruce,

I'm working on a v2 of my patches and I was curious how would you like to handle the xen kernel fragment.

Should I go back and make a patch suitable for linux-yocto and submit there? Or stage for meta-virtualization and submit again (with signoff and 3.10 support)?

Thanks,
-Chris

Quoted 116 lines · Bruce Ashfield
Quoted 2 lines · Chris Patterson
---
 recipes-kernel/linux/linux-yocto/xen.cfg |   53

++++++++++++++++++++++++++++++

Review

Quoted 6 lines
 recipes-kernel/linux/linux-yocto/xen.scc |    4 +++
 2 files changed, 57 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.scc
(quoted diff) +0 -0

b/recipes-kernel/linux/linux-yocto/xen.cfg

recipes-kernel/linux/linux-yocto/xen.cfg

Quoted 4 lines

new file mode 100644
index 0000000..f9cfb6a

recipes-kernel/linux/linux-yocto/xen.cfg new file +0 -0

Nice. The fragment looks good. I'd actually like to bump this up to the level of
in-tree support that we have for KVM.

And by that, I mean that I can merge this to the meta branch of the linux-yocto
kernel (and also found in the tracking yocto-kernel-cache repository).

Once there, it can be built and tested standalone, as well as shared by other
feature fragments. You'd then be able to just enable it via a KERNEL_FEATURES
entry, just like KVM.

Cheers,

Bruce

recipes-kernel/linux/linux-yocto/xen.cfg

Quoted 2 lines
recipes-kernel/linux/linux-yocto/xen.cfg new file +0 -0
@@ -0,0 +1,53 @@

+..........................................................................

recipes-kernel/linux/linux-yocto/xen.cfg line 11

Quoted 11 lines
recipes-kernel/linux/linux-yocto/xen.cfg new file +10 -0
+.                                WARNING
+.
+. This file is a kernel configuration fragment, and not a full kernel
+. configuration file.  The final kernel configuration is made up of
+. an assembly of processed fragments, each of which is designed to
+. capture a specific part of the final configuration (e.g. platform
+. configuration, feature configuration, and board specific hardware
+. configuration).  For more information on kernel configuration, please
+. consult the product documentation.
+.

+..........................................................................

Review

Quoted 42 lines
recipes-kernel/linux/linux-yocto/xen.cfg new file +41 -0
+
+CONFIG_PARAVIRT_GUEST=y
+# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
+CONFIG_XEN=y
+CONFIG_XEN_DOM0=y
+CONFIG_XEN_PRIVILEGED_GUEST=y
+CONFIG_XEN_PVHVM=y
+CONFIG_XEN_MAX_DOMAIN_MEMORY=500
+CONFIG_XEN_SAVE_RESTORE=y
+# CONFIG_XEN_DEBUG_FS is not set
+CONFIG_PARAVIRT=y
+# CONFIG_PARAVIRT_SPINLOCKS is not set
+CONFIG_PARAVIRT_CLOCK=y
+# CONFIG_PARAVIRT_DEBUG is not set
+CONFIG_PCI_XEN=y
+CONFIG_XEN_PCIDEV_FRONTEND=m
+CONFIG_XEN_BLKDEV_FRONTEND=m
+CONFIG_XEN_BLKDEV_BACKEND=m
+CONFIG_XEN_NETDEV_FRONTEND=m
+CONFIG_XEN_NETDEV_BACKEND=m
+CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
+CONFIG_HVC_XEN=y
+CONFIG_HVC_XEN_FRONTEND=y
+CONFIG_XEN_WDT=m
+CONFIG_XEN_FBDEV_FRONTEND=y
+# Xen driver support
+CONFIG_XEN_BALLOON=y
+CONFIG_XEN_SCRUB_PAGES=y
+CONFIG_XEN_DEV_EVTCHN=m
+CONFIG_XEN_BACKEND=y
+CONFIG_XENFS=m
+CONFIG_XEN_COMPAT_XENFS=y
+CONFIG_XEN_SYS_HYPERVISOR=y
+CONFIG_XEN_XENBUS_FRONTEND=y
+CONFIG_XEN_GNTDEV=m
+CONFIG_XEN_GRANT_DEV_ALLOC=m
+CONFIG_SWIOTLB_XEN=y
+CONFIG_XEN_PCIDEV_BACKEND=y
+CONFIG_XEN_PRIVCMD=m
+CONFIG_XEN_ACPI_PROCESSOR=m
+CONFIG_PCI_STUB=y
(quoted diff) +0 -0

b/recipes-kernel/linux/linux-yocto/xen.scc

Quoted 12 lines

new file mode 100644
index 0000000..6c68bda

recipes-kernel/linux/linux-yocto/xen.scc new file +4 -1
@@ -0,0 +1,4 @@
+define KFEATURE_DESCRIPTION "Xen Dom0 Support"
+define KFEATURE_COMPATIBILITY board
+
+kconf non-hardware xen.cfg
--

1.7.10.4

Quoted 4 lines

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

#7 lore raw

Re: [PATCH 1/4] linux-yocto: add kernel fragment and scc for xen dom0 kernel support.

Quoted 8 lines · Chris Patterson

Bruce,

I'm working on a v2 of my patches and I was curious how would you like to handle the xen kernel fragment.

Should I go back and make a patch suitable for linux-yocto and submit there? Or stage for meta-virtualization and submit again (with signoff and 3.10 support)?

Let's keep it simple, submit everything here, and I can do the leg work to pull it into linux-yocto as appropriate. It'll give me a goo chance to test things as a
side effect!

Bruce

Quoted 125 lines

Thanks,
-Chris

Quoted 116 lines · Bruce Ashfield

recipes-kernel/linux/linux-yocto/xen.cfg

Quoted 14 lines · Chris Patterson
---
 recipes-kernel/linux/linux-yocto/xen.cfg |   53
++++++++++++++++++++++++++++++
 recipes-kernel/linux/linux-yocto/xen.scc |    4 +++
 2 files changed, 57 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.scc
recipes-kernel/linux/linux-yocto/xen.cfg new file +0 -0
new file mode 100644
index 0000000..f9cfb6a

Nice. The fragment looks good. I'd actually like to bump this up to the level of
in-tree support that we have for KVM.

And by that, I mean that I can merge this to the meta branch of the linux-yocto
kernel (and also found in the tracking yocto-kernel-cache repository).

Once there, it can be built and tested standalone, as well as shared by other
feature fragments. You'd then be able to just enable it via a KERNEL_FEATURES
entry, just like KVM.

Cheers,

Bruce

Quoted 70 lines
recipes-kernel/linux/linux-yocto/xen.cfg new file +53 -0
@@ -0,0 +1,53 @@
 
+..........................................................................
+.                                WARNING
+.
+. This file is a kernel configuration fragment, and not a full kernel
+. configuration file.  The final kernel configuration is made up of
+. an assembly of processed fragments, each of which is designed to
+. capture a specific part of the final configuration (e.g. platform
+. configuration, feature configuration, and board specific hardware
+. configuration).  For more information on kernel configuration, please
+. consult the product documentation.
+.
 
+..........................................................................
+
+CONFIG_PARAVIRT_GUEST=y
+# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
+CONFIG_XEN=y
+CONFIG_XEN_DOM0=y
+CONFIG_XEN_PRIVILEGED_GUEST=y
+CONFIG_XEN_PVHVM=y
+CONFIG_XEN_MAX_DOMAIN_MEMORY=500
+CONFIG_XEN_SAVE_RESTORE=y
+# CONFIG_XEN_DEBUG_FS is not set
+CONFIG_PARAVIRT=y
+# CONFIG_PARAVIRT_SPINLOCKS is not set
+CONFIG_PARAVIRT_CLOCK=y
+# CONFIG_PARAVIRT_DEBUG is not set
+CONFIG_PCI_XEN=y
+CONFIG_XEN_PCIDEV_FRONTEND=m
+CONFIG_XEN_BLKDEV_FRONTEND=m
+CONFIG_XEN_BLKDEV_BACKEND=m
+CONFIG_XEN_NETDEV_FRONTEND=m
+CONFIG_XEN_NETDEV_BACKEND=m
+CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
+CONFIG_HVC_XEN=y
+CONFIG_HVC_XEN_FRONTEND=y
+CONFIG_XEN_WDT=m
+CONFIG_XEN_FBDEV_FRONTEND=y
+# Xen driver support
+CONFIG_XEN_BALLOON=y
+CONFIG_XEN_SCRUB_PAGES=y
+CONFIG_XEN_DEV_EVTCHN=m
+CONFIG_XEN_BACKEND=y
+CONFIG_XENFS=m
+CONFIG_XEN_COMPAT_XENFS=y
+CONFIG_XEN_SYS_HYPERVISOR=y
+CONFIG_XEN_XENBUS_FRONTEND=y
+CONFIG_XEN_GNTDEV=m
+CONFIG_XEN_GRANT_DEV_ALLOC=m
+CONFIG_SWIOTLB_XEN=y
+CONFIG_XEN_PCIDEV_BACKEND=y
+CONFIG_XEN_PRIVCMD=m
+CONFIG_XEN_ACPI_PROCESSOR=m
+CONFIG_PCI_STUB=y
recipes-kernel/linux/linux-yocto/xen.scc new file +4 -1
new file mode 100644
index 0000000..6c68bda
@@ -0,0 +1,4 @@
+define KFEATURE_DESCRIPTION "Xen Dom0 Support"
+define KFEATURE_COMPATIBILITY board
+
+kconf non-hardware xen.cfg
--

1.7.10.4

Quoted 4 lines

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#8 lore raw

PATCH 2/4 linux-yocto: add optional support for aufs and xen using DISTRO_FEATURES.

In reply to Chris Patterson
---
 recipes-kernel/linux/linux-yocto_3.4.bbappend |    6 ++++++
 recipes-kernel/linux/linux-yocto_3.8.bbappend |    6 ++++++
 2 files changed, 12 insertions(+)
recipes-kernel/linux/linux-yocto_3.4.bbappend +6 -0
index 2893a01..2ada931 100644
@@ -11,3 +11,9 @@ KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc"
 module_autoload_kvm = "kvm"
 module_autoload_kvm-amd = "kvm-amd"
 module_autoload_kvm-intel = "kvm-intel"
+
+# aufs kernel support required for core-image-xen
+KERNEL_FEATURES_append += "${@base_contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}"
+
+# xen dom0 kernel support
+SRC_URI += "${@base_contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}"
recipes-kernel/linux/linux-yocto_3.8.bbappend +6 -0
index 2893a01..2ada931 100644
@@ -11,3 +11,9 @@ KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc"
 module_autoload_kvm = "kvm"
 module_autoload_kvm-amd = "kvm-amd"
 module_autoload_kvm-intel = "kvm-intel"
+
+# aufs kernel support required for core-image-xen
+KERNEL_FEATURES_append += "${@base_contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}"
+
+# xen dom0 kernel support
+SRC_URI += "${@base_contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}"
Signature · 1 line
1.7.10.4
#9 lore raw

Re: [PATCH 2/4] linux-yocto: add optional support for aufs and xen using DISTRO_FEATURES.

Quoted 10 lines · Chris Patterson
---
 recipes-kernel/linux/linux-yocto_3.4.bbappend |    6 ++++++
 recipes-kernel/linux/linux-yocto_3.8.bbappend |    6 ++++++
 2 files changed, 12 insertions(+)
recipes-kernel/linux/linux-yocto_3.4.bbappend +0 -0
index 2893a01..2ada931 100644

recipes-kernel/linux/linux-yocto_3.4.bbappend KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" · line 19

Quoted 9 lines
recipes-kernel/linux/linux-yocto_3.4.bbappend +6 -0
@@ -11,3 +11,9 @@ KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc"
 module_autoload_kvm = "kvm"
 module_autoload_kvm-amd = "kvm-amd"
 module_autoload_kvm-intel = "kvm-intel"
+
+# aufs kernel support required for core-image-xen
+KERNEL_FEATURES_append += "${@base_contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}"
+
+# xen dom0 kernel support
+SRC_URI += "${@base_contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}"

Also nice. I like the change. With my previous comment about pulling the xen fragment into
the kernel itself, you'd be able to make these two lines consistent.

Moving up the chain to new kernels is simple after that, since I'll pull it forward as I uprev
support. (in fact, we can also add a new 3.10 fragment along with these changes now :)

Cheers,

Bruce

Quoted 21 lines
recipes-kernel/linux/linux-yocto_3.8.bbappend +6 -1
index 2893a01..2ada931 100644
@@ -11,3 +11,9 @@ KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc"
 module_autoload_kvm = "kvm"
 module_autoload_kvm-amd = "kvm-amd"
 module_autoload_kvm-intel = "kvm-intel"
+
+# aufs kernel support required for core-image-xen
+KERNEL_FEATURES_append += "${@base_contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}"
+
+# xen dom0 kernel support
+SRC_URI += "${@base_contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}"
--

1.7.10.4

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#10 lore raw

PATCH 3/4 xen: add 4.3.0 recipe.

In reply to Chris Patterson
---
 recipes-extended/xen/xen_4.3.0.bb |  623 +++++++++++++++++++++++++++++++++++++
 1 file changed, 623 insertions(+)
 create mode 100644 recipes-extended/xen/xen_4.3.0.bb
recipes-extended/xen/xen_4.3.0.bb new file +623 -0
new file mode 100644
index 0000000..baafbd8
@@ -0,0 +1,623 @@
+DESCRIPTION = "Xen hypervisor"
+HOMEPAGE = "http://xen.org"
+LICENSE = "GPLv2"
+SECTION = "console/tools"
+PR = "r0"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=e0f0f3ac55608719a82394cc353928df"
+
+SRC_URI = "http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "7b18cfb58f1ac2ce39cf35a1867f0c0a"
+SRC_URI[sha256sum] = "e1e9faabe4886e2227aacdbde74410653b233d66642ca1972a860cbec6439961"
+
+S = "${WORKDIR}/xen-${PV}"
+
+COMPATIBLE_HOST = '(x86_64.*).*-linux'
+
+inherit autotools gettext setuptools update-rc.d
+
+DEPENDS = "util-linux util-linux-native file-native zlib ncurses openssl bison-native flex-native gettext dev86-native iasl-native pciutils virtual/libgl virtual/libsdl bridge-utils iproute2 procps yajl pixman python xz xz-native"
+
+RDEPENDS_xen-base = "\
+    libgcc pciutils bridge-utils iproute2 util-linux udev procps bash coreutils python python-core python-shell python-pprint perl xz \
+    ${PN}-blktap \
+    ${PN}-console \
+    ${PN}-libblktapctl \
+    ${PN}-libxenguest \
+    ${PN}-libxenlight \
+    ${PN}-libxenvchan \
+    ${PN}-libxenctrl \
+    ${PN}-libxlutil \
+    ${PN}-libvhd \
+    ${PN}-libxenstat \
+    ${PN}-libxenstore \
+    ${PN}-libblktap \
+    ${PN}-libfsimage \
+    ${PN}-flask \
+    ${PN}-fsimage \
+    ${PN}-hvmloader \
+    ${PN}-scripts-block \
+    ${PN}-scripts-network \
+    ${PN}-udev \
+    ${PN}-xenpaging \
+    ${PN}-xen-watchdog \
+    ${PN}-xencommons \
+    ${PN}-xendomains \
+    ${PN}-xenstore \
+    ${PN}-xenstored \
+    ${PN}-xl \
+    "
+
+RDEPENDS_${PN}-scripts-block = "\
+    ${PN}-scripts-common \
+    ${PN}-udev \
+    "
+
+RDEPENDS_${PN}-scripts-network = "\
+    bridge-utils \
+    ${PN}-scripts-common \
+    ${PN}-udev \
+    "
+
+PACKAGES = "\
+    ${PN}-base \
+    ${PN}-blktap \
+    ${PN}-console \
+    ${PN}-dbg \
+    ${PN}-dev \
+    ${PN}-doc \
+    ${PN}-flask \
+    ${PN}-fsimage \
+    ${PN}-gdbsx \
+    ${PN}-hvmloader \
+    ${PN}-hypervisor \
+    ${PN}-kdd \
+    ${PN}-libblktap \
+    ${PN}-libblktapctl \
+    ${PN}-libblktapctl-dev \
+    ${PN}-libblktap-dev \
+    ${PN}-libfsimage \
+    ${PN}-libfsimage-dev \
+    ${PN}-libvhd \
+    ${PN}-libvhd-dev \
+    ${PN}-libxenctrl \
+    ${PN}-libxenctrl-dev \
+    ${PN}-libxenguest \
+    ${PN}-libxenguest-dev \
+    ${PN}-libxenlight \
+    ${PN}-libxenlight-dev \
+    ${PN}-libxenstat \
+    ${PN}-libxenstat-dev \
+    ${PN}-libxenstore \
+    ${PN}-libxenstore-dev \
+    ${PN}-libxenvchan \
+    ${PN}-libxenvchan-dev \
+    ${PN}-libxlutil \
+    ${PN}-libxlutil-dev \
+    ${PN}-misc \
+    ${PN}-pygrub \
+    ${PN}-python \
+    ${PN}-qemu \
+    ${PN}-remus \
+    ${PN}-scripts-block \
+    ${PN}-scripts-common \
+    ${PN}-scripts-network \
+    ${PN}-staticdev \
+    ${PN}-udev \
+    ${PN}-xcutils \
+    ${PN}-xencommons \
+    ${PN}-xend \
+    ${PN}-xend-examples \
+    ${PN}-xendomains \
+    ${PN}-xenmon \
+    ${PN}-xenpaging \
+    ${PN}-xenpmd \
+    ${PN}-xenstat \
+    ${PN}-xenstore \
+    ${PN}-xenstored \
+    ${PN}-xentrace \
+    ${PN}-xen-watchdog \
+    ${PN}-xl \
+    ${PN}-xl-examples \
+    ${PN}-xm \
+    ${PN}-xm-examples \
+    "
+
+FILES_${PN}-dbg += "\
+    ${libdir}/.debug \
+    ${libdir}/xen/bin/.debug \
+    ${libdir}/python2.7/site-packages/.debug \
+    ${libdir}/python2.7/site-packages/xen/lowlevel/.debug \
+    ${libdir}/fs/xfs/.debug \
+    ${libdir}/fs/ufs/.debug \
+    ${libdir}/fs/ext2fs-lib/.debug \
+    ${libdir}/fs/fat/.debug \
+    ${libdir}/fs/zfs/.debug \
+    ${libdir}/fs/reiserfs/.debug \
+    ${libdir}/fs/iso9660/.debug \
+    ${sbindir}/.debug \
+    ${libdir}exec/.debug \
+    ${bindir}/.debug \
+    ${libdir}/python2.7/dist-packages/.debug \
+    ${libdir}/python2.7/dist-packages/xen/lowlevel/.debug \
+    "
+
+FILES_${PN}-dev = "\
+    ${includedir} \
+    "
+
+FILES_${PN}-doc = "\
+    ${sysconfdir}/xen/README \
+    ${sysconfdir}/xen/README.incompatibilities \
+    ${datadir}/doc \
+    ${datadir}/man \
+    "
+
+FILES_${PN}-staticdev += "\
+    ${libdir}/libblktapctl.a \
+    ${libdir}/libxenguest.a \
+    ${libdir}/libxenlight.a \
+    ${libdir}/libxenvchan.a \
+    ${libdir}/libxenctrl.a \
+    ${libdir}/libxlutil.a \
+    ${libdir}/libvhd.a \
+    ${libdir}/libxenstat.a \
+    ${libdir}/libxenstore.a \
+    ${libdir}/libblktap.a \
+    "
+
+FILES_${PN}-libblktapctl = "${libdir}/libblktapctl.so.*"
+FILES_${PN}-libblktapctl-dev = "${libdir}/libblktapctl.so"
+
+FILES_${PN}-libxenguest = "${libdir}/libxenguest.so.*"
+FILES_${PN}-libxenguest-dev = "${libdir}/libxenguest.so"
+
+FILES_${PN}-libxenlight = "${libdir}/libxenlight.so.*"
+FILES_${PN}-libxenlight-dev = "${libdir}/libxenlight.so"
+
+FILES_${PN}-libxenvchan = "${libdir}/libxenvchan.so.*"
+FILES_${PN}-libxenvchan-dev = "${libdir}/libxenvchan.so"
+
+FILES_${PN}-libxenctrl = "${libdir}/libxenctrl.so.*"
+FILES_${PN}-libxenctrl-dev = "${libdir}/libxenctrl.so"
+
+FILES_${PN}-libxlutil = "${libdir}/libxlutil.so.*"
+FILES_${PN}-libxlutil-dev = "${libdir}/libxlutil.so"
+
+FILES_${PN}-libvhd = "${libdir}/libvhd.so.*"
+FILES_${PN}-libvhd-dev = "${libdir}/libvhd.so"
+
+FILES_${PN}-libxenstat = "${libdir}/libxenstat.so.*"
+FILES_${PN}-libxenstat-dev = "${libdir}/libxenstat.so"
+
+FILES_${PN}-libxenstore = "${libdir}/libxenstore.so.*"
+FILES_${PN}-libxenstore-dev = "${libdir}/libxenstore.so"
+
+FILES_${PN}-libblktap = "${libdir}/libblktap.so.*"
+FILES_${PN}-libblktap-dev = "${libdir}/libblktap.so"
+
+FILES_${PN}-libfsimage = "${libdir}/libfsimage.so.*"
+FILES_${PN}-libfsimage-dev = "${libdir}/libfsimage.so"
+
+FILES_${PN}-fsimage = "${libdir}/fs/*/*fsimage.so"
+
+FILES_${PN}-hypervisor = "\
+    /boot/xen-4.3.0.gz \
+    /boot/xen-4.3.gz \
+    /boot/xen-4.gz \
+    /boot/xen.gz \
+    /boot/xen-syms-4.3.0 \
+    "
+
+FILES_${PN}-base = "\
+    ${sysconfdir}/default/volatiles/99_xen \
+    ${sysconfdir}/default/xencommons \
+    ${sysconfdir}/default/xendomains \
+    ${sysconfdir}/xen/auto \
+    ${sysconfdir}/xen/cpupool \
+    ${sysconfdir}/sysconfig/xendomains \
+    ${localstatedir}/xen/dump \
+    "
+
+FILES_${PN}-blktap = "\
+    ${sbindir}/blktapctrl \
+    ${sbindir}/img2qcow \
+    ${sbindir}/lock-util \
+    ${sbindir}/qcow2raw \
+    ${sbindir}/qcow-create \
+    ${sbindir}/tap-ctl \
+    ${sbindir}/tapdisk \
+    ${sbindir}/tapdisk2 \
+    ${sbindir}/tapdisk-client \
+    ${sbindir}/tapdisk-diff \
+    ${sbindir}/tapdisk-stream \
+    ${sbindir}/td-util \
+    ${sbindir}/vhd-update \
+    ${sbindir}/vhd-util \
+    "
+
+FILES_${PN}-console = "\
+    ${libdir}/xen/bin/xenconsole \
+    ${sbindir}/xenconsoled \
+    "
+
+FILES_${PN}-flask = "\
+    ${sbindir}/flask-get-bool \
+    ${sbindir}/flask-getenforce \
+    ${sbindir}/flask-label-pci \
+    ${sbindir}/flask-loadpolicy \
+    ${sbindir}/flask-set-bool \
+    ${sbindir}/flask-setenforce \
+    "
+
+FILES_${PN}-gdbsx = "\
+    ${sbindir}/gdbsx \
+    "
+
+INSANE_SKIP_${PN}-hvmloader = "arch"
+FILES_${PN}-hvmloader = "\
+    ${libdir}/xen/boot/hvmloader \
+    "
+
+FILES_${PN}-kdd = "\
+    ${sbindir}/kdd \
+    "
+
+FILES_${PN}-misc = "\
+    ${bindir}/xencons \
+    ${bindir}/xencov_split \
+    ${bindir}/xen-detect \
+    ${libdir}/xen/bin/xenpvnetboot \
+    ${sbindir}/gtracestat \
+    ${sbindir}/gtraceview \
+    ${sbindir}/xen-bugtool \
+    ${sbindir}/xencov \
+    ${sbindir}/xend \
+    ${sbindir}/xenperf \
+    ${sbindir}/xenpm \
+    ${sbindir}/xsview \
+    ${sbindir}/xen-tmem-list-parse \
+    ${sbindir}/xen-python-path \
+    ${sbindir}/xen-ringwatch \
+    ${sbindir}/xen-hptool \
+    ${sbindir}/xen-hvmcrash \
+    ${sbindir}/xen-hvmctx \
+    ${sbindir}/xenlockprof \
+    ${sbindir}/xen-lowmemd \
+    "
+
+FILES_${PN}-pygrub = "\
+    ${bindir}/pygrub \
+    ${libdir}/xen/bin/pygrub \
+    "
+
+FILES_${PN}-python = "\
+    ${libdir}/python2.7 \
+    "
+
+INSANE_SKIP_${PN}-qemu = "arch"
+FILES_${PN}-qemu = " \
+    ${datadir}/xen/qemu \
+    ${libdir}/xen/bin/qemu-system-i386 \
+    ${libdir}/xen/bin/qemu-system-x86_64 \
+    ${libdir}/xen/bin/qemu-img \
+    ${libdir}/xen/bin/qemu-nbd \
+    ${libdir}/xen/bin/qemu-ga \
+    ${libdir}/xen/bin/qemu-io \
+    ${libdir}/xen/bin/qemu-dm \
+    ${libdir}/xen/bin/virtfs-proxy-helper \
+    /usr/libexec/qemu-bridge-helper \
+    /usr/etc/qemu \
+    /usr/etc/qemu/target-x86_64.conf \
+    ${datadir}/qemu-xen \
+    ${datadir}/qemu-xen/qemu \
+    ${datadir}/qemu-xen/qemu/bamboo.dtb \
+    ${datadir}/qemu-xen/qemu/pxe-pcnet.rom \
+    ${datadir}/qemu-xen/qemu/vgabios-vmware.bin \
+    ${datadir}/qemu-xen/qemu/pxe-eepro100.rom \
+    ${datadir}/qemu-xen/qemu/pxe-e1000.rom \
+    ${datadir}/qemu-xen/qemu/openbios-ppc \
+    ${datadir}/qemu-xen/qemu/multiboot.bin \
+    ${datadir}/qemu-xen/qemu/vgabios-cirrus.bin \
+    ${datadir}/qemu-xen/qemu/bios.bin \
+    ${datadir}/qemu-xen/qemu/vgabios-stdvga.bin \
+    ${datadir}/qemu-xen/qemu/palcode-clipper \
+    ${datadir}/qemu-xen/qemu/pxe-ne2k_pci.rom \
+    ${datadir}/qemu-xen/qemu/spapr-rtas.bin \
+    ${datadir}/qemu-xen/qemu/slof.bin \
+    ${datadir}/qemu-xen/qemu/vgabios-qxl.bin \
+    ${datadir}/qemu-xen/qemu/pxe-rtl8139.rom \
+    ${datadir}/qemu-xen/qemu/openbios-sparc64 \
+    ${datadir}/qemu-xen/qemu/pxe-virtio.rom \
+    ${datadir}/qemu-xen/qemu/kvmvapic.bin \
+    ${datadir}/qemu-xen/qemu/openbios-sparc32 \
+    ${datadir}/qemu-xen/qemu/petalogix-s3adsp1800.dtb \
+    ${datadir}/qemu-xen/qemu/sgabios.bin \
+    ${datadir}/qemu-xen/qemu/linuxboot.bin \
+    ${datadir}/qemu-xen/qemu/qemu-icon.bmp \
+    ${datadir}/qemu-xen/qemu/ppc_rom.bin \
+    ${datadir}/qemu-xen/qemu/vgabios.bin \
+    ${datadir}/qemu-xen/qemu/s390-zipl.rom \
+    ${datadir}/qemu-xen/qemu/petalogix-ml605.dtb \
+    ${datadir}/qemu-xen/qemu/keymaps \
+    ${datadir}/qemu-xen/qemu/keymaps/common \
+    ${datadir}/qemu-xen/qemu/keymaps/th \
+    ${datadir}/qemu-xen/qemu/keymaps/is \
+    ${datadir}/qemu-xen/qemu/keymaps/en-gb \
+    ${datadir}/qemu-xen/qemu/keymaps/ar \
+    ${datadir}/qemu-xen/qemu/keymaps/fr-be \
+    ${datadir}/qemu-xen/qemu/keymaps/ru \
+    ${datadir}/qemu-xen/qemu/keymaps/hu \
+    ${datadir}/qemu-xen/qemu/keymaps/de-ch \
+    ${datadir}/qemu-xen/qemu/keymaps/no \
+    ${datadir}/qemu-xen/qemu/keymaps/fr \
+    ${datadir}/qemu-xen/qemu/keymaps/pl \
+    ${datadir}/qemu-xen/qemu/keymaps/fr-ca \
+    ${datadir}/qemu-xen/qemu/keymaps/de \
+    ${datadir}/qemu-xen/qemu/keymaps/fr-ch \
+    ${datadir}/qemu-xen/qemu/keymaps/bepo \
+    ${datadir}/qemu-xen/qemu/keymaps/lv \
+    ${datadir}/qemu-xen/qemu/keymaps/ja \
+    ${datadir}/qemu-xen/qemu/keymaps/da \
+    ${datadir}/qemu-xen/qemu/keymaps/lt \
+    ${datadir}/qemu-xen/qemu/keymaps/hr \
+    ${datadir}/qemu-xen/qemu/keymaps/es \
+    ${datadir}/qemu-xen/qemu/keymaps/modifiers \
+    ${datadir}/qemu-xen/qemu/keymaps/sl \
+    ${datadir}/qemu-xen/qemu/keymaps/it \
+    ${datadir}/qemu-xen/qemu/keymaps/nl \
+    ${datadir}/qemu-xen/qemu/keymaps/fo \
+    ${datadir}/qemu-xen/qemu/keymaps/mk \
+    ${datadir}/qemu-xen/qemu/keymaps/pt-br \
+    ${datadir}/qemu-xen/qemu/keymaps/tr \
+    ${datadir}/qemu-xen/qemu/keymaps/sv \
+    ${datadir}/qemu-xen/qemu/keymaps/fi \
+    ${datadir}/qemu-xen/qemu/keymaps/en-us \
+    ${datadir}/qemu-xen/qemu/keymaps/et \
+    ${datadir}/qemu-xen/qemu/keymaps/nl-be \
+    ${datadir}/qemu-xen/qemu/keymaps/pt \
+    ${bindir}/qemu-nbd-xen \
+    ${bindir}/qemu-img-xen \
+    "
+
+FILES_${PN}-remus = "\
+    ${bindir}/remus \
+    "
+
+FILES_${PN}-scripts-network = " \
+    ${sysconfdir}/xen/scripts/network-bridge \
+    ${sysconfdir}/xen/scripts/network-nat \
+    ${sysconfdir}/xen/scripts/network-route \
+    ${sysconfdir}/xen/scripts/qemu-ifup \
+    ${sysconfdir}/xen/scripts/vif2 \
+    ${sysconfdir}/xen/scripts/vif-bridge \
+    ${sysconfdir}/xen/scripts/vif-common.sh \
+    ${sysconfdir}/xen/scripts/vif-nat \
+    ${sysconfdir}/xen/scripts/vif-openvswitch \
+    ${sysconfdir}/xen/scripts/vif-route \
+    ${sysconfdir}/xen/scripts/vif-setup \
+    "
+
+FILES_${PN}-scripts-block = " \
+    ${sysconfdir}/xen/scripts/blktap \
+    ${sysconfdir}/xen/scripts/block \
+    ${sysconfdir}/xen/scripts/block-common.sh \
+    ${sysconfdir}/xen/scripts/block-enbd \
+    ${sysconfdir}/xen/scripts/block-iscsi \
+    ${sysconfdir}/xen/scripts/block-nbd \
+    ${sysconfdir}/xen/scripts/vscsi \
+    "
+
+FILES_${PN}-scripts-common = " \
+    ${sysconfdir}/xen/scripts/external-device-migrate \
+    ${sysconfdir}/xen/scripts/hotplugpath.sh \
+    ${sysconfdir}/xen/scripts/locking.sh \
+    ${sysconfdir}/xen/scripts/logging.sh \
+    ${sysconfdir}/xen/scripts/xen-hotplug-cleanup \
+    ${sysconfdir}/xen/scripts/xen-hotplug-common.sh \
+    ${sysconfdir}/xen/scripts/xen-network-common.sh \
+    ${sysconfdir}/xen/scripts/xen-script-common.sh \
+    "
+
+FILES_${PN}-udev = "\
+    ${sysconfdir}/udev/rules.d/xen-backend.rules \
+    ${sysconfdir}/udev/rules.d/xend.rules \
+    "
+
+FILES_${PN}-xcutils = "\
+    ${libdir}/xen/bin/lsevtchn \
+    ${libdir}/xen/bin/readnotes \
+    ${libdir}/xen/bin/xc_restore \
+    ${libdir}/xen/bin/xc_save \
+    "
+
+FILES_${PN}-xend-examples = "\
+    ${sysconfdir}/xen/xend-config.sxp \
+    ${sysconfdir}/xen/xend-pci-permissive.sxp \
+    ${sysconfdir}/xen/xend-pci-quirks.sxp \
+    "
+
+FILES_${PN}-xenpaging = "\
+    ${libdir}/xen/bin/xenpaging \
+    ${localstatedir}/lib/xen/xenpaging \
+    "
+
+FILES_${PN}-xenpmd = "\
+    ${sbindir}/xenpmd \
+    "
+
+FILES_${PN}-xenstat = "\
+    ${sbindir}/xentop \
+    "
+
+FILES_${PN}-xenstore = "\
+    ${bindir}/xenstore \
+    ${bindir}/xenstore-chmod \
+    ${bindir}/xenstore-control \
+    ${bindir}/xenstore-exists \
+    ${bindir}/xenstore-list \
+    ${bindir}/xenstore-ls \
+    ${bindir}/xenstore-read \
+    ${bindir}/xenstore-rm \
+    ${bindir}/xenstore-watch \
+    ${bindir}/xenstore-write \
+    "
+
+FILES_${PN}-xenstored = "\
+    ${sbindir}/xenstored \
+    ${localstatedir}/lib/xenstored \
+    "
+
+FILES_${PN}-xentrace = "\
+    ${bindir}/xentrace \
+    ${bindir}/xentrace_format \
+    ${bindir}/xentrace_setsize \
+    ${libdir}/xen/bin/xenctx \
+    "
+
+FILES_${PN}-xen-watchdog = "\
+    ${sbindir}/xenwatchdogd \
+    "
+
+FILES_${PN}-xl = "\
+    ${sysconfdir}/bash_completion.d/xl.sh \
+    ${sysconfdir}/xen/xl.conf \
+    ${libdir}/xen/bin/libxl-save-helper \
+    ${sbindir}/xl \
+    "
+
+FILES_${PN}-xl-examples = "\
+    ${sysconfdir}/xen/xlexample.hvm \
+    ${sysconfdir}/xen/xlexample.pvlinux \
+    "
+
+FILES_${PN}-xm-examples = "\
+    ${sysconfdir}/xen/xmexample1 \
+    ${sysconfdir}/xen/xmexample2 \
+    ${sysconfdir}/xen/xmexample3 \
+    ${sysconfdir}/xen/xmexample.hvm \
+    ${sysconfdir}/xen/xmexample.hvm-stubdom \
+    ${sysconfdir}/xen/xmexample.nbd \
+    ${sysconfdir}/xen/xmexample.pv-grub \
+    ${sysconfdir}/xen/xmexample.vti \
+    "
+
+FILES_${PN}-xenmon = "\
+    ${sbindir}/xenbaked \
+    ${sbindir}/xentrace_setmask \
+    ${sbindir}/xenmon.py \
+    "
+
+FILES_${PN}-xm = "\
+    ${sysconfdir}/xen/xm-config.xml \
+    ${datadir}/xen/create.dtd \
+    ${sbindir}/xm \
+    "
+
+FILES_${PN}-xencommons += "${sysconfdir}/init.d/xencommons"
+FILES_${PN}-xend += "${sysconfdir}/init.d/xend"
+FILES_${PN}-xendomains += "${sysconfdir}/init.d/xendomains"
+FILES_${PN}-xen-watchdog += "${sysconfdir}/init.d/xen-watchdog"
+
+# configure init.d scripts
+INITSCRIPT_PACKAGES = "${PN}-xend ${PN}-xencommons ${PN}-xen-watchdog ${PN}-xendomains"
+INITSCRIPT_NAME_${PN}-xencommons = "xencommons"
+INITSCRIPT_PARAMS_${PN}-xencommons = "defaults 80"
+INITSCRIPT_NAME_${PN}-xen-watchdog = "xen-watchdog"
+INITSCRIPT_PARAMS_${PN}-xen-watchdog = "defaults 81"
+INITSCRIPT_NAME_${PN}-xend = "xend"
+INITSCRIPT_PARAMS_${PN}-xend = "defaults 82"
+INITSCRIPT_NAME_${PN}-xendomains = "xendomains"
+INITSCRIPT_PARAMS_${PN}-xendomains = "defaults 83"
+
+#### REQUIRED ENVIRONMENT VARIABLES ####
+export BUILD_SYS
+export HOST_SYS
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+# specify xen hypervisor to target x86_64 (x86_32 not supported)
+export XEN_TARGET_ARCH="x86_64"
+export XEN_COMPILE_ARCH="x86_64"
+
+# this is used for the header (#!${bindir}/python) of the install python scripts
+export PYTHONPATH="${bindir}/python"
+
+# seabios forcefully sets HOSTCC to CC - fixup to allow it to build native conf executable
+export HOSTCC="${BUILD_CC}"
+
+# make xen requires CROSS_COMPILE set by hand as it does not abide by ./configure
+export CROSS_COMPILE="${TARGET_PREFIX}"
+
+# overide LDFLAGS to allow xen to build without: "x86_64-oe-linux-ld: unrecognized option '-Wl,-O1'"
+export LDFLAGS=""
+
+do_configure() {
+    # fixup qemu-xen-traditional pciutils check hardcoded to test ${includedir}/pci
+    sed -i 's/\/usr\/include\/pci/$(STAGING_INCDIR)\/pci/g' ${S}/tools/qemu-xen-traditional/xen-hooks.mak
+
+    # fixup for qemu to cross compile
+    sed -i 's/configure --d/configure --cross-prefix=${TARGET_PREFIX} --d/g' ${S}/tools/qemu-xen-traditional/xen-setup
+
+    # no stubs-32.h in our 64-bit sysroot - hack it into tools/include/gnu
+    test -d ${S}/tools/include/gnu || mkdir ${S}/tools/include/gnu
+    if ! test -f ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-32.h ; then
+        cat ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-64.h | grep -v stub_bdflush | grep -v stub_getmsg | grep -v stub_putmsg > ${S}/tools/include/gnu/stubs-32.h
+        echo \#define __stub___kernel_cosl >> ${S}/tools/include/gnu/stubs-32.h
+        echo \#define __stub___kernel_sinl >> ${S}/tools/include/gnu/stubs-32.h
+        echo \#define __stub___kernel_tanl >> ${S}/tools/include/gnu/stubs-32.h
+    fi
+
+    # do configure
+    ./configure --exec-prefix=/usr --prefix=/usr --host=${HOST_SYS} --disable-stubdom --disable-ioemu-stubdom --disable-pv-grub --disable-xenstore-stubdom
+
+    # seabios needs a patch to specify correct compiler - pull and patch Makefile
+    make -C ${S}/tools/firmware seabios-dir
+    sed -i 's/export HOSTCC.*$(CC)/export HOSTCC ?= $(CC)/g' ${S}/tools/firmware/seabios-dir/Makefile
+}
+
+do_compile() {
+    oe_runmake
+}
+
+do_install() {
+    oe_runmake DESTDIR="${D}" install
+
+    # remove installed volatiles
+    rm -rf ${D}${localstatedir}/run ${D}${localstatedir}/lock ${D}${localstatedir}/log ${D}${localstatedir}/volatile
+
+    # install volatiles using populate_volatiles mechanism
+    install -d ${D}${sysconfdir}/default/volatiles
+    echo "d root root 0755 ${localstatedir}/run/xenstored none" \
+         > ${D}${sysconfdir}/default/volatiles/99_xen
+    echo "d root root 0755 ${localstatedir}/run/xend none" \
+         >> ${D}${sysconfdir}/default/volatiles/99_xen
+    echo "d root root 0755 ${localstatedir}/run/xend/boot none" \
+         >> ${D}${sysconfdir}/default/volatiles/99_xen
+    echo "d root root 0755 ${localstatedir}/run/xen none" \
+         >> ${D}${sysconfdir}/default/volatiles/99_xen
+    echo "d root root 0755 ${localstatedir}/log/xen none" \
+         >> ${D}${sysconfdir}/default/volatiles/99_xen
+    echo "d root root 0755 ${localstatedir}/lock/xen none" \
+         >> ${D}${sysconfdir}/default/volatiles/99_xen
+    echo "d root root 0755 ${localstatedir}/lock/subsys none" \
+         >> ${D}${sysconfdir}/default/volatiles/99_xen
+
+    # workaround for xendomains script which searchs sysconfig if directory exists
+    install -d ${D}${sysconfdir}/sysconfig
+    ln -sf ${sysconfdir}/default/xendomains ${D}${sysconfdir}/sysconfig/xendomains
+}
+
+pkg_postinst_${PN}-base() {
+    if [ -z "$D" ] && [ -e ${sysconfdir}/init.d/populate-volatile.sh ] ; then
+        ${sysconfdir}/init.d/populate-volatile.sh update
+    fi
+}
+
+sysroot_stage_all_append() {
+        sysroot_stage_dir ${D}/boot ${SYSROOT_DESTDIR}/kernel
+
+    install -d ${DEPLOY_DIR_IMAGE}
+    install -m 0644 ${D}/boot/xen.gz ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz
+}
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH 4/4 xen-image-minimal: update image to support xen 4.3.0 base with xl toolstack.

In reply to Chris Patterson

xen-image-initramfs: newly added initrd to support testing xen-image-minimal and init script based on init-live.sh.

---
 recipes-extended/images/xen-image-initramfs.bb     |   17 ++
 recipes-extended/images/xen-image-minimal.bb       |   55 +++++-
 .../initrdscripts/files/init-boot-xen.sh           |  205 ++++++++++++++++++++
 .../initrdscripts/initramfs-boot-xen_1.0.bb        |   16 ++
 4 files changed, 286 insertions(+), 7 deletions(-)
 create mode 100644 recipes-extended/images/xen-image-initramfs.bb
 create mode 100644 recipes-extended/initrdscripts/files/init-boot-xen.sh
 create mode 100644 recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb
recipes-extended/images/xen-image-initramfs.bb new file +17 -0
new file mode 100644
index 0000000..d2f1301
@@ -0,0 +1,17 @@
+DESCRIPTION = "Xen image initramfs"
+
+IMAGE_INSTALL = "initramfs-boot-xen busybox udev udev-extraconf base-passwd coreutils"
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
+export IMAGE_BASENAME = "xen-image-initramfs"
+
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
recipes-extended/images/xen-image-minimal.bb +48 -7

62 lines not on this page · raw message

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +205 -0

205 lines not on this page · raw message

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +16 -0
new file mode 100644
index 0000000..9380e83
@@ -0,0 +1,16 @@
+DESCRIPTION = "A live image init script with support for Xen"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+SRC_URI = "file://init-boot-xen.sh"
+PR = "r0"
+
+inherit allarch
+
+RDEPENDS_${PN} = "udev udev-extraconf"
+
+FILES_${PN} += " /init "
+
+do_install() {
+        install -m 0755 ${WORKDIR}/init-boot-xen.sh ${D}/init
+}
+
Signature · 1 line
1.7.10.4
#12 lore raw

Re: [PATCH 4/4] xen-image-minimal: update image to support xen 4.3.0 base with xl toolstack.

Quoted 319 lines · Chris Patterson

xen-image-initramfs: newly added initrd to support testing xen-image-minimal and init script based on init-live.sh.

---
 recipes-extended/images/xen-image-initramfs.bb     |   17 ++
 recipes-extended/images/xen-image-minimal.bb       |   55 +++++-
 .../initrdscripts/files/init-boot-xen.sh           |  205 ++++++++++++++++++++
 .../initrdscripts/initramfs-boot-xen_1.0.bb        |   16 ++
 4 files changed, 286 insertions(+), 7 deletions(-)
 create mode 100644 recipes-extended/images/xen-image-initramfs.bb
 create mode 100644 recipes-extended/initrdscripts/files/init-boot-xen.sh
 create mode 100644 recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb
recipes-extended/images/xen-image-initramfs.bb new file +17 -0
new file mode 100644
index 0000000..d2f1301
@@ -0,0 +1,17 @@
+DESCRIPTION = "Xen image initramfs"
+
+IMAGE_INSTALL = "initramfs-boot-xen busybox udev udev-extraconf base-passwd coreutils"
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
+export IMAGE_BASENAME = "xen-image-initramfs"
+
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
recipes-extended/images/xen-image-minimal.bb +48 -7
index 0cf55d6..c941339 100644
@@ -1,14 +1,55 @@
-DESCRIPTION = "A minimal xen image"
-IMAGE_INSTALL = "packagegroup-core-boot xen-minimal dropbear mdadm"
+DESCRIPTION = "Image with Xen."
+
+INITRD_IMAGE ?= "xen-image-initramfs"
+
+IMAGE_INSTALL += " \
+    ${CORE_IMAGE_BASE_INSTALL} \
+    packagegroup-core-basic \
+    packagegroup-core-ssh-openssh \
+    kernel-module-xen-acpi-processor \
+    kernel-module-xen-blkback \
+    kernel-module-xen-blkfront \
+    kernel-module-xen-evtchn \
+    kernel-module-xenfs \
+    kernel-module-xen-gntalloc \
+    kernel-module-xen-gntdev \
+    kernel-module-xen-netback \
+    kernel-module-xen-netfront \
+    kernel-module-xen-pcifront \
+    kernel-module-xen-privcmd \
+    kernel-module-xen-wdt \
+    xen-base \
+    xen-qemu \
+    ${ROOTFS_PKGMANAGE_BOOTSTRAP} \
+    "
 
-IMAGE_LINGUAS = " "
 LICENSE = "MIT"
 
 inherit core-image
 
-IMAGE_ROOTFS_SIZE = "8192"
+syslinux_iso_populate_append() {
+       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32 ${ISODIR}${ISOLINUXDIR}
+}
+
+syslinux_hddimg_populate_append() {
+       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32 ${HDDDIR}${SYSLINUXDIR}
+}
+
+grubefi_populate_append() {
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz ${DEST}${EFIDIR}/xen.gz
+}
+
+populate_append() {
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz ${DEST}/xen.gz
+}
 
-# remove not needed ipkg informations
-ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; "
+build_syslinux_cfg () {
+       echo "ALLOWOPTIONS 1" > ${SYSLINUXCFG}
+       echo "DEFAULT boot" >> ${SYSLINUXCFG}
+       echo "TIMEOUT 10" >> ${SYSLINUXCFG}
+       echo "PROMPT 1" >> ${SYSLINUXCFG}
+       echo "LABEL boot" >> ${SYSLINUXCFG}
+       echo "  KERNEL mboot.c32" >> ${SYSLINUXCFG}
+       echo "  APPEND /xen.gz loglvl=all guest_loglvl=all console=com1,vga com1=115200,8n1 --- /vmlinuz ramdisk_size=32768 root=/dev/ram0 rw console=hvc0 earlyprintk=xen console=tty0 panic=10 --- /initrd" >> ${SYSLINUXCFG}
+}
 
-require xen-bootimg.inc
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +205 -0
new file mode 100644
index 0000000..741f201
@@ -0,0 +1,205 @@
+#!/bin/sh
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+ROOT_MOUNT="/rootfs/"
+ROOT_IMAGE="rootfs.img"
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+ISOLINUX=""
+
+# Copied from initramfs-framework. The core of this script probably should be
+# turned into initramfs-framework modules to reduce duplication.
+udev_daemon() {
+       OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd /sbin/systemd/systemd-udevd /lib/systemd/systemd-udevd"
+
+       for o in $OPTIONS; do
+               if [ -x "$o" ]; then
+                       echo $o
+                       return 0
+               fi
+       done
+
+       return 1
+}
+
+_UDEV_DAEMON=`udev_daemon`
+
+early_setup() {
+    mkdir -p /proc
+    mkdir -p /sys
+    mount -t proc proc /proc
+    mount -t sysfs sysfs /sys
+    mount -t devtmpfs none /dev
+
+    # support modular kernel
+    modprobe isofs 2> /dev/null
+
+    mkdir -p /run
+    mkdir -p /var/run
+    mkdir -p /media
+
+    $_UDEV_DAEMON --daemon
+    udevadm trigger --action=add
+}
+
+read_args() {
+    [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
+    for arg in $CMDLINE; do
+        optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+        case $arg in
+            root=*)
+                ROOT_DEVICE=$optarg ;;
+            rootfstype=*)
+                modprobe $optarg 2> /dev/null ;;
+            LABEL=*)
+                label=$optarg ;;
+            video=*)
+                video_mode=$arg ;;
+            vga=*)
+                vga_mode=$arg ;;
+            console=*)
+                if [ -z "${console_params}" ]; then
+                    console_params=$arg
+                else
+                    console_params="$console_params $arg"
+                fi ;;
+            debugshell*)
+                if [ -z "$optarg" ]; then
+                        shelltimeout=30
+                else
+                        shelltimeout=$optarg
+                fi
+        esac
+    done
+}
+
+boot_live_root() {
+    # Watches the udev event queue, and exits if all current events are handled
+    udevadm settle --timeout=3 --quiet
+    killall "${_UDEV_DAEMON##*/}" 2>/dev/null
+
+    # Move the mount points of some filesystems over to
+    # the corresponding directories under the real root filesystem.
+    for dir in `awk '/\/dev.* \/media/{print $2}' /proc/mounts`; do
+        mkdir -p  ${ROOT_MOUNT}/$dir
+        mount -n --move $dir ${ROOT_MOUNT}/$dir
+    done
+    mount -n --move /proc ${ROOT_MOUNT}/proc
+    mount -n --move /sys ${ROOT_MOUNT}/sys
+    mount -n --move /dev ${ROOT_MOUNT}/dev
+
+    cd $ROOT_MOUNT
+    exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init
+}
+
+fatal() {
+    echo $1 >$CONSOLE
+    echo >$CONSOLE
+    exec sh
+}
+
+early_setup
+
+[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
+
+read_args
+
+echo "Waiting for removable media..."
+C=0
+shelltimeout=5
+while true
+do
+  udevadm trigger
+  udevadm settle
+  for i in `ls /media 2>/dev/null`; do
+      if [ -f /media/$i/$ROOT_IMAGE ] ; then
+               found="yes"
+               break
+         elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
+               found="yes"
+               ISOLINUX="isolinux"
+               break
+      fi
+  done
+  if [ "$found" = "yes" ]; then
+      break;
+  fi
+  # don't wait for more than $shelltimeout seconds, if it's set
+  if [ -n "$shelltimeout" ]; then
+      echo -n " " $(( $shelltimeout - $C ))
+      if [ $C -ge $shelltimeout ]; then
+           echo "..."
+          echo "Mounted filesystems"
+           mount | grep media
+           echo "Available block devices"
+           ls /dev/sd*
+           fatal "Cannot find rootfs.img file in /media/* , dropping to a shell "
+      fi
+      C=$(( C + 1 ))
+  fi
+  sleep 1
+done
+
+# Try to make a union mount of the root image.
+# If no unification filesystem is available, mount the image read-only.
+mount_and_boot() {
+    mkdir $ROOT_MOUNT
+
+    mknod /dev/loop0 b 7 0 2>/dev/null
+
+    # determine which unification filesystem to use
+    union_fs_type=""
+    if grep -q -w "overlayfs" /proc/filesystems; then
+       union_fs_type="overlayfs"
+    elif grep -q -w "aufs" /proc/filesystems; then
+       union_fs_type="aufs"
+    else
+       union_fs_type=""
+    fi
+    # make a union mount if possible
+    case $union_fs_type in
+       "overlayfs")
+           mkdir -p /rootfs.ro /rootfs.rw
+           if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then
+               rm -rf /rootfs.ro /rootfs.rw
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+               mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT
+               mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+               mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+               mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+           fi
+           ;;
+       "aufs")
+           mkdir -p /rootfs.ro /rootfs.rw
+           if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then
+               rm -rf /rootfs.ro /rootfs.rw
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+               mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro" aufs $ROOT_MOUNT
+               mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+               mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+               mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+           fi
+           ;;
+       "")
+           if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs $ROOT_MOUNT/media
+           fi
+           ;;
+    esac
+
+    # boot the image
+    boot_live_root
+}
+
+mount_and_boot
+
+# If we're getting here, we failed...
+fatal "Installation image failed"
+
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +1 -0
new file mode 100644
index 0000000..9380e83
@@ -0,0 +1,16 @@
+DESCRIPTION = "A live image init script with support for Xen"

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb line 11

Quoted 10 lines
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +10 -0
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+SRC_URI = "file://init-boot-xen.sh"
+PR = "r0"
+
+inherit allarch
+
+RDEPENDS_${PN} = "udev udev-extraconf"
+
+FILES_${PN} += " /init "

I was going to ask if you are seeing any QA warnings with this, since in the past we've had
to use update alternatives and priority to ensure that the right init was used in an image .. but
then I noticed this is only pulled into the minimal config and there shouldn't be any conflicting
init providers!

Bruce

Quoted 12 lines
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +5 -1
+
+do_install() {
+        install -m 0755 ${WORKDIR}/init-boot-xen.sh ${D}/init
+}
+
--

1.7.10.4

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#13 lore raw

Re: [PATCH 4/4] xen-image-minimal: update image to support xen 4.3.0 base with xl toolstack.

The reasoning for xen-image-initramfs was that I had minor issues with using stock core-image-minimal-initramfs and initramfs-live-boot.

However, I have since tracked down the issue I was having with initramfs-live-boot, and determined we could drop initramfs-boot-xen in favor of initramfs-live-boot simply by adding LABEL=boot to the kernel args.

Beyond that, vanilla core-image-minimal-initramfs would hang at "Waiting for removeable media..." indefinitely. After some testing, It appeared that adding coreutils to core-image-minimal-initramfs would resolve the issue (though not yet sure why, but looking into it).

Quoted 387 lines · Bruce Ashfield
Quoted 1 line · Chris Patterson

xen-image-initramfs: newly added initrd to support testing

xen-image-minimal and init script based on init-live.sh.

Quoted 4 lines
---
 recipes-extended/images/xen-image-initramfs.bb     |   17 ++
 recipes-extended/images/xen-image-minimal.bb       |   55 +++++-
 .../initrdscripts/files/init-boot-xen.sh           |  205

++++++++++++++++++++

Quoted 5 lines
 .../initrdscripts/initramfs-boot-xen_1.0.bb        |   16 ++
 4 files changed, 286 insertions(+), 7 deletions(-)
 create mode 100644 recipes-extended/images/xen-image-initramfs.bb
 create mode 100644 recipes-extended/initrdscripts/files/init-boot-xen.sh
 create mode 100644 recipes-extended/initrdscripts/

initramfs-boot-xen_1.0.bb

Review

Quoted 2 lines
(quoted diff) +0 -0

xen-image-initramfs.bb

recipes-extended/images/xen-image-initramfs.bb line 3

Quoted 8 lines

new file mode 100644
index 0000000..d2f1301

recipes-extended/images/xen-image-initramfs.bb new file +3 -0
@@ -0,0 +1,17 @@
+DESCRIPTION = "Xen image initramfs"
+
+IMAGE_INSTALL = "initramfs-boot-xen busybox udev udev-extraconf

base-passwd coreutils"

Review

Quoted 15 lines
recipes-extended/images/xen-image-initramfs.bb new file +14 -0
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
+export IMAGE_BASENAME = "xen-image-initramfs"
+
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
(quoted diff) +0 -0

xen-image-minimal.bb

Quoted 29 lines

index 0cf55d6..c941339 100644

recipes-extended/images/xen-image-minimal.bb +23 -2
@@ -1,14 +1,55 @@
-DESCRIPTION = "A minimal xen image"
-IMAGE_INSTALL = "packagegroup-core-boot xen-minimal dropbear mdadm"
+DESCRIPTION = "Image with Xen."
+
+INITRD_IMAGE ?= "xen-image-initramfs"
+
+IMAGE_INSTALL += " \
+    ${CORE_IMAGE_BASE_INSTALL} \
+    packagegroup-core-basic \
+    packagegroup-core-ssh-openssh \
+    kernel-module-xen-acpi-processor \
+    kernel-module-xen-blkback \
+    kernel-module-xen-blkfront \
+    kernel-module-xen-evtchn \
+    kernel-module-xenfs \
+    kernel-module-xen-gntalloc \
+    kernel-module-xen-gntdev \
+    kernel-module-xen-netback \
+    kernel-module-xen-netfront \
+    kernel-module-xen-pcifront \
+    kernel-module-xen-privcmd \
+    kernel-module-xen-wdt \
+    xen-base \
+    xen-qemu \
+    ${ROOTFS_PKGMANAGE_BOOTSTRAP} \

recipes-extended/images/xen-image-minimal.bb line 31

Quoted 10 lines
recipes-extended/images/xen-image-minimal.bb +3 -2
+    "
 
-IMAGE_LINGUAS = " "
 LICENSE = "MIT"
 
 inherit core-image
 
-IMAGE_ROOTFS_SIZE = "8192"
+syslinux_iso_populate_append() {
+       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32

${ISODIR}${ISOLINUXDIR}

recipes-extended/images/xen-image-minimal.bb

Quoted 4 lines
recipes-extended/images/xen-image-minimal.bb +4 -0
+}
+
+syslinux_hddimg_populate_append() {
+       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32

${HDDDIR}${SYSLINUXDIR}

recipes-extended/images/xen-image-minimal.bb

Quoted 4 lines
recipes-extended/images/xen-image-minimal.bb +4 -0
+}
+
+grubefi_populate_append() {
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz

${DEST}${EFIDIR}/xen.gz

recipes-extended/images/xen-image-minimal.bb

Quoted 4 lines
recipes-extended/images/xen-image-minimal.bb +4 -0
+}
+
+populate_append() {
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz

${DEST}/xen.gz

recipes-extended/images/xen-image-minimal.bb

Quoted 12 lines
recipes-extended/images/xen-image-minimal.bb +9 -2
+}
 
-# remove not needed ipkg informations
-ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; "
+build_syslinux_cfg () {
+       echo "ALLOWOPTIONS 1" > ${SYSLINUXCFG}
+       echo "DEFAULT boot" >> ${SYSLINUXCFG}
+       echo "TIMEOUT 10" >> ${SYSLINUXCFG}
+       echo "PROMPT 1" >> ${SYSLINUXCFG}
+       echo "LABEL boot" >> ${SYSLINUXCFG}
+       echo "  KERNEL mboot.c32" >> ${SYSLINUXCFG}
+       echo "  APPEND /xen.gz loglvl=all guest_loglvl=all

console=com1,vga com1=115200,8n1 --- /vmlinuz ramdisk_size=32768 root=/dev/ram0 rw console=hvc0 earlyprintk=xen console=tty0 panic=10 --- /initrd" >> ${SYSLINUXCFG}

Review

Quoted 4 lines
recipes-extended/images/xen-image-minimal.bb +1 -1
+}
 
-require xen-bootimg.inc
(quoted diff) +0 -0

b/recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 6 lines

new file mode 100644
index 0000000..741f201

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +1 -0
@@ -0,0 +1,205 @@
+#!/bin/sh

recipes-extended/initrdscripts/files/init-boot-xen.sh line 11

Quoted 10 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +10 -0
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+ROOT_MOUNT="/rootfs/"
+ROOT_IMAGE="rootfs.img"
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+ISOLINUX=""
+
+# Copied from initramfs-framework. The core of this script probably

should be

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 3 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +3 -0
+# turned into initramfs-framework modules to reduce duplication.
+udev_daemon() {
+       OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd

/sbin/systemd/systemd-udevd /lib/systemd/systemd-udevd"

Quoted 54 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +54 -0
+
+       for o in $OPTIONS; do
+               if [ -x "$o" ]; then
+                       echo $o
+                       return 0
+               fi
+       done
+
+       return 1
+}
+
+_UDEV_DAEMON=`udev_daemon`
+
+early_setup() {
+    mkdir -p /proc
+    mkdir -p /sys
+    mount -t proc proc /proc
+    mount -t sysfs sysfs /sys
+    mount -t devtmpfs none /dev
+
+    # support modular kernel
+    modprobe isofs 2> /dev/null
+
+    mkdir -p /run
+    mkdir -p /var/run
+    mkdir -p /media
+
+    $_UDEV_DAEMON --daemon
+    udevadm trigger --action=add
+}
+
+read_args() {
+    [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
+    for arg in $CMDLINE; do
+        optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+        case $arg in
+            root=*)
+                ROOT_DEVICE=$optarg ;;
+            rootfstype=*)
+                modprobe $optarg 2> /dev/null ;;
+            LABEL=*)
+                label=$optarg ;;
+            video=*)
+                video_mode=$arg ;;
+            vga=*)
+                vga_mode=$arg ;;
+            console=*)
+                if [ -z "${console_params}" ]; then
+                    console_params=$arg
+                else
+                    console_params="$console_params $arg"
+                fi ;;
+            debugshell*)
+                if [ -z "$optarg" ]; then

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 10 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +10 -0
+                        shelltimeout=30
+                else
+                        shelltimeout=$optarg
+                fi
+        esac
+    done
+}
+
+boot_live_root() {
+    # Watches the udev event queue, and exits if all current events are

handled

Quoted 49 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +49 -0
+    udevadm settle --timeout=3 --quiet
+    killall "${_UDEV_DAEMON##*/}" 2>/dev/null
+
+    # Move the mount points of some filesystems over to
+    # the corresponding directories under the real root filesystem.
+    for dir in `awk '/\/dev.* \/media/{print $2}' /proc/mounts`; do
+        mkdir -p  ${ROOT_MOUNT}/$dir
+        mount -n --move $dir ${ROOT_MOUNT}/$dir
+    done
+    mount -n --move /proc ${ROOT_MOUNT}/proc
+    mount -n --move /sys ${ROOT_MOUNT}/sys
+    mount -n --move /dev ${ROOT_MOUNT}/dev
+
+    cd $ROOT_MOUNT
+    exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init
+}
+
+fatal() {
+    echo $1 >$CONSOLE
+    echo >$CONSOLE
+    exec sh
+}
+
+early_setup
+
+[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
+
+read_args
+
+echo "Waiting for removable media..."
+C=0
+shelltimeout=5
+while true
+do
+  udevadm trigger
+  udevadm settle
+  for i in `ls /media 2>/dev/null`; do
+      if [ -f /media/$i/$ROOT_IMAGE ] ; then
+               found="yes"
+               break
+         elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
+               found="yes"
+               ISOLINUX="isolinux"
+               break
+      fi
+  done
+  if [ "$found" = "yes" ]; then
+      break;
+  fi

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 10 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +10 -0
+  # don't wait for more than $shelltimeout seconds, if it's set
+  if [ -n "$shelltimeout" ]; then
+      echo -n " " $(( $shelltimeout - $C ))
+      if [ $C -ge $shelltimeout ]; then
+           echo "..."
+          echo "Mounted filesystems"
+           mount | grep media
+           echo "Available block devices"
+           ls /dev/sd*
+           fatal "Cannot find rootfs.img file in /media/* , dropping to

a shell "

Quoted 17 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +17 -0
+      fi
+      C=$(( C + 1 ))
+  fi
+  sleep 1
+done
+
+# Try to make a union mount of the root image.
+# If no unification filesystem is available, mount the image read-only.
+mount_and_boot() {
+    mkdir $ROOT_MOUNT
+
+    mknod /dev/loop0 b 7 0 2>/dev/null
+
+    # determine which unification filesystem to use
+    union_fs_type=""
+    if grep -q -w "overlayfs" /proc/filesystems; then
+       union_fs_type="overlayfs"

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 10 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +10 -0
+    elif grep -q -w "aufs" /proc/filesystems; then
+       union_fs_type="aufs"
+    else
+       union_fs_type=""
+    fi
+    # make a union mount if possible
+    case $union_fs_type in
+       "overlayfs")
+           mkdir -p /rootfs.ro /rootfs.rw
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 5 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +5 -0
+               rm -rf /rootfs.ro /rootfs.rw
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+               mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/

rootfs.rw" overlayfs $ROOT_MOUNT

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 8 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +8 -0
+               mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+               mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+               mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+           fi
+           ;;
+       "aufs")
+           mkdir -p /rootfs.ro /rootfs.rw
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 5 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +5 -0
+               rm -rf /rootfs.ro /rootfs.rw
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+               mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro"

aufs $ROOT_MOUNT

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 7 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +7 -0
+               mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+               mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+               mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+           fi
+           ;;
+       "")
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 3 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +3 -0
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs

$ROOT_MOUNT/media

Review

Quoted 14 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +13 -0
+           fi
+           ;;
+    esac
+
+    # boot the image
+    boot_live_root
+}
+
+mount_and_boot
+
+# If we're getting here, we failed...
+fatal "Installation image failed"
+
(quoted diff) +0 -0

initramfs-boot-xen_1.0.bb

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb line 3

Quoted 8 lines

new file mode 100644
index 0000000..9380e83

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +3 -0
@@ -0,0 +1,16 @@
+DESCRIPTION = "A live image init script with support for Xen"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM =

"file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb line 11

Quoted 8 lines
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +8 -0
+SRC_URI = "file://init-boot-xen.sh"
+PR = "r0"
+
+inherit allarch
+
+RDEPENDS_${PN} = "udev udev-extraconf"
+
+FILES_${PN} += " /init "

I was going to ask if you are seeing any QA warnings with this, since in the past we've had
to use update alternatives and priority to ensure that the right init was used in an image .. but
then I noticed this is only pulled into the minimal config and there shouldn't be any conflicting
init providers!

Bruce

Quoted 8 lines
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +5 -1
+
+do_install() {
+        install -m 0755 ${WORKDIR}/init-boot-xen.sh ${D}/init
+}
+
--

1.7.10.4

Quoted 4 lines

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

#14 lore raw

Re: [PATCH 4/4] xen-image-minimal: update image to support xen 4.3.0 base with xl toolstack.

Tracked down the issue to the busybox defconfig in the meta-virt layer.

There were patches upstreamed to udev's mount script to require 'stat' in addition to a similar update to busybox's config to provide it.

commit ef7e1239b95dbef4e461007d6d0612c27a7919ec
Author: Andy Ross <[email protected]>
Date: Tue Sep 18 14:38:44 2012 -0700
busybox: add /usr/bin/stat applet...

commit 3543d0db691e82098c1da7bf12f43e0c57551a3d
Author: Andy Ross <[email protected]>
Date: Tue Sep 18 14:38:45 2012 -0700
udev-extraconf: Don't mount root filesystem under /media...

I suppose this could be resolved by updating the busybox defconfig to a fragment turning on only the extra bits it wants? Or should I be prioritizing my layers differently?

Quoted 405 lines · Chris Patterson

The reasoning for xen-image-initramfs was that I had minor issues with using stock core-image-minimal-initramfs and initramfs-live-boot.

However, I have since tracked down the issue I was having with initramfs-live-boot, and determined we could drop initramfs-boot-xen in favor of initramfs-live-boot simply by adding LABEL=boot to the kernel args.

Beyond that, vanilla core-image-minimal-initramfs would hang at "Waiting for removeable media..." indefinitely. After some testing, It appeared that adding coreutils to core-image-minimal-initramfs would resolve the issue (though not yet sure why, but looking into it).

Quoted 388 lines · Bruce Ashfield
Quoted 1 line · Chris Patterson

xen-image-initramfs: newly added initrd to support testing

xen-image-minimal and init script based on init-live.sh.

Quoted 4 lines
---
 recipes-extended/images/xen-image-initramfs.bb     |   17 ++
 recipes-extended/images/xen-image-minimal.bb       |   55 +++++-
 .../initrdscripts/files/init-boot-xen.sh           |  205

++++++++++++++++++++

Quoted 4 lines
 .../initrdscripts/initramfs-boot-xen_1.0.bb        |   16 ++
 4 files changed, 286 insertions(+), 7 deletions(-)
 create mode 100644 recipes-extended/images/xen-image-initramfs.bb
 create mode 100644

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 1 line
 create mode 100644 recipes-extended/initrdscripts/

initramfs-boot-xen_1.0.bb

Review

Quoted 2 lines
(quoted diff) +0 -0

xen-image-initramfs.bb

recipes-extended/images/xen-image-initramfs.bb line 3

Quoted 8 lines

new file mode 100644
index 0000000..d2f1301

recipes-extended/images/xen-image-initramfs.bb new file +3 -0
@@ -0,0 +1,17 @@
+DESCRIPTION = "Xen image initramfs"
+
+IMAGE_INSTALL = "initramfs-boot-xen busybox udev udev-extraconf

base-passwd coreutils"

Review

Quoted 15 lines
recipes-extended/images/xen-image-initramfs.bb new file +14 -0
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
+export IMAGE_BASENAME = "xen-image-initramfs"
+
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
(quoted diff) +0 -0

xen-image-minimal.bb

Quoted 29 lines

index 0cf55d6..c941339 100644

recipes-extended/images/xen-image-minimal.bb +23 -2
@@ -1,14 +1,55 @@
-DESCRIPTION = "A minimal xen image"
-IMAGE_INSTALL = "packagegroup-core-boot xen-minimal dropbear mdadm"
+DESCRIPTION = "Image with Xen."
+
+INITRD_IMAGE ?= "xen-image-initramfs"
+
+IMAGE_INSTALL += " \
+    ${CORE_IMAGE_BASE_INSTALL} \
+    packagegroup-core-basic \
+    packagegroup-core-ssh-openssh \
+    kernel-module-xen-acpi-processor \
+    kernel-module-xen-blkback \
+    kernel-module-xen-blkfront \
+    kernel-module-xen-evtchn \
+    kernel-module-xenfs \
+    kernel-module-xen-gntalloc \
+    kernel-module-xen-gntdev \
+    kernel-module-xen-netback \
+    kernel-module-xen-netfront \
+    kernel-module-xen-pcifront \
+    kernel-module-xen-privcmd \
+    kernel-module-xen-wdt \
+    xen-base \
+    xen-qemu \
+    ${ROOTFS_PKGMANAGE_BOOTSTRAP} \

recipes-extended/images/xen-image-minimal.bb line 31

Quoted 10 lines
recipes-extended/images/xen-image-minimal.bb +3 -2
+    "
 
-IMAGE_LINGUAS = " "
 LICENSE = "MIT"
 
 inherit core-image
 
-IMAGE_ROOTFS_SIZE = "8192"
+syslinux_iso_populate_append() {
+       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32

${ISODIR}${ISOLINUXDIR}

recipes-extended/images/xen-image-minimal.bb

Quoted 4 lines
recipes-extended/images/xen-image-minimal.bb +4 -0
+}
+
+syslinux_hddimg_populate_append() {
+       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32

${HDDDIR}${SYSLINUXDIR}

recipes-extended/images/xen-image-minimal.bb

Quoted 4 lines
recipes-extended/images/xen-image-minimal.bb +4 -0
+}
+
+grubefi_populate_append() {
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz

${DEST}${EFIDIR}/xen.gz

recipes-extended/images/xen-image-minimal.bb

Quoted 4 lines
recipes-extended/images/xen-image-minimal.bb +4 -0
+}
+
+populate_append() {
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz

${DEST}/xen.gz

recipes-extended/images/xen-image-minimal.bb

Quoted 12 lines
recipes-extended/images/xen-image-minimal.bb +9 -2
+}
 
-# remove not needed ipkg informations
-ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; "
+build_syslinux_cfg () {
+       echo "ALLOWOPTIONS 1" > ${SYSLINUXCFG}
+       echo "DEFAULT boot" >> ${SYSLINUXCFG}
+       echo "TIMEOUT 10" >> ${SYSLINUXCFG}
+       echo "PROMPT 1" >> ${SYSLINUXCFG}
+       echo "LABEL boot" >> ${SYSLINUXCFG}
+       echo "  KERNEL mboot.c32" >> ${SYSLINUXCFG}
+       echo "  APPEND /xen.gz loglvl=all guest_loglvl=all

console=com1,vga com1=115200,8n1 --- /vmlinuz ramdisk_size=32768 root=/dev/ram0 rw console=hvc0 earlyprintk=xen console=tty0 panic=10 --- /initrd" >> ${SYSLINUXCFG}

Review

Quoted 4 lines
recipes-extended/images/xen-image-minimal.bb +1 -1
+}
 
-require xen-bootimg.inc
(quoted diff) +0 -0

b/recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 6 lines

new file mode 100644
index 0000000..741f201

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +1 -0
@@ -0,0 +1,205 @@
+#!/bin/sh

recipes-extended/initrdscripts/files/init-boot-xen.sh line 11

Quoted 10 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +10 -0
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+ROOT_MOUNT="/rootfs/"
+ROOT_IMAGE="rootfs.img"
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+ISOLINUX=""
+
+# Copied from initramfs-framework. The core of this script probably

should be

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 3 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +3 -0
+# turned into initramfs-framework modules to reduce duplication.
+udev_daemon() {
+       OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd

/sbin/systemd/systemd-udevd /lib/systemd/systemd-udevd"

Quoted 54 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +54 -0
+
+       for o in $OPTIONS; do
+               if [ -x "$o" ]; then
+                       echo $o
+                       return 0
+               fi
+       done
+
+       return 1
+}
+
+_UDEV_DAEMON=`udev_daemon`
+
+early_setup() {
+    mkdir -p /proc
+    mkdir -p /sys
+    mount -t proc proc /proc
+    mount -t sysfs sysfs /sys
+    mount -t devtmpfs none /dev
+
+    # support modular kernel
+    modprobe isofs 2> /dev/null
+
+    mkdir -p /run
+    mkdir -p /var/run
+    mkdir -p /media
+
+    $_UDEV_DAEMON --daemon
+    udevadm trigger --action=add
+}
+
+read_args() {
+    [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
+    for arg in $CMDLINE; do
+        optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+        case $arg in
+            root=*)
+                ROOT_DEVICE=$optarg ;;
+            rootfstype=*)
+                modprobe $optarg 2> /dev/null ;;
+            LABEL=*)
+                label=$optarg ;;
+            video=*)
+                video_mode=$arg ;;
+            vga=*)
+                vga_mode=$arg ;;
+            console=*)
+                if [ -z "${console_params}" ]; then
+                    console_params=$arg
+                else
+                    console_params="$console_params $arg"
+                fi ;;
+            debugshell*)
+                if [ -z "$optarg" ]; then

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 10 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +10 -0
+                        shelltimeout=30
+                else
+                        shelltimeout=$optarg
+                fi
+        esac
+    done
+}
+
+boot_live_root() {
+    # Watches the udev event queue, and exits if all current events

are handled

Quoted 49 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +49 -0
+    udevadm settle --timeout=3 --quiet
+    killall "${_UDEV_DAEMON##*/}" 2>/dev/null
+
+    # Move the mount points of some filesystems over to
+    # the corresponding directories under the real root filesystem.
+    for dir in `awk '/\/dev.* \/media/{print $2}' /proc/mounts`; do
+        mkdir -p  ${ROOT_MOUNT}/$dir
+        mount -n --move $dir ${ROOT_MOUNT}/$dir
+    done
+    mount -n --move /proc ${ROOT_MOUNT}/proc
+    mount -n --move /sys ${ROOT_MOUNT}/sys
+    mount -n --move /dev ${ROOT_MOUNT}/dev
+
+    cd $ROOT_MOUNT
+    exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init
+}
+
+fatal() {
+    echo $1 >$CONSOLE
+    echo >$CONSOLE
+    exec sh
+}
+
+early_setup
+
+[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
+
+read_args
+
+echo "Waiting for removable media..."
+C=0
+shelltimeout=5
+while true
+do
+  udevadm trigger
+  udevadm settle
+  for i in `ls /media 2>/dev/null`; do
+      if [ -f /media/$i/$ROOT_IMAGE ] ; then
+               found="yes"
+               break
+         elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
+               found="yes"
+               ISOLINUX="isolinux"
+               break
+      fi
+  done
+  if [ "$found" = "yes" ]; then
+      break;
+  fi

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 10 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +10 -0
+  # don't wait for more than $shelltimeout seconds, if it's set
+  if [ -n "$shelltimeout" ]; then
+      echo -n " " $(( $shelltimeout - $C ))
+      if [ $C -ge $shelltimeout ]; then
+           echo "..."
+          echo "Mounted filesystems"
+           mount | grep media
+           echo "Available block devices"
+           ls /dev/sd*
+           fatal "Cannot find rootfs.img file in /media/* , dropping

to a shell "

Quoted 17 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +17 -0
+      fi
+      C=$(( C + 1 ))
+  fi
+  sleep 1
+done
+
+# Try to make a union mount of the root image.
+# If no unification filesystem is available, mount the image read-only.
+mount_and_boot() {
+    mkdir $ROOT_MOUNT
+
+    mknod /dev/loop0 b 7 0 2>/dev/null
+
+    # determine which unification filesystem to use
+    union_fs_type=""
+    if grep -q -w "overlayfs" /proc/filesystems; then
+       union_fs_type="overlayfs"

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 10 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +10 -0
+    elif grep -q -w "aufs" /proc/filesystems; then
+       union_fs_type="aufs"
+    else
+       union_fs_type=""
+    fi
+    # make a union mount if possible
+    case $union_fs_type in
+       "overlayfs")
+           mkdir -p /rootfs.ro /rootfs.rw
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 5 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +5 -0
+               rm -rf /rootfs.ro /rootfs.rw
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+               mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/

rootfs.rw" overlayfs $ROOT_MOUNT

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 8 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +8 -0
+               mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+               mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+               mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+           fi
+           ;;
+       "aufs")
+           mkdir -p /rootfs.ro /rootfs.rw
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 5 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +5 -0
+               rm -rf /rootfs.ro /rootfs.rw
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+               mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro"

aufs $ROOT_MOUNT

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 7 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +7 -0
+               mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+               mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+               mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+           fi
+           ;;
+       "")
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then

recipes-extended/initrdscripts/files/init-boot-xen.sh

Quoted 3 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +3 -0
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs

$ROOT_MOUNT/media

Review

Quoted 14 lines
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +13 -0
+           fi
+           ;;
+    esac
+
+    # boot the image
+    boot_live_root
+}
+
+mount_and_boot
+
+# If we're getting here, we failed...
+fatal "Installation image failed"
+
(quoted diff) +0 -0

initramfs-boot-xen_1.0.bb

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb line 3

Quoted 8 lines

new file mode 100644
index 0000000..9380e83

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +3 -0
@@ -0,0 +1,16 @@
+DESCRIPTION = "A live image init script with support for Xen"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM =

"file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb line 11

Quoted 8 lines
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +8 -0
+SRC_URI = "file://init-boot-xen.sh"
+PR = "r0"
+
+inherit allarch
+
+RDEPENDS_${PN} = "udev udev-extraconf"
+
+FILES_${PN} += " /init "

I was going to ask if you are seeing any QA warnings with this, since in the past we've had
to use update alternatives and priority to ensure that the right init was used in an image .. but
then I noticed this is only pulled into the minimal config and there shouldn't be any conflicting
init providers!

Bruce

Quoted 8 lines
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +5 -1
+
+do_install() {
+        install -m 0755 ${WORKDIR}/init-boot-xen.sh ${D}/init
+}
+
--

1.7.10.4

Quoted 4 lines

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

#15 lore raw

Re: [PATCH 4/4] xen-image-minimal: update image to support xen 4.3.0 base with xl toolstack.

Quoted 10 lines · Chris Patterson

Tracked down the issue to the busybox defconfig in the meta-virt layer.

There were patches upstreamed to udev's mount script to require 'stat' in addition to a similar update to busybox's config to provide it.

commit ef7e1239b95dbef4e461007d6d0612c27a7919ec
Author: Andy Ross <[email protected]>
Date: Tue Sep 18 14:38:44 2012 -0700
busybox: add /usr/bin/stat applet...

Quoted 8 lines

commit 3543d0db691e82098c1da7bf12f43e0c57551a3d
Author: Andy Ross <[email protected]>
Date: Tue Sep 18 14:38:45 2012 -0700
udev-extraconf: Don't mount root filesystem under /media...

I suppose this could be resolved by updating the busybox defconfig to a fragment turning on only the extra bits it wants? Or should I be prioritizing my layers differently?

Converting to a fragment would be the best thing. The defconfig in meta-virt predates
the fragment support for busybox, and no one has converted it yet.

Cheers,

Bruce

Quoted 411 lines · Chris Patterson
Quoted 407 lines

The reasoning for xen-image-initramfs was that I had minor issues with using stock core-image-minimal-initramfs and initramfs-live-boot.

However, I have since tracked down the issue I was having with initramfs-live-boot, and determined we could drop initramfs-boot-xen in favor of initramfs-live-boot simply by adding LABEL=boot to the kernel args.

Beyond that, vanilla core-image-minimal-initramfs would hang at "Waiting for removeable media..." indefinitely. After some testing, It appeared that adding coreutils to core-image-minimal-initramfs would resolve the issue (though not yet sure why, but looking into it).

Quoted 389 lines · Bruce Ashfield
Quoted 349 lines · Chris Patterson

xen-image-initramfs: newly added initrd to support testing xen-image-minimal and init script based on init-live.sh.

---
 recipes-extended/images/xen-image-initramfs.bb     |   17 ++
 recipes-extended/images/xen-image-minimal.bb       |   55 +++++-
 .../initrdscripts/files/init-boot-xen.sh           |  205
++++++++++++++++++++
 .../initrdscripts/initramfs-boot-xen_1.0.bb        |   16 ++
 4 files changed, 286 insertions(+), 7 deletions(-)
 create mode 100644 recipes-extended/images/xen-image-initramfs.bb
 create mode 100644
recipes-extended/initrdscripts/files/init-boot-xen.sh
 create mode 100644

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb

recipes-extended/images/xen-image-initramfs.bb new file +3 -0
new file mode 100644
index 0000000..d2f1301
@@ -0,0 +1,17 @@
+DESCRIPTION = "Xen image initramfs"
+
+IMAGE_INSTALL = "initramfs-boot-xen busybox udev udev-extraconf

base-passwd coreutils"

recipes-extended/images/xen-image-initramfs.bb new file +14 -0
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
+export IMAGE_BASENAME = "xen-image-initramfs"
+
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
recipes-extended/images/xen-image-minimal.bb +34 -4
index 0cf55d6..c941339 100644
@@ -1,14 +1,55 @@
-DESCRIPTION = "A minimal xen image"
-IMAGE_INSTALL = "packagegroup-core-boot xen-minimal dropbear mdadm"
+DESCRIPTION = "Image with Xen."
+
+INITRD_IMAGE ?= "xen-image-initramfs"
+
+IMAGE_INSTALL += " \
+    ${CORE_IMAGE_BASE_INSTALL} \
+    packagegroup-core-basic \
+    packagegroup-core-ssh-openssh \
+    kernel-module-xen-acpi-processor \
+    kernel-module-xen-blkback \
+    kernel-module-xen-blkfront \
+    kernel-module-xen-evtchn \
+    kernel-module-xenfs \
+    kernel-module-xen-gntalloc \
+    kernel-module-xen-gntdev \
+    kernel-module-xen-netback \
+    kernel-module-xen-netfront \
+    kernel-module-xen-pcifront \
+    kernel-module-xen-privcmd \
+    kernel-module-xen-wdt \
+    xen-base \
+    xen-qemu \
+    ${ROOTFS_PKGMANAGE_BOOTSTRAP} \
+    "
 
-IMAGE_LINGUAS = " "
 LICENSE = "MIT"
 
 inherit core-image
 
-IMAGE_ROOTFS_SIZE = "8192"
+syslinux_iso_populate_append() {
+       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32
 ${ISODIR}${ISOLINUXDIR}
+}
+
+syslinux_hddimg_populate_append() {
+       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32
 ${HDDDIR}${SYSLINUXDIR}
+}
+
+grubefi_populate_append() {
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz

${DEST}${EFIDIR}/xen.gz

recipes-extended/images/xen-image-minimal.bb +4 -0
+}
+
+populate_append() {
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz

${DEST}/xen.gz

recipes-extended/images/xen-image-minimal.bb +9 -2
+}
 
-# remove not needed ipkg informations
-ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; "
+build_syslinux_cfg () {
+       echo "ALLOWOPTIONS 1" > ${SYSLINUXCFG}
+       echo "DEFAULT boot" >> ${SYSLINUXCFG}
+       echo "TIMEOUT 10" >> ${SYSLINUXCFG}
+       echo "PROMPT 1" >> ${SYSLINUXCFG}
+       echo "LABEL boot" >> ${SYSLINUXCFG}
+       echo "  KERNEL mboot.c32" >> ${SYSLINUXCFG}
+       echo "  APPEND /xen.gz loglvl=all guest_loglvl=all

console=com1,vga com1=115200,8n1 --- /vmlinuz ramdisk_size=32768 root=/dev/ram0 rw console=hvc0 earlyprintk=xen console=tty0 panic=10 --- /initrd" >> ${SYSLINUXCFG}

recipes-extended/images/xen-image-minimal.bb +1 -1
+}
 
-require xen-bootimg.inc
recipes-extended/initrdscripts/files/init-boot-xen.sh new file +11 -0
new file mode 100644
index 0000000..741f201
@@ -0,0 +1,205 @@
+#!/bin/sh
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+ROOT_MOUNT="/rootfs/"
+ROOT_IMAGE="rootfs.img"
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+ISOLINUX=""
+
+# Copied from initramfs-framework. The core of this script probably

should be

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +3 -0
+# turned into initramfs-framework modules to reduce duplication.
+udev_daemon() {
+       OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd

/sbin/systemd/systemd-udevd /lib/systemd/systemd-udevd"

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +64 -0
+
+       for o in $OPTIONS; do
+               if [ -x "$o" ]; then
+                       echo $o
+                       return 0
+               fi
+       done
+
+       return 1
+}
+
+_UDEV_DAEMON=`udev_daemon`
+
+early_setup() {
+    mkdir -p /proc
+    mkdir -p /sys
+    mount -t proc proc /proc
+    mount -t sysfs sysfs /sys
+    mount -t devtmpfs none /dev
+
+    # support modular kernel
+    modprobe isofs 2> /dev/null
+
+    mkdir -p /run
+    mkdir -p /var/run
+    mkdir -p /media
+
+    $_UDEV_DAEMON --daemon
+    udevadm trigger --action=add
+}
+
+read_args() {
+    [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
+    for arg in $CMDLINE; do
+        optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+        case $arg in
+            root=*)
+                ROOT_DEVICE=$optarg ;;
+            rootfstype=*)
+                modprobe $optarg 2> /dev/null ;;
+            LABEL=*)
+                label=$optarg ;;
+            video=*)
+                video_mode=$arg ;;
+            vga=*)
+                vga_mode=$arg ;;
+            console=*)
+                if [ -z "${console_params}" ]; then
+                    console_params=$arg
+                else
+                    console_params="$console_params $arg"
+                fi ;;
+            debugshell*)
+                if [ -z "$optarg" ]; then
+                        shelltimeout=30
+                else
+                        shelltimeout=$optarg
+                fi
+        esac
+    done
+}
+
+boot_live_root() {
+    # Watches the udev event queue, and exits if all current events

are handled

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +59 -0
+    udevadm settle --timeout=3 --quiet
+    killall "${_UDEV_DAEMON##*/}" 2>/dev/null
+
+    # Move the mount points of some filesystems over to
+    # the corresponding directories under the real root filesystem.
+    for dir in `awk '/\/dev.* \/media/{print $2}' /proc/mounts`; do
+        mkdir -p  ${ROOT_MOUNT}/$dir
+        mount -n --move $dir ${ROOT_MOUNT}/$dir
+    done
+    mount -n --move /proc ${ROOT_MOUNT}/proc
+    mount -n --move /sys ${ROOT_MOUNT}/sys
+    mount -n --move /dev ${ROOT_MOUNT}/dev
+
+    cd $ROOT_MOUNT
+    exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init
+}
+
+fatal() {
+    echo $1 >$CONSOLE
+    echo >$CONSOLE
+    exec sh
+}
+
+early_setup
+
+[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
+
+read_args
+
+echo "Waiting for removable media..."
+C=0
+shelltimeout=5
+while true
+do
+  udevadm trigger
+  udevadm settle
+  for i in `ls /media 2>/dev/null`; do
+      if [ -f /media/$i/$ROOT_IMAGE ] ; then
+               found="yes"
+               break
+         elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
+               found="yes"
+               ISOLINUX="isolinux"
+               break
+      fi
+  done
+  if [ "$found" = "yes" ]; then
+      break;
+  fi
+  # don't wait for more than $shelltimeout seconds, if it's set
+  if [ -n "$shelltimeout" ]; then
+      echo -n " " $(( $shelltimeout - $C ))
+      if [ $C -ge $shelltimeout ]; then
+           echo "..."
+          echo "Mounted filesystems"
+           mount | grep media
+           echo "Available block devices"
+           ls /dev/sd*
+           fatal "Cannot find rootfs.img file in /media/* , dropping

to a shell "

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +8 -0
+      fi
+      C=$(( C + 1 ))
+  fi
+  sleep 1
+done
+
+# Try to make a union mount of the root image.
+# If no unification filesystem is available, mount the image

read-only.

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +19 -0
+mount_and_boot() {
+    mkdir $ROOT_MOUNT
+
+    mknod /dev/loop0 b 7 0 2>/dev/null
+
+    # determine which unification filesystem to use
+    union_fs_type=""
+    if grep -q -w "overlayfs" /proc/filesystems; then
+       union_fs_type="overlayfs"
+    elif grep -q -w "aufs" /proc/filesystems; then
+       union_fs_type="aufs"
+    else
+       union_fs_type=""
+    fi
+    # make a union mount if possible
+    case $union_fs_type in
+       "overlayfs")
+           mkdir -p /rootfs.ro /rootfs.rw
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +5 -0
+               rm -rf /rootfs.ro /rootfs.rw
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+               mount -t overlayfs -o

"lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +8 -0
+               mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+               mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+               mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+           fi
+           ;;
+       "aufs")
+           mkdir -p /rootfs.ro /rootfs.rw
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +5 -0
+               rm -rf /rootfs.ro /rootfs.rw
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+               mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro"

aufs $ROOT_MOUNT

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +7 -0
+               mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+               mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+               mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+           fi
+           ;;
+       "")
+           if ! mount -o rw,loop,noatime,nodiratime

/media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +3 -0
+               fatal "Could not mount rootfs image"
+           else
+               mount -t tmpfs -o rw,noatime,mode=755 tmpfs

$ROOT_MOUNT/media

recipes-extended/initrdscripts/files/init-boot-xen.sh new file +13 -0
+           fi
+           ;;
+    esac
+
+    # boot the image
+    boot_live_root
+}
+
+mount_and_boot
+
+# If we're getting here, we failed...
+fatal "Installation image failed"
+
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +3 -0
new file mode 100644
index 0000000..9380e83
@@ -0,0 +1,16 @@
+DESCRIPTION = "A live image init script with support for Xen"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM =

"file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb line 11

Quoted 8 lines
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +8 -0
+SRC_URI = "file://init-boot-xen.sh"
+PR = "r0"
+
+inherit allarch
+
+RDEPENDS_${PN} = "udev udev-extraconf"
+
+FILES_${PN} += " /init "

I was going to ask if you are seeing any QA warnings with this, since in the past we've had
to use update alternatives and priority to ensure that the right init was used in an image .. but
then I noticed this is only pulled into the minimal config and there shouldn't be any conflicting
init providers!

Bruce

Quoted 8 lines
recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb new file +5 -1
+
+do_install() {
+        install -m 0755 ${WORKDIR}/init-boot-xen.sh ${D}/init
+}
+
--

1.7.10.4

Quoted 4 lines

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#16 lore raw

Re: [PATCH 4/4] xen-image-minimal: update image to support xen 4.3.0 base with xl toolstack.

In reply to Chris Patterson

Chris,

Do you have a meta-virt mirror where you're staging all of this? I went through to test and build this against the master branches of oe-core etc and had to make a few tweaks. Figured sending changes back to you might speed this along.

Thanks,
- Philip

Quoted 442 lines · Chris Patterson

The reasoning for xen-image-initramfs was that I had minor issues with using stock core-image-minimal-initramfs and initramfs-live-boot.

However, I have since tracked down the issue I was having with initramfs-live-boot, and determined we could drop initramfs-boot-xen in favor of initramfs-live-boot simply by adding LABEL=boot to the kernel args.

Beyond that, vanilla core-image-minimal-initramfs would hang at "Waiting for removeable media..." indefinitely. After some testing, It appeared that adding coreutils to core-image-minimal-initramfs would resolve the issue (though not yet sure why, but looking into it).

On Fri, Aug 30, 2013 at 1:36 AM, Bruce Ashfield <[email protected] <mailto:[email protected]>> wrote:

    On Thu, Aug 29, 2013 at 11:37 PM, Chris Patterson <[email protected]
    <mailto:[email protected]>> wrote:
    > xen-image-initramfs: newly added initrd to support testing
    xen-image-minimal and init script based on init-live.sh.
    > ---
    >  recipes-extended/images/xen-image-initramfs.bb
    <http://xen-image-initramfs.bb>     |   17 ++
    >  recipes-extended/images/xen-image-minimal.bb
    <http://xen-image-minimal.bb>       |   55 +++++-
    >  .../initrdscripts/files/init-boot-xen.sh           |  205
    ++++++++++++++++++++
    >  .../initrdscripts/initramfs-boot-xen_1.0.bb
    <http://initramfs-boot-xen_1.0.bb>        |   16 ++
    >  4 files changed, 286 insertions(+), 7 deletions(-)
    >  create mode 100644 recipes-extended/images/xen-image-initramfs.bb
    <http://xen-image-initramfs.bb>
    >  create mode 100644
    recipes-extended/initrdscripts/files/init-boot-xen.sh
    >  create mode 100644
    recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb
    <http://initramfs-boot-xen_1.0.bb>
    >
    > diff --git a/recipes-extended/images/xen-image-initramfs.bb
    <http://xen-image-initramfs.bb>
    b/recipes-extended/images/xen-image-initramfs.bb
    <http://xen-image-initramfs.bb>
    > new file mode 100644
    > index 0000000..d2f1301
    > --- /dev/null
    > +++ b/recipes-extended/images/xen-image-initramfs.bb
    <http://xen-image-initramfs.bb>
    > @@ -0,0 +1,17 @@
    > +DESCRIPTION = "Xen image initramfs"
    > +
    > +IMAGE_INSTALL = "initramfs-boot-xen busybox udev udev-extraconf
    base-passwd coreutils"
    > +
    > +# Do not pollute the initrd image with rootfs features
    > +IMAGE_FEATURES = ""
    > +
    > +export IMAGE_BASENAME = "xen-image-initramfs"
    > +
    > +IMAGE_LINGUAS = ""
    > +
    > +LICENSE = "MIT"
    > +
    > +IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
    > +inherit core-image
    > +
    > +IMAGE_ROOTFS_SIZE = "8192"
    > diff --git a/recipes-extended/images/xen-image-minimal.bb
    <http://xen-image-minimal.bb>
    b/recipes-extended/images/xen-image-minimal.bb
    <http://xen-image-minimal.bb>
    > index 0cf55d6..c941339 100644
    > --- a/recipes-extended/images/xen-image-minimal.bb
    <http://xen-image-minimal.bb>
    > +++ b/recipes-extended/images/xen-image-minimal.bb
    <http://xen-image-minimal.bb>
    > @@ -1,14 +1,55 @@
    > -DESCRIPTION = "A minimal xen image"
    > -IMAGE_INSTALL = "packagegroup-core-boot xen-minimal dropbear mdadm"
    > +DESCRIPTION = "Image with Xen."
    > +
    > +INITRD_IMAGE ?= "xen-image-initramfs"
    > +
    > +IMAGE_INSTALL += " \
    > +    ${CORE_IMAGE_BASE_INSTALL} \
    > +    packagegroup-core-basic \
    > +    packagegroup-core-ssh-openssh \
    > +    kernel-module-xen-acpi-processor \
    > +    kernel-module-xen-blkback \
    > +    kernel-module-xen-blkfront \
    > +    kernel-module-xen-evtchn \
    > +    kernel-module-xenfs \
    > +    kernel-module-xen-gntalloc \
    > +    kernel-module-xen-gntdev \
    > +    kernel-module-xen-netback \
    > +    kernel-module-xen-netfront \
    > +    kernel-module-xen-pcifront \
    > +    kernel-module-xen-privcmd \
    > +    kernel-module-xen-wdt \
    > +    xen-base \
    > +    xen-qemu \
    > +    ${ROOTFS_PKGMANAGE_BOOTSTRAP} \
    > +    "
    >
    > -IMAGE_LINGUAS = " "
    >  LICENSE = "MIT"
    >
    >  inherit core-image
    >
    > -IMAGE_ROOTFS_SIZE = "8192"
    > +syslinux_iso_populate_append() {
    > +       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32
    ${ISODIR}${ISOLINUXDIR}
    > +}
    > +
    > +syslinux_hddimg_populate_append() {
    > +       install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32
    ${HDDDIR}${SYSLINUXDIR}
    > +}
    > +
    > +grubefi_populate_append() {
    > +       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz
    ${DEST}${EFIDIR}/xen.gz
    > +}
    > +
    > +populate_append() {
    > +       install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz
    ${DEST}/xen.gz
    > +}
    >
    > -# remove not needed ipkg informations
    > -ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; "
    > +build_syslinux_cfg () {
    > +       echo "ALLOWOPTIONS 1" > ${SYSLINUXCFG}
    > +       echo "DEFAULT boot" >> ${SYSLINUXCFG}
    > +       echo "TIMEOUT 10" >> ${SYSLINUXCFG}
    > +       echo "PROMPT 1" >> ${SYSLINUXCFG}
    > +       echo "LABEL boot" >> ${SYSLINUXCFG}
    > +       echo "  KERNEL mboot.c32" >> ${SYSLINUXCFG}
    > +       echo "  APPEND /xen.gz loglvl=all guest_loglvl=all
    console=com1,vga com1=115200,8n1 --- /vmlinuz ramdisk_size=32768
    root=/dev/ram0 rw console=hvc0 earlyprintk=xen console=tty0 panic=10
    --- /initrd" >> ${SYSLINUXCFG}
    > +}
    >
    > -require xen-bootimg.inc
    > diff --git a/recipes-extended/initrdscripts/files/init-boot-xen.sh
    b/recipes-extended/initrdscripts/files/init-boot-xen.sh
    > new file mode 100644
    > index 0000000..741f201
    > --- /dev/null
    > +++ b/recipes-extended/initrdscripts/files/init-boot-xen.sh
    > @@ -0,0 +1,205 @@
    > +#!/bin/sh
    > +
    > +PATH=/sbin:/bin:/usr/sbin:/usr/bin
    > +
    > +ROOT_MOUNT="/rootfs/"
    > +ROOT_IMAGE="rootfs.img"
    > +MOUNT="/bin/mount"
    > +UMOUNT="/bin/umount"
    > +ISOLINUX=""
    > +
    > +# Copied from initramfs-framework. The core of this script
    probably should be
    > +# turned into initramfs-framework modules to reduce duplication.
    > +udev_daemon() {
    > +       OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd
    /sbin/systemd/systemd-udevd /lib/systemd/systemd-udevd"
    > +
    > +       for o in $OPTIONS; do
    > +               if [ -x "$o" ]; then
    > +                       echo $o
    > +                       return 0
    > +               fi
    > +       done
    > +
    > +       return 1
    > +}
    > +
    > +_UDEV_DAEMON=`udev_daemon`
    > +
    > +early_setup() {
    > +    mkdir -p /proc
    > +    mkdir -p /sys
    > +    mount -t proc proc /proc
    > +    mount -t sysfs sysfs /sys
    > +    mount -t devtmpfs none /dev
    > +
    > +    # support modular kernel
    > +    modprobe isofs 2> /dev/null
    > +
    > +    mkdir -p /run
    > +    mkdir -p /var/run
    > +    mkdir -p /media
    > +
    > +    $_UDEV_DAEMON --daemon
    > +    udevadm trigger --action=add
    > +}
    > +
    > +read_args() {
    > +    [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
    > +    for arg in $CMDLINE; do
    > +        optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
    > +        case $arg in
    > +            root=*)
    > +                ROOT_DEVICE=$optarg ;;
    > +            rootfstype=*)
    > +                modprobe $optarg 2> /dev/null ;;
    > +            LABEL=*)
    > +                label=$optarg ;;
    > +            video=*)
    > +                video_mode=$arg ;;
    > +            vga=*)
    > +                vga_mode=$arg ;;
    > +            console=*)
    > +                if [ -z "${console_params}" ]; then
    > +                    console_params=$arg
    > +                else
    > +                    console_params="$console_params $arg"
    > +                fi ;;
    > +            debugshell*)
    > +                if [ -z "$optarg" ]; then
    > +                        shelltimeout=30
    > +                else
    > +                        shelltimeout=$optarg
    > +                fi
    > +        esac
    > +    done
    > +}
    > +
    > +boot_live_root() {
    > +    # Watches the udev event queue, and exits if all current
    events are handled
    > +    udevadm settle --timeout=3 --quiet
    > +    killall "${_UDEV_DAEMON##*/}" 2>/dev/null
    > +
    > +    # Move the mount points of some filesystems over to
    > +    # the corresponding directories under the real root filesystem.
    > +    for dir in `awk '/\/dev.* \/media/{print $2}' /proc/mounts`; do
    > +        mkdir -p  ${ROOT_MOUNT}/$dir
    > +        mount -n --move $dir ${ROOT_MOUNT}/$dir
    > +    done
    > +    mount -n --move /proc ${ROOT_MOUNT}/proc
    > +    mount -n --move /sys ${ROOT_MOUNT}/sys
    > +    mount -n --move /dev ${ROOT_MOUNT}/dev
    > +
    > +    cd $ROOT_MOUNT
    > +    exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init
    > +}
    > +
    > +fatal() {
    > +    echo $1 >$CONSOLE
    > +    echo >$CONSOLE
    > +    exec sh
    > +}
    > +
    > +early_setup
    > +
    > +[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
    > +
    > +read_args
    > +
    > +echo "Waiting for removable media..."
    > +C=0
    > +shelltimeout=5
    > +while true
    > +do
    > +  udevadm trigger
    > +  udevadm settle
    > +  for i in `ls /media 2>/dev/null`; do
    > +      if [ -f /media/$i/$ROOT_IMAGE ] ; then
    > +               found="yes"
    > +               break
    > +         elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
    > +               found="yes"
    > +               ISOLINUX="isolinux"
    > +               break
    > +      fi
    > +  done
    > +  if [ "$found" = "yes" ]; then
    > +      break;
    > +  fi
    > +  # don't wait for more than $shelltimeout seconds, if it's set
    > +  if [ -n "$shelltimeout" ]; then
    > +      echo -n " " $(( $shelltimeout - $C ))
    > +      if [ $C -ge $shelltimeout ]; then
    > +           echo "..."
    > +          echo "Mounted filesystems"
    > +           mount | grep media
    > +           echo "Available block devices"
    > +           ls /dev/sd*
    > +           fatal "Cannot find rootfs.img file in /media/* ,
    dropping to a shell "
    > +      fi
    > +      C=$(( C + 1 ))
    > +  fi
    > +  sleep 1
    > +done
    > +
    > +# Try to make a union mount of the root image.
    > +# If no unification filesystem is available, mount the image
    read-only.
    > +mount_and_boot() {
    > +    mkdir $ROOT_MOUNT
    > +
    > +    mknod /dev/loop0 b 7 0 2>/dev/null
    > +
    > +    # determine which unification filesystem to use
    > +    union_fs_type=""
    > +    if grep -q -w "overlayfs" /proc/filesystems; then
    > +       union_fs_type="overlayfs"
    > +    elif grep -q -w "aufs" /proc/filesystems; then
    > +       union_fs_type="aufs"
    > +    else
    > +       union_fs_type=""
    > +    fi
    > +    # make a union mount if possible
    > +    case $union_fs_type in
    > +       "overlayfs")
    > +           mkdir -p /rootfs.ro <http://rootfs.ro> /rootfs.rw
    <http://rootfs.rw>
    > +           if ! mount -o rw,loop,noatime,nodiratime
    /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro <http://rootfs.ro>; then
    > +               rm -rf /rootfs.ro <http://rootfs.ro> /rootfs.rw
    <http://rootfs.rw>
    > +               fatal "Could not mount rootfs image"
    > +           else
    > +               mount -t tmpfs -o rw,noatime,mode=755 tmpfs
    /rootfs.rw <http://rootfs.rw>
    > +               mount -t overlayfs -o "lowerdir=/rootfs.ro
    <http://rootfs.ro>,upperdir=/rootfs.rw <http://rootfs.rw>" overlayfs
    $ROOT_MOUNT
    > +               mkdir -p $ROOT_MOUNT/rootfs.ro <http://rootfs.ro>
    $ROOT_MOUNT/rootfs.rw <http://rootfs.rw>
    > +               mount --move /rootfs.ro <http://rootfs.ro>
    $ROOT_MOUNT/rootfs.ro <http://rootfs.ro>
    > +               mount --move /rootfs.rw <http://rootfs.rw>
    $ROOT_MOUNT/rootfs.rw <http://rootfs.rw>
    > +           fi
    > +           ;;
    > +       "aufs")
    > +           mkdir -p /rootfs.ro <http://rootfs.ro> /rootfs.rw
    <http://rootfs.rw>
    > +           if ! mount -o rw,loop,noatime,nodiratime
    /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro <http://rootfs.ro>; then
    > +               rm -rf /rootfs.ro <http://rootfs.ro> /rootfs.rw
    <http://rootfs.rw>
    > +               fatal "Could not mount rootfs image"
    > +           else
    > +               mount -t tmpfs -o rw,noatime,mode=755 tmpfs
    /rootfs.rw <http://rootfs.rw>
    > +               mount -t aufs -o "dirs=/rootfs.rw
    <http://rootfs.rw>=rw:/rootfs.ro <http://rootfs.ro>=ro" aufs $ROOT_MOUNT
    > +               mkdir -p $ROOT_MOUNT/rootfs.ro <http://rootfs.ro>
    $ROOT_MOUNT/rootfs.rw <http://rootfs.rw>
    > +               mount --move /rootfs.ro <http://rootfs.ro>
    $ROOT_MOUNT/rootfs.ro <http://rootfs.ro>
    > +               mount --move /rootfs.rw <http://rootfs.rw>
    $ROOT_MOUNT/rootfs.rw <http://rootfs.rw>
    > +           fi
    > +           ;;
    > +       "")
    > +           if ! mount -o rw,loop,noatime,nodiratime
    /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
    > +               fatal "Could not mount rootfs image"
    > +           else
    > +               mount -t tmpfs -o rw,noatime,mode=755 tmpfs
    $ROOT_MOUNT/media
    > +           fi
    > +           ;;
    > +    esac
    > +
    > +    # boot the image
    > +    boot_live_root
    > +}
    > +
    > +mount_and_boot
    > +
    > +# If we're getting here, we failed...
    > +fatal "Installation image failed"
    > +
    > diff --git
    a/recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb
    <http://initramfs-boot-xen_1.0.bb>
    b/recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb
    <http://initramfs-boot-xen_1.0.bb>
    > new file mode 100644
    > index 0000000..9380e83
    > --- /dev/null
    > +++ b/recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb
    <http://initramfs-boot-xen_1.0.bb>
    > @@ -0,0 +1,16 @@
    > +DESCRIPTION = "A live image init script with support for Xen"
    > +LICENSE = "MIT"
    > +LIC_FILES_CHKSUM =
    "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
    > +SRC_URI = "file://init-boot-xen.sh"
    > +PR = "r0"
    > +
    > +inherit allarch
    > +
    > +RDEPENDS_${PN} = "udev udev-extraconf"
    > +
    > +FILES_${PN} += " /init "

    I was going to ask if you are seeing any QA warnings with this, since
    in the past we've had
    to use update alternatives and priority to ensure that the right init
    was used in an image .. but
    then I noticed this is only pulled into the minimal config and there
    shouldn't be any conflicting
    init providers!

    Bruce

    > +
    > +do_install() {
    > +        install -m 0755 ${WORKDIR}/init-boot-xen.sh ${D}/init
    > +}
    > +
    > --
    > 1.7.10.4
    >
    > _______________________________________________
    > meta-virtualization mailing list
    > [email protected]
    <mailto:[email protected]>
    > https://lists.yoctoproject.org/listinfo/meta-virtualization



    --
    "Thou shalt not follow the NULL pointer, for chaos and madness await
    thee at its end"

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

#17 lore raw
In reply to Chris Patterson
Quoted 58 lines · Chris Patterson

This set of patches should provide a user with the ability to generate a xen 4.3.0 based dom0 image.

[NOTES]

With these patches, xen-image-minimal requires "xen" and "aufs" to be present in DISTRO_FEATURES to function correctly.

[DISTRO TESTING]

This image has been tested using:

machine=sugarbay
DISTRO_FEATURES += " aufs xen"

[BUILDING IMAGE]

bitbake xen-image-minimal

[QEMU BUILD TESTING]

To start up and test core-image-xen using kvm on hardware supporting nested virtualization:

kvm -hda deploy/images/xen-image-minimal-sugarbay.hddimg -cpu host -no-kvm-irqchip -m 4096 -net nic,model=e1000 -net user -serial stdio

..or..

kvm -hdc deploy/images/xen-image-minimal-sugarbay.iso -cpu host -no-kvm-irqchip -m 4096 -net nic,model=e1000 -net user -serial stdio

[XEN TESTING]

To test the runtime core-image-xen and boot a debian PV virtual machine:

# bring up networking
ifconfig eth0 up
brctl addbr br0
brctl addif br0 eth0
udhcpc -i br0
# place test debian vm in /test/debian
mkdir -p /test/debian
cd /test/debian
# pull example kernel, initrd
wget http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/xen/initrd.gz
wget http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/xen/vmlinuz
# create 4G disk
truncate -s 4096M disk.img

cat > debian.cfg << EOF
kernel = "/test/debian/vmlinuz"
ramdisk = "/test/debian/initrd.gz"
extra = "debian-installer/exit/always_halt=true -- console=hvc0" vif = ['bridge=br0']
memory = "256"
name = "debian"
disk = ['file:/test/debian/disk.img,xvda,w']
EOF

Quoted 2 lines

xl -v create -d debian.cfg

Great steps and documentation. I'll take them for a spin myself and see if I can get
a working system :)

Bruce

Quoted 34 lines

xl console debian

Chris Patterson (4):
linux-yocto: add kernel fragment and scc for xen dom0 kernel support.
linux-yocto: add optional support for aufs and xen using
DISTRO_FEATURES.
xen: add 4.3.0 recipe.
xen-image-minimal: update image to support xen 4.3.0 base with xl
toolstack.

 recipes-extended/images/xen-image-initramfs.bb     |   17 +
 recipes-extended/images/xen-image-minimal.bb       |   55 +-
 .../initrdscripts/files/init-boot-xen.sh           |  205 +++++++
 .../initrdscripts/initramfs-boot-xen_1.0.bb        |   16 +
 recipes-extended/xen/xen_4.3.0.bb                  |  623 ++++++++++++++++++++
 recipes-kernel/linux/linux-yocto/xen.cfg           |   53 ++
 recipes-kernel/linux/linux-yocto/xen.scc           |    4 +
 recipes-kernel/linux/linux-yocto_3.4.bbappend      |    6 +
 recipes-kernel/linux/linux-yocto_3.8.bbappend      |    6 +
 9 files changed, 978 insertions(+), 7 deletions(-)
 create mode 100644 recipes-extended/images/xen-image-initramfs.bb
 create mode 100644 recipes-extended/initrdscripts/files/init-boot-xen.sh
 create mode 100644 recipes-extended/initrdscripts/initramfs-boot-xen_1.0.bb
 create mode 100644 recipes-extended/xen/xen_4.3.0.bb
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto/xen.scc

--
1.7.10.4

_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"