blob: 8be6171b238c70b2e448498e3e2d14717fb38f79 [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"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050023IMAGE_FSTYPES = "wic.vmdk"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060024
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025inherit core-image module-base setuptools3
Patrick Williamsc0f7c042017-02-23 20:41:17 -060026
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050027SRCREV ?= "20586411649fcad6f0459ce74a581374ab564737"
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
37IMAGE_CMD_ext4_append () {
38 # 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 # Create a symlink, needed for out-of-tree kernel modules build
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080065 if [ ! -e ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build ]; then
66 rm -f ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
67 lnr ${IMAGE_ROOTFS}${KERNEL_SRC_PATH} ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
68 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -060069
70 echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
71 echo "export LC_ALL=en_US.utf8" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
72
73 # Also save (for reference only) the actual SRCREV used to create this image
74 echo "export BA_SRCREV=${SRCREV}" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
75 echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Brad Bishop37a0e4d2017-12-04 01:01:44 -050076 echo 'export PATH=$PATH:/sbin' >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Patrick Williamsc0f7c042017-02-23 20:41:17 -060077 echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
78
79 echo "# If working behind a proxy and using the provided oe-git-proxy script" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
80 echo "# you need to set ALL_PROXY based on your proxy settings." >> ${IMAGE_ROOTFS}/home/builder/.bashrc
81 echo "# Example ALL_PROXY values:" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
82 echo "# export ALL_PROXY=https://proxy.example.com:8080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
83 echo "# export ALL_PROXY=socks://socks.example.com:1080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
84
Brad Bishopc4ea0752018-11-15 14:30:15 -080085 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/poky
Patrick Williamsc0f7c042017-02-23 20:41:17 -060086 chmod -R ug+rw ${IMAGE_ROOTFS}/home/builder/poky
87
88 # Assume we will need CDROM to install guest additions
89 mkdir -p ${IMAGE_ROOTFS}/media/cdrom
90
91 # Allow builder to use sudo
92 echo "builder ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
93
94 # Load tap/tun at startup
Brad Bishop6e60e8b2018-02-01 10:27:11 -050095 rm -f ${IMAGE_ROOTFS}/sbin/iptables
Patrick Williamsc0f7c042017-02-23 20:41:17 -060096 lnr ${IMAGE_ROOTFS}/usr/sbin/iptables ${IMAGE_ROOTFS}/sbin/iptables
97 echo "tun" >> ${IMAGE_ROOTFS}/etc/modules
98
99 # Use Clearlooks GTK+ theme
100 mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
101 echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500102
103 # Install modules needed for toaster
104 export STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}
105 export STAGING_INCDIR=${STAGING_INCDIR_NATIVE}
106 export HOME=${IMAGE_ROOTFS}/home/builder
107 mkdir -p ${IMAGE_ROOTFS}/home/builder/.cache/pip
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500108 pip3_install_params="--user -I -U -v -r ${IMAGE_ROOTFS}/home/builder/poky/bitbake/toaster-requirements.txt"
109 if [ -n "${http_proxy}" ]; then
110 pip3_install_params="${pip3_install_params} --proxy ${http_proxy}"
111 fi
112 pip3 install ${pip3_install_params}
Brad Bishopc4ea0752018-11-15 14:30:15 -0800113 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.local
114 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.cache
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600115}
116
117IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; "
118
119addtask rootfs after do_unpack
120
121python () {
Brad Bishopa5c52ff2018-11-23 10:55:50 +1300122 # Ensure we run these usually noexec tasks
123 d.delVarFlag("do_fetch", "noexec")
124 d.delVarFlag("do_unpack", "noexec")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600125}
126
127create_bundle_files () {
128 cd ${WORKDIR}
129 mkdir -p Yocto_Build_Appliance
130 cp *.vmx* Yocto_Build_Appliance
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500131 ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600132 zip -r ${IMGDEPLOYDIR}/Yocto_Build_Appliance-${DATETIME}.zip Yocto_Build_Appliance
133 ln -sf Yocto_Build_Appliance-${DATETIME}.zip ${IMGDEPLOYDIR}/Yocto_Build_Appliance.zip
134}
135create_bundle_files[vardepsexclude] = "DATETIME"
136
137python do_bundle_files() {
138 bb.build.exec_func('create_bundle_files', d)
139}
140
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500141addtask bundle_files after do_image_wic before do_image_complete