blob: 4cf55519ccc4f749fe1fc94e423201b99a0b193b [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."
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06003HOMEPAGE = "https://docs.yoctoproject.org/overview-manual/yp-intro.html#archived-components"
Patrick Williamsc0f7c042017-02-23 20:41:17 -06004
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
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060014QB_MEM ?= '${@bb.utils.contains("DISTRO_FEATURES", "opengl", "-m 512", "-m 256", d)}'
Brad Bishop79641f22019-09-10 07:20:22 -040015
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 Geissler6aa7eec2023-03-03 12:41:14 -060025inherit core-image setuptools3 features_check
Patrick Williamsc0f7c042017-02-23 20:41:17 -060026
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060027REQUIRED_DISTRO_FEATURES += "xattr"
28
Patrick Williams2f814a62024-04-16 16:28:03 -050029SRCREV ?= "17723c6e34096a53fb186cc70cfc604bb30da8b9"
Patrick Williamsb542dec2023-06-09 01:26:37 -050030SRC_URI = "git://git.yoctoproject.org/poky;branch=master \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060031 file://Yocto_Build_Appliance.vmx \
32 file://Yocto_Build_Appliance.vmxf \
33 file://README_VirtualBox_Guest_Additions.txt \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 file://README_VirtualBox_Toaster.txt \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060035 "
Brad Bishop19323692019-04-05 15:28:33 -040036RECIPE_NO_UPDATE_REASON = "Recipe is recursive and handled as part of the release process"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060037BA_INCLUDE_SOURCES ??= "0"
38
Patrick Williams213cb262021-08-07 19:21:33 -050039IMAGE_CMD:ext4:append () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -060040 # We don't need to reserve much space for root, 0.5% is more than enough
41 tune2fs -m 0.5 ${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ext4
42}
43
44fakeroot do_populate_poky_src () {
45 # Because fetch2's git's unpack uses -s cloneflag, the unpacked git repo
46 # will become invalid in the target.
47 rm -rf ${WORKDIR}/git/.git
48 rm -f ${WORKDIR}/git/.gitignore
49
50 cp -R ${WORKDIR}/git ${IMAGE_ROOTFS}/home/builder/poky
51
52 mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/conf
53 mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/downloads
54 if [ ${BA_INCLUDE_SOURCES} != 0 ]; then
55 cp -RpL ${DL_DIR}/* ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/
56 # Remove the git2_* tarballs -- this is ok since we still have the git2/.
57 rm -rf ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/git2_*
58 fi
59
60 # Place the README_VirtualBox_Guest_Additions file in builders home folder.
61 cp ${WORKDIR}/README_VirtualBox_Guest_Additions.txt ${IMAGE_ROOTFS}/home/builder/
62
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063 # Place the README_VirtualBox_Toaster file in builders home folder.
64 cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/
65
Patrick Williamsc0f7c042017-02-23 20:41:17 -060066 echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
67 echo "export LC_ALL=en_US.utf8" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060068 echo "export TERM=xterm-color" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Patrick Williamsc0f7c042017-02-23 20:41:17 -060069
70 # Also save (for reference only) the actual SRCREV used to create this image
71 echo "export BA_SRCREV=${SRCREV}" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
72 echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Brad Bishop37a0e4d2017-12-04 01:01:44 -050073 echo 'export PATH=$PATH:/sbin' >> ${IMAGE_ROOTFS}/home/builder/.bashrc
Patrick Williamsc0f7c042017-02-23 20:41:17 -060074 echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
75
76 echo "# If working behind a proxy and using the provided oe-git-proxy script" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
77 echo "# you need to set ALL_PROXY based on your proxy settings." >> ${IMAGE_ROOTFS}/home/builder/.bashrc
78 echo "# Example ALL_PROXY values:" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
79 echo "# export ALL_PROXY=https://proxy.example.com:8080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
80 echo "# export ALL_PROXY=socks://socks.example.com:1080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
81
Brad Bishopc4ea0752018-11-15 14:30:15 -080082 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/poky
Patrick Williamsc0f7c042017-02-23 20:41:17 -060083 chmod -R ug+rw ${IMAGE_ROOTFS}/home/builder/poky
84
85 # Assume we will need CDROM to install guest additions
86 mkdir -p ${IMAGE_ROOTFS}/media/cdrom
87
88 # Allow builder to use sudo
89 echo "builder ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
90
91 # Load tap/tun at startup
Brad Bishop6e60e8b2018-02-01 10:27:11 -050092 rm -f ${IMAGE_ROOTFS}/sbin/iptables
Andrew Geissler595f6302022-01-24 19:11:47 +000093 ln -rs ${IMAGE_ROOTFS}/usr/sbin/iptables ${IMAGE_ROOTFS}/sbin/iptables
Patrick Williamsc0f7c042017-02-23 20:41:17 -060094 echo "tun" >> ${IMAGE_ROOTFS}/etc/modules
95
96 # Use Clearlooks GTK+ theme
97 mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
98 echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
Brad Bishop6e60e8b2018-02-01 10:27:11 -050099
100 # Install modules needed for toaster
101 export STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}
102 export STAGING_INCDIR=${STAGING_INCDIR_NATIVE}
103 export HOME=${IMAGE_ROOTFS}/home/builder
104 mkdir -p ${IMAGE_ROOTFS}/home/builder/.cache/pip
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500105 pip3_install_params="--user -I -U -v -r ${IMAGE_ROOTFS}/home/builder/poky/bitbake/toaster-requirements.txt"
106 if [ -n "${http_proxy}" ]; then
107 pip3_install_params="${pip3_install_params} --proxy ${http_proxy}"
108 fi
109 pip3 install ${pip3_install_params}
Brad Bishopc4ea0752018-11-15 14:30:15 -0800110 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.local
111 chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.cache
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600112}
113
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600114fakeroot do_tweak_image () {
115 # add a /lib64 symlink
116 # this is needed for building rust-native on a 64-bit build appliance
117 ln -rs ${IMAGE_ROOTFS}/lib ${IMAGE_ROOTFS}/lib64
118}
119
Andrew Geissler5082cc72023-09-11 08:41:39 -0400120IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src do_tweak_image"
Andrew Geissler595f6302022-01-24 19:11:47 +0000121# For pip usage above
122do_image[network] = "1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600123
124addtask rootfs after do_unpack
125
126python () {
Brad Bishopa5c52ff2018-11-23 10:55:50 +1300127 # Ensure we run these usually noexec tasks
128 d.delVarFlag("do_fetch", "noexec")
129 d.delVarFlag("do_unpack", "noexec")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600130}
131
132create_bundle_files () {
133 cd ${WORKDIR}
134 mkdir -p Yocto_Build_Appliance
135 cp *.vmx* Yocto_Build_Appliance
Andrew Geissler8f840682023-07-21 09:09:43 -0500136 ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk
137 ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic.vhdx Yocto_Build_Appliance/Yocto_Build_Appliance.vhdx
138 ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic.vhd Yocto_Build_Appliance/Yocto_Build_Appliance.vhd
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600139 zip -r ${IMGDEPLOYDIR}/Yocto_Build_Appliance-${DATETIME}.zip Yocto_Build_Appliance
140 ln -sf Yocto_Build_Appliance-${DATETIME}.zip ${IMGDEPLOYDIR}/Yocto_Build_Appliance.zip
141}
142create_bundle_files[vardepsexclude] = "DATETIME"
143
144python do_bundle_files() {
145 bb.build.exec_func('create_bundle_files', d)
146}
147
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500148addtask bundle_files after do_image_wic before do_image_complete