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 \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcp-client \ |
| 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 | |
| 14 | # Ensure there's enough space to do a core-image-sato build, with rm_work enabled |
| 15 | IMAGE_ROOTFS_EXTRA_SPACE = "41943040" |
| 16 | |
| 17 | # Do a quiet boot with limited console messages |
| 18 | APPEND += "rootfstype=ext4 quiet" |
| 19 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 20 | DEPENDS = "zip-native python3-pip-native" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 21 | IMAGE_FSTYPES = "wic.vmdk" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 22 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 23 | inherit core-image module-base setuptools3 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 24 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 25 | SRCREV ?= "c96d8de352f242f70ff9c166508c3d0e50199874" |
| 26 | SRC_URI = "git://git.yoctoproject.org/poky \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 27 | file://Yocto_Build_Appliance.vmx \ |
| 28 | file://Yocto_Build_Appliance.vmxf \ |
| 29 | file://README_VirtualBox_Guest_Additions.txt \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 30 | file://README_VirtualBox_Toaster.txt \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 31 | " |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 32 | 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] | 33 | BA_INCLUDE_SOURCES ??= "0" |
| 34 | |
| 35 | IMAGE_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 | |
| 40 | fakeroot 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 59 | # Place the README_VirtualBox_Toaster file in builders home folder. |
| 60 | cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/ |
| 61 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 62 | # Create a symlink, needed for out-of-tree kernel modules build |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 63 | 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 Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 67 | |
| 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 Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 74 | echo 'export PATH=$PATH:/sbin' >> ${IMAGE_ROOTFS}/home/builder/.bashrc |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 75 | 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 Bishop | c4ea075 | 2018-11-15 14:30:15 -0800 | [diff] [blame] | 83 | chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/poky |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 84 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 93 | rm -f ${IMAGE_ROOTFS}/sbin/iptables |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 94 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 100 | |
| 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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 106 | 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 Bishop | c4ea075 | 2018-11-15 14:30:15 -0800 | [diff] [blame] | 111 | chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.local |
| 112 | chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.cache |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; " |
| 116 | |
| 117 | addtask rootfs after do_unpack |
| 118 | |
| 119 | python () { |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame] | 120 | # Ensure we run these usually noexec tasks |
| 121 | d.delVarFlag("do_fetch", "noexec") |
| 122 | d.delVarFlag("do_unpack", "noexec") |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | create_bundle_files () { |
| 126 | cd ${WORKDIR} |
| 127 | mkdir -p Yocto_Build_Appliance |
| 128 | cp *.vmx* Yocto_Build_Appliance |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 129 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk |
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 |