diff options
Diffstat (limited to 'meta/classes/image.bbclass')
| -rw-r--r-- | meta/classes/image.bbclass | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass new file mode 100644 index 0000000000..e995265244 --- /dev/null +++ b/meta/classes/image.bbclass | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | inherit rootfs_${IMAGE_PKGTYPE} | ||
| 2 | |||
| 3 | # We need to recursively follow RDEPENDS and RRECOMMENDS for images | ||
| 4 | BUILD_ALL_DEPS = "1" | ||
| 5 | do_rootfs[recrdeptask] = "do_package" | ||
| 6 | |||
| 7 | # Images are generally built explicitly, do not need to be part of world. | ||
| 8 | EXCLUDE_FROM_WORLD = "1" | ||
| 9 | |||
| 10 | USE_DEVFS ?= "0" | ||
| 11 | |||
| 12 | DEPENDS += "makedevs-native" | ||
| 13 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 14 | |||
| 15 | def get_image_deps(d): | ||
| 16 | import bb | ||
| 17 | str = "" | ||
| 18 | for type in (bb.data.getVar('IMAGE_FSTYPES', d, 1) or "").split(): | ||
| 19 | deps = bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "" | ||
| 20 | if deps: | ||
| 21 | str += " %s" % deps | ||
| 22 | return str | ||
| 23 | |||
| 24 | DEPENDS += "${@get_image_deps(d)}" | ||
| 25 | |||
| 26 | IMAGE_DEVICE_TABLE ?= "${@bb.which(bb.data.getVar('BBPATH', d, 1), 'files/device_table-minimal.txt')}" | ||
| 27 | IMAGE_POSTPROCESS_COMMAND ?= "" | ||
| 28 | |||
| 29 | # Must call real_do_rootfs() from inside here, rather than as a separate | ||
| 30 | # task, so that we have a single fakeroot context for the whole process. | ||
| 31 | fakeroot do_rootfs () { | ||
| 32 | set -x | ||
| 33 | rm -rf ${IMAGE_ROOTFS} | ||
| 34 | |||
| 35 | if [ "${USE_DEVFS}" != "1" ]; then | ||
| 36 | mkdir -p ${IMAGE_ROOTFS}/dev | ||
| 37 | makedevs -r ${IMAGE_ROOTFS} -D ${IMAGE_DEVICE_TABLE} | ||
| 38 | fi | ||
| 39 | |||
| 40 | rootfs_${IMAGE_PKGTYPE}_do_rootfs | ||
| 41 | |||
| 42 | ${IMAGE_PREPROCESS_COMMAND} | ||
| 43 | |||
| 44 | export TOPDIR=${TOPDIR} | ||
| 45 | |||
| 46 | for type in ${IMAGE_FSTYPES}; do | ||
| 47 | if test -z "$FAKEROOTKEY"; then | ||
| 48 | fakeroot -i ${TMPDIR}/fakedb.image bbimage -t $type -e ${FILE} | ||
| 49 | else | ||
| 50 | bbimage -n "${IMAGE_NAME}" -t "$type" -e "${FILE}" | ||
| 51 | fi | ||
| 52 | |||
| 53 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.* | ||
| 54 | ln -s ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type | ||
| 55 | done | ||
| 56 | |||
| 57 | ${IMAGE_POSTPROCESS_COMMAND} | ||
| 58 | } | ||
