GATEWAY-EW24
[AGL/meta-agl-demo.git] / recipes-platform / images / agl-kvm-demo-platform.bb
1 DESCRIPTION = "AGL KVM+QEMU Demo Platform image."
2
3 LICENSE = "MIT"
4
5 require recipes-platform/images/agl-image-compositor.bb
6 require agl-demo-features.inc
7
8 IMAGE_FEATURES += "splash package-management ssh-server-openssh"
9
10 # If building with "agl-kvm-host-kuksa", the databroker and likely
11 # some clients run on the host, except when building for the
12 # gateway demo, where the databroker runs on the gateway.
13 IMAGE_FEATURES += " \
14     ${@bb.utils.contains_any("AGL_FEATURES", "agl-kvm-host-kuksa agl-demo-gateway-preload", "kuksa-val-databroker-client", "", d)} \
15     ${@bb.utils.contains("AGL_FEATURES", "agl-kvm-host-kuksa", "kuksa-val-databroker", "", d)} \
16     ${@bb.utils.contains("DISTRO_FEATURES", "agl-devel", "can-test-tools" , "", d)} \
17 "
18
19 # Add packages for KVM+QEMU demo platform here
20 IMAGE_INSTALL += " \
21     packagegroup-agl-core-connectivity \
22     kernel-image \
23     agl-compositor \
24     weston-ini-conf-kvm \
25     output-udev-conf \
26     native-shell-client \
27     qemu \
28     ${QEMU_GUEST_CONFIGS} \
29     util-linux-taskset \
30     screen \
31     simple-can-simulator \
32     alsa-utils \
33 "
34
35 # Until virtio sound is workable with QEMU, run the audio using
36 # services on the host for a better demo experience.  At the
37 # moment, this also includes the HVAC service since it does not
38 # make sense to try to make things more fine-grained with respect
39 # to configuration for where things expect to find the databroker.
40 # It will need to be revisited when virtio-snd, virtio-gpio, etc.
41 # become feasible to use.
42 HOST_AUDIO_INSTALL = " \
43     packagegroup-agl-ivi-services-platform \
44     packagegroup-pipewire \
45     wireplumber-config-agl \
46     wireplumber-policy-config-agl \
47     mpd \
48     udisks2 \
49     agl-service-radio-conf-kvm-demo \
50     ${@bb.utils.contains("DISTRO_FEATURES", "agl-devel", "packagegroup-pipewire-tools mpc" , "", d)} \
51 "
52
53 IMAGE_INSTALL += "\
54     ${@bb.utils.contains("AGL_FEATURES", "agl-kvm-host-kuksa", "kuksa-databroker-agl-demo-cluster", "", d)} \
55     ${@bb.utils.contains("AGL_FEATURES", "agl-kvm-host-audio", "${HOST_AUDIO_INSTALL}", "", d)} \
56 "
57
58 # Potential size reduction options
59 #IMAGE_LINGUAS = " "
60 #NO_RECOMMENDATIONS = "1"
61
62 GUEST_MACHINE ?= "virtio-${TUNE_ARCH}"
63
64 GUEST_VM1_IMAGE ?= "agl-ivi-demo-platform-flutter"
65 GUEST_VM2_IMAGE ?= "agl-cluster-demo-platform-flutter"
66
67 GUEST_IMAGES ?= "agl-kvm-guest:${GUEST_VM1_IMAGE} agl-kvm-guest:${GUEST_VM2_IMAGE}"
68
69 QEMU_GUEST_CONFIGS ?= ""
70
71 python __anonymous() {
72     for c in (d.getVar('GUEST_IMAGES') or "").split():
73         (mc, image) = c.split(':')
74         dependency = 'mc::' + mc + ':' + image + ':do_image_complete'
75         d.appendVarFlag('do_rootfs', 'mcdepends', ' ' + dependency)
76
77         # Assume there is a qemu-config-X package for guest image X
78         d.appendVar('QEMU_GUEST_CONFIGS', ' ' + 'qemu-config-' + image)
79 }
80
81 install_guest_images() {
82     for c in ${GUEST_IMAGES}; do
83         config=${c%:*}
84         image=${c#*:}
85         name=${image}
86         rm -rf  ${IMAGE_ROOTFS}/var/lib/machines/${name}
87         install -m 0755 -d ${IMAGE_ROOTFS}/var/lib/machines/${name}
88         src="${TOPDIR}/tmp-${config}/deploy/images/${GUEST_MACHINE}/${image}-${GUEST_MACHINE}.ext4"
89         bbnote "Installing ${src}"
90         install -m 0600 ${src} ${IMAGE_ROOTFS}/var/lib/machines/${name}/
91         # Placeholder until booting from kernel in VM image is worked out
92         install -m 0600 ${TOPDIR}/tmp-${config}/deploy/images/${GUEST_MACHINE}/Image-${GUEST_MACHINE}.bin ${IMAGE_ROOTFS}/var/lib/machines/${name}/
93     done
94 }
95
96 ROOTFS_POSTPROCESS_COMMAND += "install_guest_images; "
97
98 IMAGE_ROOTFS_EXTRA_SPACE:append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"