diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/image_dd.bbclass | 78 | ||||
-rw-r--r-- | classes/populate_b2qt_sdk.bbclass | 8 | ||||
-rw-r--r-- | classes/qtquickcompiler.bbclass | 25 |
3 files changed, 99 insertions, 12 deletions
diff --git a/classes/image_dd.bbclass b/classes/image_dd.bbclass new file mode 100644 index 0000000..4d193b7 --- /dev/null +++ b/classes/image_dd.bbclass | |||
@@ -0,0 +1,78 @@ | |||
1 | ############################################################################## | ||
2 | ## | ||
3 | ## Copyright (C) 2016 The Qt Company Ltd. | ||
4 | ## Contact: http://www.qt.io/licensing/ | ||
5 | ## | ||
6 | ## This file is part of the Boot to Qt meta layer. | ||
7 | ## | ||
8 | ## $QT_BEGIN_LICENSE:COMM$ | ||
9 | ## | ||
10 | ## Commercial License Usage | ||
11 | ## Licensees holding valid commercial Qt licenses may use this file in | ||
12 | ## accordance with the commercial license agreement provided with the | ||
13 | ## Software or, alternatively, in accordance with the terms contained in | ||
14 | ## a written agreement between you and The Qt Company. For licensing terms | ||
15 | ## and conditions see http://www.qt.io/terms-conditions. For further | ||
16 | ## information use the contact form at http://www.qt.io/contact-us. | ||
17 | ## | ||
18 | ## $QT_END_LICENSE$ | ||
19 | ## | ||
20 | ############################################################################## | ||
21 | |||
22 | # This class is based on meta-fsl-arm/classes/image_types_fsl.bbclass::generate_imx_sdcard() | ||
23 | DESCRIPTION = "The base class for building images that can be deployed with GNU coreutils dd tool." | ||
24 | inherit image_types | ||
25 | |||
26 | IMAGE="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.img" | ||
27 | |||
28 | # Boot partition size [in KiB] | ||
29 | BOOT_SPACE ?= "8192" | ||
30 | |||
31 | # Set alignment to 4MB [in KiB] | ||
32 | IMAGE_ROOTFS_ALIGNMENT = "4096" | ||
33 | |||
34 | # Boot partition volume id | ||
35 | BOOTDD_VOLUME_ID = "boot" | ||
36 | |||
37 | IMAGE_TYPEDEP_dd = "ext3" | ||
38 | IMAGE_DEPENDS_dd = "parted-native:do_populate_sysroot \ | ||
39 | dosfstools-native:do_populate_sysroot \ | ||
40 | mtools-native:do_populate_sysroot" | ||
41 | |||
42 | image_dd_do_populate_boot() { | ||
43 | } | ||
44 | EXPORT_FUNCTIONS do_populate_boot | ||
45 | |||
46 | IMAGE_CMD_dd() { | ||
47 | |||
48 | ROOTFS="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3" | ||
49 | |||
50 | # Align boot partition and calculate total binary image size | ||
51 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) | ||
52 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) | ||
53 | IMAGE_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE + ${IMAGE_ROOTFS_ALIGNMENT}) | ||
54 | |||
55 | # Initialize a sparse file | ||
56 | dd if=/dev/zero of=${IMAGE} bs=1 count=0 seek=$(expr 1024 \* ${IMAGE_SIZE}) | ||
57 | |||
58 | # Create partition table | ||
59 | parted -s ${IMAGE} mklabel msdos | ||
60 | parted -s ${IMAGE} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) | ||
61 | parted -s ${IMAGE} unit KiB mkpart primary $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} \+ $ROOTFS_SIZE) | ||
62 | parted -s ${IMAGE} set 1 boot on | ||
63 | parted ${IMAGE} print | ||
64 | |||
65 | # Create boot partition image | ||
66 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${IMAGE} unit b print \ | ||
67 | | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 1024 }') | ||
68 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
69 | do_populate_boot | ||
70 | |||
71 | # Burn Partitions | ||
72 | dd if=${WORKDIR}/boot.img of=${IMAGE} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
73 | dd if=${ROOTFS} of=${IMAGE} conv=notrunc seek=1 bs=$(expr ${BOOT_SPACE_ALIGNED} \* 1024 + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
74 | |||
75 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.img | ||
76 | ln -s ${IMAGE_NAME}.rootfs.img ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.img | ||
77 | } | ||
78 | |||
diff --git a/classes/populate_b2qt_sdk.bbclass b/classes/populate_b2qt_sdk.bbclass index a61d625..cce6669 100644 --- a/classes/populate_b2qt_sdk.bbclass +++ b/classes/populate_b2qt_sdk.bbclass | |||
@@ -23,7 +23,8 @@ inherit populate_sdk | |||
23 | 23 | ||
24 | replace_sysroot_symlink() { | 24 | replace_sysroot_symlink() { |
25 | SYMLINK_SYSROOT=$1 | 25 | SYMLINK_SYSROOT=$1 |
26 | for SOURCE in `find ${SYMLINK_SYSROOT} -type l` | 26 | SEARCH_FOLDER=$2 |
27 | for SOURCE in `find ${SEARCH_FOLDER} -type l` | ||
27 | do | 28 | do |
28 | TARGET=`readlink -m "${SOURCE}"` | 29 | TARGET=`readlink -m "${SOURCE}"` |
29 | #check whether TARGET is inside the sysroot when not prepend the sysroot | 30 | #check whether TARGET is inside the sysroot when not prepend the sysroot |
@@ -31,6 +32,7 @@ replace_sysroot_symlink() { | |||
31 | rm "${SOURCE}" | 32 | rm "${SOURCE}" |
32 | if [ -d "${TARGET}" ]; then | 33 | if [ -d "${TARGET}" ]; then |
33 | cp -r "${TARGET}" "${SOURCE}" | 34 | cp -r "${TARGET}" "${SOURCE}" |
35 | replace_sysroot_symlink ${SYMLINK_SYSROOT} ${SOURCE} | ||
34 | elif [ -f "${TARGET}" ]; then | 36 | elif [ -f "${TARGET}" ]; then |
35 | cp "${TARGET}" "${SOURCE}" | 37 | cp "${TARGET}" "${SOURCE}" |
36 | elif [ -e "${TARGET}" ]; then | 38 | elif [ -e "${TARGET}" ]; then |
@@ -40,8 +42,8 @@ replace_sysroot_symlink() { | |||
40 | } | 42 | } |
41 | 43 | ||
42 | fakeroot tar_sdk_sdkmingw32() { | 44 | fakeroot tar_sdk_sdkmingw32() { |
43 | replace_sysroot_symlink ${SDK_OUTPUT}${SDKTARGETSYSROOT} | 45 | replace_sysroot_symlink ${SDK_OUTPUT}${SDKTARGETSYSROOT} ${SDK_OUTPUT}${SDKTARGETSYSROOT} |
44 | replace_sysroot_symlink ${SDK_OUTPUT}${SDKPATHNATIVE} | 46 | replace_sysroot_symlink ${SDK_OUTPUT}${SDKPATHNATIVE} ${SDK_OUTPUT}${SDKPATHNATIVE} |
45 | # Package it up | 47 | # Package it up |
46 | mkdir -p ${SDK_DEPLOY} | 48 | mkdir -p ${SDK_DEPLOY} |
47 | cd ${SDK_OUTPUT}/${SDKPATH} | 49 | cd ${SDK_OUTPUT}/${SDKPATH} |
diff --git a/classes/qtquickcompiler.bbclass b/classes/qtquickcompiler.bbclass index 16fb6fe..b6710be 100644 --- a/classes/qtquickcompiler.bbclass +++ b/classes/qtquickcompiler.bbclass | |||
@@ -20,16 +20,23 @@ | |||
20 | ############################################################################## | 20 | ############################################################################## |
21 | 21 | ||
22 | python __anonymous() { | 22 | python __anonymous() { |
23 | provider = "qtquickcompiler" | ||
24 | |||
23 | sdk_path = d.getVar('QT_SDK_PATH', True) or "" | 25 | sdk_path = d.getVar('QT_SDK_PATH', True) or "" |
24 | if len(sdk_path) != 0: | 26 | if len(sdk_path) != 0: |
25 | bb.note("TODO: QtQuickCompiler not yet available for external builds") | 27 | qtquickcompiler_path = d.getVar('B2QTBASE', True) + "/recipes-qt/qt5-addons/qtquickcompiler-sdk" |
26 | else: | 28 | if not os.path.isdir(qtquickcompiler_path): |
27 | pn = d.getVar("PN", True) | 29 | bb.note("QtQuickCompiler not available") |
28 | if "toolchain-host" in pn: | 30 | return |
29 | d.appendVar('RDEPENDS_' + pn, " nativesdk-qtquickcompiler-tools") | ||
30 | if "toolchain-target" in pn: | ||
31 | d.appendVar('RDEPENDS_' + pn, " qtquickcompiler-dev") | ||
32 | else: | 31 | else: |
33 | d.appendVar('DEPENDS', " qtquickcompiler qtquickcompiler-native") | 32 | provider = "qtquickcompiler-sdk" |
34 | d.appendVar('EXTRA_QMAKEVARS_PRE', " CONFIG+=qtquickcompiler CONFIG+=no_qtquickcompiler_depend") | 33 | |
34 | pn = d.getVar("PN", True) | ||
35 | if "toolchain-host" in pn: | ||
36 | d.appendVar('RDEPENDS_' + pn, " nativesdk-%s-tools" % provider) | ||
37 | if "toolchain-target" in pn: | ||
38 | d.appendVar('RDEPENDS_' + pn, " %s-dev" % provider) | ||
39 | else: | ||
40 | d.appendVar('DEPENDS', " %s %s-native" % (provider, provider)) | ||
41 | d.appendVar('EXTRA_QMAKEVARS_PRE', " CONFIG+=qtquickcompiler CONFIG+=no_qtquickcompiler_depend") | ||
35 | } | 42 | } |