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).
|
||||
|
||||
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
|
||||
usage.
|
||||
* instant-sysroot-native.bbclass: Native recipes inheriting this class
|
||||
|
||||
@@ -7,30 +7,31 @@ PACKAGECONFIG_DISTRO += " \
|
||||
|
||||
inherit instant-paths
|
||||
|
||||
do_copy_to_cross_sysroot_append() {
|
||||
do_copy_to_target_sysroot_append() {
|
||||
# ---------- qt.conf ----------
|
||||
# create
|
||||
generate_qt_config_file_paths
|
||||
|
||||
# copy to cross sysroot
|
||||
# move to target sysroot
|
||||
qtconf=`basename ${OE_QMAKE_QTCONF_PATH}`
|
||||
targetpath=${INSTANT_CROSS_PATH}${OE_QMAKE_PATH_HOST_BINS}
|
||||
cp -f "${OE_QMAKE_QTCONF_PATH}" "$targetpath"
|
||||
targetpath=${INSTANT_TARGET_PATH}${OE_QMAKE_PATH_HOST_BINS}
|
||||
rm -f "$targetpath/$qtconf"
|
||||
mv "${OE_QMAKE_QTCONF_PATH}" "$targetpath"
|
||||
echo "${OE_QMAKE_PATH_HOST_BINS}/$qtconf" >> ${INSTANT_MANIFEST}
|
||||
|
||||
# adjust to instant sysroot
|
||||
sed -i \
|
||||
-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' \
|
||||
"$targetpath/$qtconf"
|
||||
|
||||
# ---------- 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" \
|
||||
"${INSTANT_CROSS_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/"
|
||||
"${INSTANT_TARGET_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/"
|
||||
sed -i \
|
||||
-e 's:${DEBUG_PREFIX_MAP}:-fdebug-prefix-map=${INSTANT_CROSS_PATH}= -fdebug-prefix-map=${INSTANT_NATIVE_PATH}=:g' \
|
||||
"${INSTANT_CROSS_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/qmake.conf"
|
||||
-e 's:${DEBUG_PREFIX_MAP}:-fdebug-prefix-map=${INSTANT_TARGET_PATH}= -fdebug-prefix-map=${INSTANT_NATIVE_PATH}=:g' \
|
||||
"${INSTANT_TARGET_PATH}${libdir}${QT_DIR_NAME}/mkspecs/${XPLATFORM}/qmake.conf"
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# This is where instant native sysroot is installed to
|
||||
INSTANT_NATIVE_PATH = "${TMPDIR}/sysroot-instant-native"
|
||||
|
||||
# This is where instant cross sysroot is installed to
|
||||
INSTANT_CROSS_PATH = "${TMPDIR}/sysroot-instant-cross-${MACHINE_ARCH}"
|
||||
# This is where instant target sysroot is installed to
|
||||
INSTANT_TARGET_PATH = "${TMPDIR}/sysroot-instant-target-${MACHINE_ARCH}"
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
# To achieve, a debug sysroot is build with low cost:
|
||||
#
|
||||
# * 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:
|
||||
# 'INHERIT += "instant-sysroot-cross"'
|
||||
# 'INHERIT += "instant-sysroot-target"'
|
||||
# in your local.conf
|
||||
#
|
||||
# to debug by remote do:
|
||||
@@ -24,7 +24,7 @@
|
||||
# 'gdbserver :5000 /usr/bin/thunar'
|
||||
#
|
||||
# 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)
|
||||
# * in QtCreator select Menu Debug/Start Debugging/Attach to Running Debug Server
|
||||
# -> Dialog 'Start Debugger' opens
|
||||
@@ -32,8 +32,8 @@
|
||||
# The settings are kept so 1.-6. have to be done once only.
|
||||
# 1. Create a Kit by 'Add' -> further dialog opens
|
||||
# 2. Select an name for the Kit e.g 'OE'
|
||||
# 3. Set sysroot (see INSTANT_CROSS_PATH in instant-path.bbclass):
|
||||
# ${TMPDIR}/sysroot-instant-cross-${MACHINE_ARCH}
|
||||
# 3. Set sysroot (see INSTANT_TARGET_PATH in instant-path.bbclass):
|
||||
# ${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:
|
||||
# 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++'
|
||||
@@ -41,7 +41,7 @@
|
||||
# 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
|
||||
# * 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'
|
||||
# * Select 'OK'
|
||||
#
|
||||
@@ -56,27 +56,27 @@ EXTRA_IMAGEDEPENDS += "gdb-cross-${TARGET_ARCH} gdb"
|
||||
|
||||
python __anonymous () {
|
||||
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 ----------
|
||||
if [ ! -d "${WORKDIR}/packages-split" -o ! -d ${WORKDIR}/package ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ---------- 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 ----------
|
||||
if [ -f ${INSTANT_MANIFEST} ] ; then
|
||||
echo "Old manifest ${INSTANT_MANIFEST} found - remove files..."
|
||||
# remove old files from sysroot
|
||||
for file in `cat ${INSTANT_MANIFEST}` ; do
|
||||
if ! rm "${INSTANT_CROSS_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."
|
||||
if ! rm "${INSTANT_TARGET_PATH}/$file" 2> /dev/null; then
|
||||
echo "Tried to delete '${INSTANT_TARGET_PATH}/$file' but it is not there! A look into mainfest creation at '${INSTANT_MANIFEST}' might help."
|
||||
fi
|
||||
done
|
||||
# remove old manifest
|
||||
@@ -85,12 +85,12 @@ do_copy_to_cross_sysroot() {
|
||||
|
||||
# ---------- hard link source code files ----------
|
||||
if [ -d ${WORKDIR}/package/usr/src/debug/${PN} ] ; then
|
||||
mkdir -p ${INSTANT_CROSS_PATH}/usr/src/debug/${PN}
|
||||
hardlinkdir ${WORKDIR}/package/usr/src/debug/${PN} ${INSTANT_CROSS_PATH}/usr/src/debug/${PN}
|
||||
mkdir -p ${INSTANT_TARGET_PATH}/usr/src/debug/${PN}
|
||||
hardlinkdir ${WORKDIR}/package/usr/src/debug/${PN} ${INSTANT_TARGET_PATH}/usr/src/debug/${PN}
|
||||
fi
|
||||
|
||||
# ---------- 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
|
||||
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-*'`
|
||||
@@ -159,17 +159,17 @@ do_copy_to_cross_sysroot() {
|
||||
for file in `cat ${INSTANT_MANIFEST}` ; do
|
||||
file=`echo $file | cut -c 2-`
|
||||
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
|
||||
done
|
||||
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
|
||||
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"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
inherit qmake5_base instant-paths
|
||||
inherit qmake5_base instant-toolchain-target
|
||||
|
||||
DEPENDS = "qtbase"
|
||||
|
||||
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() {
|
||||
# inject qt.conf into native sysroot
|
||||
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}
|
||||
# be sure we remove old link (if any...)
|
||||
rm -f $targetpath/$qtconf
|
||||
@@ -25,6 +23,8 @@ do_install() {
|
||||
|
||||
ALLOW_EMPTY_${PN} = "1"
|
||||
|
||||
# An image installing this requires the following packages at least for working
|
||||
# instant sdk support
|
||||
RDEPENDS_${PN} = " \
|
||||
qtbase \
|
||||
gdbserver \
|
||||
|
||||
Reference in New Issue
Block a user