Furher work on instant sdk
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
2
README
2
README
@@ -57,7 +57,7 @@ appends:
|
|||||||
for the layer is ignored (see conf/layer.conf).
|
for the layer is ignored (see conf/layer.conf).
|
||||||
|
|
||||||
classes:
|
classes:
|
||||||
* instant-sysroot-cross.bbclass: Create a sysroot for remote
|
* instant-sysroot-target.bbclass: Create a sysroot for target remote
|
||||||
building/debugging - Yocto's suggested workflows are cumbersome for ad-hoc
|
building/debugging - Yocto's suggested workflows are cumbersome for ad-hoc
|
||||||
usage.
|
usage.
|
||||||
* instant-sysroot-native.bbclass: Native recipes inheriting this class
|
* instant-sysroot-native.bbclass: Native recipes inheriting this class
|
||||||
|
|||||||
@@ -7,30 +7,31 @@ PACKAGECONFIG_DISTRO += " \
|
|||||||
|
|
||||||
inherit instant-paths
|
inherit instant-paths
|
||||||
|
|
||||||
do_copy_to_cross_sysroot_append() {
|
do_copy_to_target_sysroot_append() {
|
||||||
# ---------- qt.conf ----------
|
# ---------- qt.conf ----------
|
||||||
# create
|
# create
|
||||||
generate_qt_config_file_paths
|
generate_qt_config_file_paths
|
||||||
|
|
||||||
# copy to cross sysroot
|
# move to target sysroot
|
||||||
qtconf=`basename ${OE_QMAKE_QTCONF_PATH}`
|
qtconf=`basename ${OE_QMAKE_QTCONF_PATH}`
|
||||||
targetpath=${INSTANT_CROSS_PATH}${OE_QMAKE_PATH_HOST_BINS}
|
targetpath=${INSTANT_TARGET_PATH}${OE_QMAKE_PATH_HOST_BINS}
|
||||||
cp -f "${OE_QMAKE_QTCONF_PATH}" "$targetpath"
|
rm -f "$targetpath/$qtconf"
|
||||||
|
mv "${OE_QMAKE_QTCONF_PATH}" "$targetpath"
|
||||||
echo "${OE_QMAKE_PATH_HOST_BINS}/$qtconf" >> ${INSTANT_MANIFEST}
|
echo "${OE_QMAKE_PATH_HOST_BINS}/$qtconf" >> ${INSTANT_MANIFEST}
|
||||||
|
|
||||||
# adjust to instant sysroot
|
# adjust to instant sysroot
|
||||||
sed -i \
|
sed -i \
|
||||||
-e 's:${STAGING_DIR_NATIVE}:${INSTANT_NATIVE_PATH}:g' \
|
-e 's:${STAGING_DIR_NATIVE}:${INSTANT_NATIVE_PATH}:g' \
|
||||||
-e 's:${STAGING_DIR_HOST}:${INSTANT_CROSS_PATH}:g' \
|
-e 's:${STAGING_DIR_HOST}:${INSTANT_TARGET_PATH}:g' \
|
||||||
-e 's:^HostBinaries =.*:HostBinaries = ${INSTANT_NATIVE_PATH}${bindir}${QT_DIR_NAME}:g' \
|
-e 's:^HostBinaries =.*:HostBinaries = ${INSTANT_NATIVE_PATH}${bindir}${QT_DIR_NAME}:g' \
|
||||||
"$targetpath/$qtconf"
|
"$targetpath/$qtconf"
|
||||||
|
|
||||||
# ---------- mkspecs qmake.conf ----------
|
# ---------- mkspecs qmake.conf ----------
|
||||||
rm ${INSTANT_CROSS_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/qmake.conf
|
rm ${INSTANT_TARGET_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/qmake.conf
|
||||||
cp -f "${WORKDIR}/packages-split/${PN}-mkspecs${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/qmake.conf" \
|
cp -f "${WORKDIR}/packages-split/${PN}-mkspecs${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/qmake.conf" \
|
||||||
"${INSTANT_CROSS_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/"
|
"${INSTANT_TARGET_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/"
|
||||||
sed -i \
|
sed -i \
|
||||||
-e 's:${DEBUG_PREFIX_MAP}:-fdebug-prefix-map=${INSTANT_CROSS_PATH}= -fdebug-prefix-map=${INSTANT_NATIVE_PATH}=:g' \
|
-e 's:${DEBUG_PREFIX_MAP}:-fdebug-prefix-map=${INSTANT_TARGET_PATH}= -fdebug-prefix-map=${INSTANT_NATIVE_PATH}=:g' \
|
||||||
"${INSTANT_CROSS_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/qmake.conf"
|
"${INSTANT_TARGET_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/qmake.conf"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# This is where instant native sysroot is installed to
|
# This is where instant native sysroot is installed to
|
||||||
INSTANT_NATIVE_PATH = "${TMPDIR}/sysroot-instant-native"
|
INSTANT_NATIVE_PATH = "${TMPDIR}/sysroot-instant-native"
|
||||||
|
|
||||||
# This is where instant cross sysroot is installed to
|
# This is where instant target sysroot is installed to
|
||||||
INSTANT_CROSS_PATH = "${TMPDIR}/sysroot-instant-cross-${MACHINE_ARCH}"
|
INSTANT_TARGET_PATH = "${TMPDIR}/sysroot-instant-target-${MACHINE_ARCH}"
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
# To achieve, a debug sysroot is build with low cost:
|
# To achieve, a debug sysroot is build with low cost:
|
||||||
#
|
#
|
||||||
# * All files are hard-linked to recipe's ${WORKDIR}/package
|
# * All files are hard-linked to recipe's ${WORKDIR}/package
|
||||||
# * Additional build time for task do_copy_to_cross_sysroot for most recipes is < 1s
|
# * Additional build time for task do_copy_to_target_sysroot for most recipes is < 1s
|
||||||
#
|
#
|
||||||
# to enable debug sysroot build set:
|
# to enable debug sysroot build set:
|
||||||
# 'INHERIT += "instant-sysroot-cross"'
|
# 'INHERIT += "instant-sysroot-target"'
|
||||||
# in your local.conf
|
# in your local.conf
|
||||||
#
|
#
|
||||||
# to debug by remote do:
|
# to debug by remote do:
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
# 'gdbserver :5000 /usr/bin/thunar'
|
# 'gdbserver :5000 /usr/bin/thunar'
|
||||||
#
|
#
|
||||||
# ON BUILD HOST (suggested IDE: QtCreator)
|
# ON BUILD HOST (suggested IDE: QtCreator)
|
||||||
# * build gdb-cross-<TARGET_ARCH> (done automatically on images if this class
|
# * build gdb-target-<TARGET_ARCH> (done automatically on images if this class
|
||||||
# enabled - see EXTRA_IMAGEDEPENDS below)
|
# enabled - see EXTRA_IMAGEDEPENDS below)
|
||||||
# * in QtCreator select Menu Debug/Start Debugging/Attach to Running Debug Server
|
# * in QtCreator select Menu Debug/Start Debugging/Attach to Running Debug Server
|
||||||
# -> Dialog 'Start Debugger' opens
|
# -> Dialog 'Start Debugger' opens
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
# The settings are kept so 1.-6. have to be done once only.
|
# The settings are kept so 1.-6. have to be done once only.
|
||||||
# 1. Create a Kit by 'Add' -> further dialog opens
|
# 1. Create a Kit by 'Add' -> further dialog opens
|
||||||
# 2. Select an name for the Kit e.g 'OE'
|
# 2. Select an name for the Kit e.g 'OE'
|
||||||
# 3. Set sysroot (see INSTANT_CROSS_PATH in instant-path.bbclass):
|
# 3. Set sysroot (see INSTANT_TARGET_PATH in instant-path.bbclass):
|
||||||
# ${TMPDIR}/sysroot-instant-cross-${MACHINE_ARCH}
|
# ${TMPDIR}/sysroot-instant-target-${MACHINE_ARCH}
|
||||||
# 4. Select compilers (it is not necessary for debug but without QTCreator won't enable Kit) for C and C++ e.g:
|
# 4. Select compilers (it is not necessary for debug but without QTCreator won't enable Kit) for C and C++ e.g:
|
||||||
# C: '<TMDIR>/sysroot-instant-native/usr/bin/arm-mortsgna-linux-gnueabi/arm-mortsgna-linux-gnueabi-gcc'
|
# C: '<TMDIR>/sysroot-instant-native/usr/bin/arm-mortsgna-linux-gnueabi/arm-mortsgna-linux-gnueabi-gcc'
|
||||||
# C++: '<TMDIR>/sysroot-instant-native/usr/bin/arm-mortsgna-linux-gnueabi/arm-mortsgna-linux-gnueabi-g++'
|
# C++: '<TMDIR>/sysroot-instant-native/usr/bin/arm-mortsgna-linux-gnueabi/arm-mortsgna-linux-gnueabi-g++'
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
# GDB: '<TMDIR>/sysroot-instant-native/usr/bin/arm-mortsgna-linux-gnueabi/arm-mortsgna-linux-gnueabi-gdb'
|
# GDB: '<TMDIR>/sysroot-instant-native/usr/bin/arm-mortsgna-linux-gnueabi/arm-mortsgna-linux-gnueabi-gdb'
|
||||||
# 6. Select 'OK' in Options dialog -> 'Start Debugger' should be back on top
|
# 6. Select 'OK' in Options dialog -> 'Start Debugger' should be back on top
|
||||||
# * Make sure 'OE' Kit is selected
|
# * Make sure 'OE' Kit is selected
|
||||||
# * Browse for executable e.g '<TMDIR>/sysroot-instant-cross/usr/bin/thunar'
|
# * Browse for executable e.g '<TMDIR>/sysroot-instant-target/usr/bin/thunar'
|
||||||
# * Set IP:Port of target machine e.g '192.168.2.108:5000'
|
# * Set IP:Port of target machine e.g '192.168.2.108:5000'
|
||||||
# * Select 'OK'
|
# * Select 'OK'
|
||||||
#
|
#
|
||||||
@@ -56,27 +56,27 @@ EXTRA_IMAGEDEPENDS += "gdb-cross-${TARGET_ARCH} gdb"
|
|||||||
|
|
||||||
python __anonymous () {
|
python __anonymous () {
|
||||||
if d.getVar('CLASSOVERRIDE') != 'class-target':
|
if d.getVar('CLASSOVERRIDE') != 'class-target':
|
||||||
bb.build.deltask('do_copy_to_cross_sysroot', d)
|
bb.build.deltask('do_copy_to_target_sysroot', d)
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANT_MANIFEST = "${INSTANT_CROSS_PATH}/manifests/${PN}"
|
INSTANT_MANIFEST = "${INSTANT_TARGET_PATH}/manifests/${PN}"
|
||||||
|
|
||||||
do_copy_to_cross_sysroot() {
|
do_copy_to_target_sysroot() {
|
||||||
# ---------- bail out on package-less recipes ----------
|
# ---------- bail out on package-less recipes ----------
|
||||||
if [ ! -d "${WORKDIR}/packages-split" -o ! -d ${WORKDIR}/package ]; then
|
if [ ! -d "${WORKDIR}/packages-split" -o ! -d ${WORKDIR}/package ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ---------- remove old sources ----------
|
# ---------- remove old sources ----------
|
||||||
rm -rf ${INSTANT_CROSS_PATH}/usr/src/debug/${PN}
|
rm -rf ${INSTANT_TARGET_PATH}/usr/src/debug/${PN}
|
||||||
|
|
||||||
# ---------- remove old files in manifest and manifest ----------
|
# ---------- remove old files in manifest and manifest ----------
|
||||||
if [ -f ${INSTANT_MANIFEST} ] ; then
|
if [ -f ${INSTANT_MANIFEST} ] ; then
|
||||||
echo "Old manifest ${INSTANT_MANIFEST} found - remove files..."
|
echo "Old manifest ${INSTANT_MANIFEST} found - remove files..."
|
||||||
# remove old files from sysroot
|
# remove old files from sysroot
|
||||||
for file in `cat ${INSTANT_MANIFEST}` ; do
|
for file in `cat ${INSTANT_MANIFEST}` ; do
|
||||||
if ! rm "${INSTANT_CROSS_PATH}/$file" 2> /dev/null; then
|
if ! rm "${INSTANT_TARGET_PATH}/$file" 2> /dev/null; then
|
||||||
echo "Tried to delete '${INSTANT_CROSS_PATH}/$file' but it is not there! A look into mainfest creation at '${INSTANT_MANIFEST}' might help."
|
echo "Tried to delete '${INSTANT_TARGET_PATH}/$file' but it is not there! A look into mainfest creation at '${INSTANT_MANIFEST}' might help."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# remove old manifest
|
# remove old manifest
|
||||||
@@ -85,12 +85,12 @@ do_copy_to_cross_sysroot() {
|
|||||||
|
|
||||||
# ---------- hard link source code files ----------
|
# ---------- hard link source code files ----------
|
||||||
if [ -d ${WORKDIR}/package/usr/src/debug/${PN} ] ; then
|
if [ -d ${WORKDIR}/package/usr/src/debug/${PN} ] ; then
|
||||||
mkdir -p ${INSTANT_CROSS_PATH}/usr/src/debug/${PN}
|
mkdir -p ${INSTANT_TARGET_PATH}/usr/src/debug/${PN}
|
||||||
hardlinkdir ${WORKDIR}/package/usr/src/debug/${PN} ${INSTANT_CROSS_PATH}/usr/src/debug/${PN}
|
hardlinkdir ${WORKDIR}/package/usr/src/debug/${PN} ${INSTANT_TARGET_PATH}/usr/src/debug/${PN}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ---------- names of binaries and debuginfo -> manifest ----------
|
# ---------- names of binaries and debuginfo -> manifest ----------
|
||||||
mkdir -p ${INSTANT_CROSS_PATH}/manifests
|
mkdir -p ${INSTANT_TARGET_PATH}/manifests
|
||||||
# get path to library-link once only
|
# get path to library-link once only
|
||||||
if [ "${PN}" = "glibc-locale" ] ; then
|
if [ "${PN}" = "glibc-locale" ] ; then
|
||||||
PACK_SPLIT_LIB_LINK_SEARCH_PATH=`find ${WORKDIR}/packages-split -mindepth 1 -maxdepth 1 -type d ! -name '*-dbg' ! -name '*-dev' ! -name '*-staticdev' ! -name '*-doc' ! -name 'glibc*-localedata-*' ! -name 'glibc-charmap-*' ! -name 'locale-base-*'`
|
PACK_SPLIT_LIB_LINK_SEARCH_PATH=`find ${WORKDIR}/packages-split -mindepth 1 -maxdepth 1 -type d ! -name '*-dbg' ! -name '*-dev' ! -name '*-staticdev' ! -name '*-doc' ! -name 'glibc*-localedata-*' ! -name 'glibc-charmap-*' ! -name 'locale-base-*'`
|
||||||
@@ -159,17 +159,17 @@ do_copy_to_cross_sysroot() {
|
|||||||
for file in `cat ${INSTANT_MANIFEST}` ; do
|
for file in `cat ${INSTANT_MANIFEST}` ; do
|
||||||
file=`echo $file | cut -c 2-`
|
file=`echo $file | cut -c 2-`
|
||||||
if [ -e $file ] ; then
|
if [ -e $file ] ; then
|
||||||
echo -n $file | cpio --null -pdlu ${INSTANT_CROSS_PATH} > /dev/null 2>&1
|
echo -n $file | cpio --null -pdlu ${INSTANT_TARGET_PATH} > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
addtask copy_to_cross_sysroot after do_package before do_build
|
addtask copy_to_target_sysroot after do_package before do_build
|
||||||
|
|
||||||
# same as do package
|
# same as do package
|
||||||
do_copy_to_cross_sysroot[vardeps] = "${PACKAGEBUILDPKGD} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}"
|
do_copy_to_target_sysroot[vardeps] = "${PACKAGEBUILDPKGD} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}"
|
||||||
|
|
||||||
do_copy_to_cross_sysroot[stamp-extra-info] = "${MACHINE_ARCH}"
|
do_copy_to_target_sysroot[stamp-extra-info] = "${MACHINE_ARCH}"
|
||||||
|
|
||||||
do_build[recrdeptask] += "do_copy_to_cross_sysroot"
|
do_build[recrdeptask] += "do_copy_to_target_sysroot"
|
||||||
28
classes/instant-toolchain-target.bbclass
Normal file
28
classes/instant-toolchain-target.bbclass
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# class for instant toolchain
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
inherit instant-paths
|
||||||
|
|
||||||
|
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||||
|
|
||||||
|
do_compile[postfuncs] += "${COMPILE_POST_TARGET}"
|
||||||
|
COMPILE_POST_TARGET = ""
|
||||||
|
COMPILE_POST_TARGET_class-target = "instant_compile_target"
|
||||||
|
|
||||||
|
INSTANTPOPULATE_TOOLCHAIN_VARS = " \
|
||||||
|
CC \
|
||||||
|
CFLAGS \
|
||||||
|
"
|
||||||
|
|
||||||
|
python instant_compile_target () {
|
||||||
|
# create sourceable script that exports variables necessary
|
||||||
|
for envvar in d.getVar('INSTANTPOPULATE_TOOLCHAIN_VARS').split():
|
||||||
|
content = d.getVar(envvar).strip()
|
||||||
|
line = 'export %s="%s"' % (envvar, content)
|
||||||
|
line = line.replace(d.getVar('DEBUG_PREFIX_MAP'),'-fdebug-prefix-map=%s= -fdebug-prefix-map=%s=' % (d.getVar('INSTANT_TARGET_PATH'), d.getVar('INSTANT_NATIVE_PATH') ))
|
||||||
|
line = line.replace(d.getVar('STAGING_DIR_NATIVE'),d.getVar('INSTANT_NATIVE_PATH'))
|
||||||
|
line = line.replace(d.getVar('STAGING_DIR_HOST'),d.getVar('INSTANT_TARGET_PATH'))
|
||||||
|
print(line)
|
||||||
|
print(d.getVar('DEBUG_PREFIX_MAP'))
|
||||||
|
}
|
||||||
@@ -2,21 +2,19 @@ SUMMARY = "Prepare environment for cross building/debugging with QtCreator"
|
|||||||
LICENSE = "MIT"
|
LICENSE = "MIT"
|
||||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
|
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
|
||||||
|
|
||||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
inherit qmake5_base instant-toolchain-target
|
||||||
|
|
||||||
inherit qmake5_base instant-paths
|
|
||||||
|
|
||||||
DEPENDS = "qtbase"
|
DEPENDS = "qtbase"
|
||||||
|
|
||||||
deltask do_prepare_recipe_sysroot
|
deltask do_prepare_recipe_sysroot
|
||||||
|
|
||||||
do_install[depends] = "qtbase:do_copy_to_cross_sysroot"
|
do_install[depends] = "qtbase:do_copy_to_target_sysroot"
|
||||||
do_install[nostamp] = "1"
|
do_install[nostamp] = "1"
|
||||||
|
|
||||||
do_install() {
|
do_install() {
|
||||||
# inject qt.conf into native sysroot
|
# inject qt.conf into native sysroot
|
||||||
qtconf=`basename ${OE_QMAKE_QTCONF_PATH}`
|
qtconf=`basename ${OE_QMAKE_QTCONF_PATH}`
|
||||||
sourcepath=${INSTANT_CROSS_PATH}${OE_QMAKE_PATH_HOST_BINS}
|
sourcepath=${INSTANT_TARGET_PATH}${OE_QMAKE_PATH_HOST_BINS}
|
||||||
targetpath=${INSTANT_NATIVE_PATH}${OE_QMAKE_PATH_HOST_BINS}
|
targetpath=${INSTANT_NATIVE_PATH}${OE_QMAKE_PATH_HOST_BINS}
|
||||||
# be sure we remove old link (if any...)
|
# be sure we remove old link (if any...)
|
||||||
rm -f $targetpath/$qtconf
|
rm -f $targetpath/$qtconf
|
||||||
@@ -25,6 +23,8 @@ do_install() {
|
|||||||
|
|
||||||
ALLOW_EMPTY_${PN} = "1"
|
ALLOW_EMPTY_${PN} = "1"
|
||||||
|
|
||||||
|
# An image installing this requires the following packages at least for working
|
||||||
|
# instant sdk support
|
||||||
RDEPENDS_${PN} = " \
|
RDEPENDS_${PN} = " \
|
||||||
qtbase \
|
qtbase \
|
||||||
gdbserver \
|
gdbserver \
|
||||||
|
|||||||
Reference in New Issue
Block a user