blob: e9cac98c572b823cba1005f31efff1e244b4ea48 [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 \
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009 kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcp-client \
10 tzdata python3-pip perl-misc"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011
12IMAGE_FEATURES += "x11-base package-management splash"
13
14# Ensure there's enough space to do a core-image-sato build, with rm_work enabled
15IMAGE_ROOTFS_EXTRA_SPACE = "41943040"
16
17# Do a quiet boot with limited console messages
18APPEND += "rootfstype=ext4 quiet"
19
Brad Bishop6e60e8b2018-02-01 10:27:11 -050020DEPENDS = "zip-native python3-pip-native"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021IMAGE_FSTYPES = "wic.vmdk"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060022
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023inherit core-image module-base setuptools3
Patrick Williamsc0f7c042017-02-23 20:41:17 -060024
Brad Bishop15ae2502019-06-18 21:44:24 -040025SRCREV ?= "bb59bcd016bdd815809ac10df45d61c364c46df0"
Brad Bishop19323692019-04-05 15:28:33 -040026SRC_URI = "git://git.yoctoproject.org/poky \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060027 file://Yocto_Build_Appliance.vmx \
28 file://Yocto_Build_Appliance.vmxf \
29 file://README_VirtualBox_Guest_Additions.txt \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050030 file://README_VirtualBox_Toaster.txt \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060031 "
Brad Bishop19323692019-04-05 15:28:33 -040032RECIPE_NO_UPDATE_REASON = "Recipe is recursive and handled as part of the release process"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033BA_INCLUDE_SOURCES ??= "0"
34
35IMAGE_CMD_ext4_append () {
36 # We don't need to reserve much space for root, 0.5% is more than enough
37 tune2fs -m 0.5 ${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ext4
38}
39
40fakeroot do_populate_poky_src () {
41 # Because fetch2's git's unpack uses -s cloneflag, the unpacked git repo
42 # will become invalid in the target.
43 rm -rf ${WORKDIR}/git/.git
44 rm -f ${WORKDIR}/git/.gitignore
45
46 cp -R ${WORKDIR}/git ${IMAGE_ROOTFS}/home/builder/poky
47
48 mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/conf
49 mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/downloads
50 if [ ${BA_INCLUDE_SOURCES} != 0 ]; then
51 cp -RpL ${DL_DIR}/* ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/
52 # Remove the git2_* tarballs -- this is ok since we still have the git2/.
53 rm -rf ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/git2_*
54 fi
55
56 # Place the README_VirtualBox_Guest_Additions file in builders home folder.
57 cp ${WORKDIR}/README_VirtualBox_Guest_Additions.txt ${IMAGE_ROOTFS}/home/builder/
58
Brad Bishop6e60e8b2018-02-01 10:27:11 -050059 # Place the README_VirtualBox_Toaster file in builders home folder.
60 cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/
61
Patrick Williamsc0f7c042017-02-23 20:41:17 -060062 # Create a symlink, needed for out-of-tree kernel modules build
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080063 if [ ! -e ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build ]; then
64 rm -f ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
65 lnr ${IMAGE_ROOTFS}${KERNEL_SRC_PATH} ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
66 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -060067
68 echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
69 echo "export LC_ALL=en_US.utf8" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
70
71 # Also save (for reference only) the actual SRCREV used to create this image
72 echo "export BA_SRCREV=${SRCREV}" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
73 echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Brad Bishop37a0e4d2017-12-04 01:01:44 -050074 echo 'export PATH=$PATH:/sbin' >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Patrick Williamsc0f7c042017-02-23 20:41:17 -060075 echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
76
77 echo "# If working behind a proxy and using the provided oe-git-proxy script" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
78 echo "# you need to set ALL_PROXY based on your proxy settings." >> ${IMAGE_ROOTFS}/home/builder/.bashrc
79 echo "# Example ALL_PROXY values:" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
80 echo "# export ALL_PROXY=https://proxy.example.com:8080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
81 echo "# export ALL_PROXY=socks://socks.example.com:1080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
82
Brad Bishopc4ea0752018-11-15 14:30:15 -080083 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/poky
Patrick Williamsc0f7c042017-02-23 20:41:17 -060084 chmod -R ug+rw ${IMAGE_ROOTFS}/home/builder/poky
85
86 # Assume we will need CDROM to install guest additions
87 mkdir -p ${IMAGE_ROOTFS}/media/cdrom
88
89 # Allow builder to use sudo
90 echo "builder ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
91
92 # Load tap/tun at startup
Brad Bishop6e60e8b2018-02-01 10:27:11 -050093 rm -f ${IMAGE_ROOTFS}/sbin/iptables
Patrick Williamsc0f7c042017-02-23 20:41:17 -060094 lnr ${IMAGE_ROOTFS}/usr/sbin/iptables ${IMAGE_ROOTFS}/sbin/iptables
95 echo "tun" >> ${IMAGE_ROOTFS}/etc/modules
96
97 # Use Clearlooks GTK+ theme
98 mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
99 echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500100
101 # Install modules needed for toaster
102 export STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}
103 export STAGING_INCDIR=${STAGING_INCDIR_NATIVE}
104 export HOME=${IMAGE_ROOTFS}/home/builder
105 mkdir -p ${IMAGE_ROOTFS}/home/builder/.cache/pip
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500106 pip3_install_params="--user -I -U -v -r ${IMAGE_ROOTFS}/home/builder/poky/bitbake/toaster-requirements.txt"
107 if [ -n "${http_proxy}" ]; then
108 pip3_install_params="${pip3_install_params} --proxy ${http_proxy}"
109 fi
110 pip3 install ${pip3_install_params}
Brad Bishopc4ea0752018-11-15 14:30:15 -0800111 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.local
112 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.cache
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600113}
114
115IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; "
116
117addtask rootfs after do_unpack
118
119python () {
Brad Bishopa5c52ff2018-11-23 10:55:50 +1300120 # Ensure we run these usually noexec tasks
121 d.delVarFlag("do_fetch", "noexec")
122 d.delVarFlag("do_unpack", "noexec")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600123}
124
125create_bundle_files () {
126 cd ${WORKDIR}
127 mkdir -p Yocto_Build_Appliance
128 cp *.vmx* Yocto_Build_Appliance
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500129 ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600130 zip -r ${IMGDEPLOYDIR}/Yocto_Build_Appliance-${DATETIME}.zip Yocto_Build_Appliance
131 ln -sf Yocto_Build_Appliance-${DATETIME}.zip ${IMGDEPLOYDIR}/Yocto_Build_Appliance.zip
132}
133create_bundle_files[vardepsexclude] = "DATETIME"
134
135python do_bundle_files() {
136 bb.build.exec_func('create_bundle_files', d)
137}
138
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500139addtask bundle_files after do_image_wic before do_image_complete