blob: 17e06a0569d4cbe6546bef9d20a9d1a81e57050e [file] [log] [blame]
Patrick Williamsc0f7c042017-02-23 20:41:17 -06001SUMMARY = "An image containing the build system itself"
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002DESCRIPTION = "An image containing the build system that you can boot and run using either VirtualBox, VMware Player or VMware Workstation."
Patrick Williamsc0f7c042017-02-23 20:41:17 -06003HOMEPAGE = "http://www.yoctoproject.org/documentation/build-appliance"
4
5LICENSE = "MIT"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05006LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
Patrick Williamsc0f7c042017-02-23 20:41:17 -06007
8IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-openssh packagegroup-self-hosted \
Andrew Geisslerc9f78652020-09-18 14:11:35 -05009 kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcpcd \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010 tzdata python3-pip perl-misc"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011
12IMAGE_FEATURES += "x11-base package-management splash"
13
Brad Bishop79641f22019-09-10 07:20:22 -040014QB_MEM = '${@bb.utils.contains("DISTRO_FEATURES", "opengl", "-m 512", "-m 256", d)}'
15
Patrick Williamsc0f7c042017-02-23 20:41:17 -060016# Ensure there's enough space to do a core-image-sato build, with rm_work enabled
17IMAGE_ROOTFS_EXTRA_SPACE = "41943040"
18
19# Do a quiet boot with limited console messages
20APPEND += "rootfstype=ext4 quiet"
21
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022DEPENDS = "zip-native python3-pip-native"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060023IMAGE_FSTYPES = "wic.vmdk wic.vhd wic.vhdx"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060024
Andrew Geissler95ac1b82021-03-31 14:34:31 -050025inherit core-image setuptools3
Patrick Williamsc0f7c042017-02-23 20:41:17 -060026
Andrew Geissler5f350902021-07-23 13:09:54 -040027SRCREV ?= "75f491e5e20bd0aade764ea5bd15f547fafb7684"
Brad Bishop19323692019-04-05 15:28:33 -040028SRC_URI = "git://git.yoctoproject.org/poky \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060029 file://Yocto_Build_Appliance.vmx \
30 file://Yocto_Build_Appliance.vmxf \
31 file://README_VirtualBox_Guest_Additions.txt \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050032 file://README_VirtualBox_Toaster.txt \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033 "
Brad Bishop19323692019-04-05 15:28:33 -040034RECIPE_NO_UPDATE_REASON = "Recipe is recursive and handled as part of the release process"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060035BA_INCLUDE_SOURCES ??= "0"
36
Patrick Williams213cb262021-08-07 19:21:33 -050037IMAGE_CMD:ext4:append () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -060038 # We don't need to reserve much space for root, 0.5% is more than enough
39 tune2fs -m 0.5 ${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ext4
40}
41
42fakeroot do_populate_poky_src () {
43 # Because fetch2's git's unpack uses -s cloneflag, the unpacked git repo
44 # will become invalid in the target.
45 rm -rf ${WORKDIR}/git/.git
46 rm -f ${WORKDIR}/git/.gitignore
47
48 cp -R ${WORKDIR}/git ${IMAGE_ROOTFS}/home/builder/poky
49
50 mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/conf
51 mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/downloads
52 if [ ${BA_INCLUDE_SOURCES} != 0 ]; then
53 cp -RpL ${DL_DIR}/* ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/
54 # Remove the git2_* tarballs -- this is ok since we still have the git2/.
55 rm -rf ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/git2_*
56 fi
57
58 # Place the README_VirtualBox_Guest_Additions file in builders home folder.
59 cp ${WORKDIR}/README_VirtualBox_Guest_Additions.txt ${IMAGE_ROOTFS}/home/builder/
60
Brad Bishop6e60e8b2018-02-01 10:27:11 -050061 # Place the README_VirtualBox_Toaster file in builders home folder.
62 cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/
63
Patrick Williamsc0f7c042017-02-23 20:41:17 -060064 echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
65 echo "export LC_ALL=en_US.utf8" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
66
67 # Also save (for reference only) the actual SRCREV used to create this image
68 echo "export BA_SRCREV=${SRCREV}" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
69 echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Brad Bishop37a0e4d2017-12-04 01:01:44 -050070 echo 'export PATH=$PATH:/sbin' >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Patrick Williamsc0f7c042017-02-23 20:41:17 -060071 echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
72
73 echo "# If working behind a proxy and using the provided oe-git-proxy script" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
74 echo "# you need to set ALL_PROXY based on your proxy settings." >> ${IMAGE_ROOTFS}/home/builder/.bashrc
75 echo "# Example ALL_PROXY values:" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
76 echo "# export ALL_PROXY=https://proxy.example.com:8080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
77 echo "# export ALL_PROXY=socks://socks.example.com:1080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
78
Brad Bishopc4ea0752018-11-15 14:30:15 -080079 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/poky
Patrick Williamsc0f7c042017-02-23 20:41:17 -060080 chmod -R ug+rw ${IMAGE_ROOTFS}/home/builder/poky
81
82 # Assume we will need CDROM to install guest additions
83 mkdir -p ${IMAGE_ROOTFS}/media/cdrom
84
85 # Allow builder to use sudo
86 echo "builder ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
87
88 # Load tap/tun at startup
Brad Bishop6e60e8b2018-02-01 10:27:11 -050089 rm -f ${IMAGE_ROOTFS}/sbin/iptables
Patrick Williamsc0f7c042017-02-23 20:41:17 -060090 lnr ${IMAGE_ROOTFS}/usr/sbin/iptables ${IMAGE_ROOTFS}/sbin/iptables
91 echo "tun" >> ${IMAGE_ROOTFS}/etc/modules
92
93 # Use Clearlooks GTK+ theme
94 mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
95 echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
Brad Bishop6e60e8b2018-02-01 10:27:11 -050096
97 # Install modules needed for toaster
98 export STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}
99 export STAGING_INCDIR=${STAGING_INCDIR_NATIVE}
100 export HOME=${IMAGE_ROOTFS}/home/builder
101 mkdir -p ${IMAGE_ROOTFS}/home/builder/.cache/pip
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500102 pip3_install_params="--user -I -U -v -r ${IMAGE_ROOTFS}/home/builder/poky/bitbake/toaster-requirements.txt"
103 if [ -n "${http_proxy}" ]; then
104 pip3_install_params="${pip3_install_params} --proxy ${http_proxy}"
105 fi
106 pip3 install ${pip3_install_params}
Brad Bishopc4ea0752018-11-15 14:30:15 -0800107 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.local
108 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.cache
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600109}
110
111IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; "
112
113addtask rootfs after do_unpack
114
115python () {
Brad Bishopa5c52ff2018-11-23 10:55:50 +1300116 # Ensure we run these usually noexec tasks
117 d.delVarFlag("do_fetch", "noexec")
118 d.delVarFlag("do_unpack", "noexec")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600119}
120
121create_bundle_files () {
122 cd ${WORKDIR}
123 mkdir -p Yocto_Build_Appliance
124 cp *.vmx* Yocto_Build_Appliance
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500125 ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600126 ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vhdx Yocto_Build_Appliance/Yocto_Build_Appliance.vhdx
127 ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vhd Yocto_Build_Appliance/Yocto_Build_Appliance.vhd
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600128 zip -r ${IMGDEPLOYDIR}/Yocto_Build_Appliance-${DATETIME}.zip Yocto_Build_Appliance
129 ln -sf Yocto_Build_Appliance-${DATETIME}.zip ${IMGDEPLOYDIR}/Yocto_Build_Appliance.zip
130}
131create_bundle_files[vardepsexclude] = "DATETIME"
132
133python do_bundle_files() {
134 bb.build.exec_func('create_bundle_files', d)
135}
136
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500137addtask bundle_files after do_image_wic before do_image_complete