Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1 | SUMMARY = "An image containing the build system itself" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | DESCRIPTION = "An image containing the build system that you can boot and run using either VirtualBox, VMware Player or VMware Workstation." |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 3 | HOMEPAGE = "http://www.yoctoproject.org/documentation/build-appliance" |
| 4 | |
| 5 | LICENSE = "MIT" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 7 | |
| 8 | IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-openssh packagegroup-self-hosted \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 9 | kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcpcd \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 10 | tzdata python3-pip perl-misc" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 11 | |
| 12 | IMAGE_FEATURES += "x11-base package-management splash" |
| 13 | |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 14 | QB_MEM = '${@bb.utils.contains("DISTRO_FEATURES", "opengl", "-m 512", "-m 256", d)}' |
| 15 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 16 | # Ensure there's enough space to do a core-image-sato build, with rm_work enabled |
| 17 | IMAGE_ROOTFS_EXTRA_SPACE = "41943040" |
| 18 | |
| 19 | # Do a quiet boot with limited console messages |
| 20 | APPEND += "rootfstype=ext4 quiet" |
| 21 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | DEPENDS = "zip-native python3-pip-native" |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 23 | IMAGE_FSTYPES = "wic.vmdk wic.vhd wic.vhdx" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 24 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 25 | inherit core-image setuptools3 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 26 | |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 27 | SRCREV ?= "093398daf5000e69057aedfe8c9f8df2c4e837f3" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 28 | SRC_URI = "git://git.yoctoproject.org/poky;branch=master \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 29 | file://Yocto_Build_Appliance.vmx \ |
| 30 | file://Yocto_Build_Appliance.vmxf \ |
| 31 | file://README_VirtualBox_Guest_Additions.txt \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 32 | file://README_VirtualBox_Toaster.txt \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 33 | " |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 34 | RECIPE_NO_UPDATE_REASON = "Recipe is recursive and handled as part of the release process" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 35 | BA_INCLUDE_SOURCES ??= "0" |
| 36 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 37 | IMAGE_CMD:ext4:append () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 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 | |
| 42 | fakeroot 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 61 | # Place the README_VirtualBox_Toaster file in builders home folder. |
| 62 | cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/ |
| 63 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 64 | 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 Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 70 | echo 'export PATH=$PATH:/sbin' >> ${IMAGE_ROOTFS}/home/builder/.bashrc |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 71 | 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 Bishop | c4ea075 | 2018-11-15 14:30:15 -0800 | [diff] [blame] | 79 | chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/poky |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 80 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 89 | rm -f ${IMAGE_ROOTFS}/sbin/iptables |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 90 | ln -rs ${IMAGE_ROOTFS}/usr/sbin/iptables ${IMAGE_ROOTFS}/sbin/iptables |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 96 | |
| 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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 102 | 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 Bishop | c4ea075 | 2018-11-15 14:30:15 -0800 | [diff] [blame] | 107 | chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.local |
| 108 | chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.cache |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; " |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 112 | # For pip usage above |
| 113 | do_image[network] = "1" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 114 | |
| 115 | addtask rootfs after do_unpack |
| 116 | |
| 117 | python () { |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame] | 118 | # Ensure we run these usually noexec tasks |
| 119 | d.delVarFlag("do_fetch", "noexec") |
| 120 | d.delVarFlag("do_unpack", "noexec") |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | create_bundle_files () { |
| 124 | cd ${WORKDIR} |
| 125 | mkdir -p Yocto_Build_Appliance |
| 126 | cp *.vmx* Yocto_Build_Appliance |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 127 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 128 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vhdx Yocto_Build_Appliance/Yocto_Build_Appliance.vhdx |
| 129 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vhd Yocto_Build_Appliance/Yocto_Build_Appliance.vhd |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 130 | 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 | } |
| 133 | create_bundle_files[vardepsexclude] = "DATETIME" |
| 134 | |
| 135 | python do_bundle_files() { |
| 136 | bb.build.exec_func('create_bundle_files', d) |
| 137 | } |
| 138 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 139 | addtask bundle_files after do_image_wic before do_image_complete |