* [PATCH v2 0/7] Add ISAR SDK support
@ 2018-06-22 12:40 Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 1/7] isar-bootstrap: Move common part to include Maxim Yu. Osipov
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-22 12:40 UTC (permalink / raw)
To: isar-users
Hello everybody,
Changes in v2:
- Patches corrected after review
- Improved isar-bootstrap separation into host and target parts.
- Renamed 'do_isar_task' to 'do_populate_sdk' to harmonize with Deby
Motivation
Building applications for targets in ISAR takes a lot of time as they are built under QEMU.
SDK providing crossbuild environment will help to solve this problem.
Approach
Create SDK root file system for host with installed cross-toolchain for target architecture and ability to install already prebuilt
target binary artifacts. Developer chroots to sdk rootfs and develops applications for target platform.
Solution
User manually triggers creation of SDK root filesystem for his target platform by launching the task `do_populate_sdk` for target image, f.e.
`bitbake -c do_populate_sdk multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
The resulting SDK rootfs is located under `tmp/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}/rootfs`.
SDK rootfs directory `/isar-apt` contains the copy of isar-apt repo with locally prebuilt target debian packages (for <HOST_DISTRO>).
One may chroot to SDK and install required target packages with the help of `apt-get install <package_name>:<DISTRO_ARCH>` command.
Limitation
Only Debian Stretch for SDK root filesystem is supported as only Stretch provides crossbuild environment by default.
(Debian Jessie requires some additional preconfiguration steps see https://wiki.debian.org/CrossToolchains#Installation for details).
Example
- Trigger creation of SDK root filesystem
bitbake -c do_populate_sdk multiconfig:qemuarm-stretch:isar-image-base
- Mount the following directories in chroot by passing resulting rootfs as an argument to the script `mount_chroot.sh`:
cat scripts/mount_chroot.sh
#!/bin/sh
set -e
mount /tmp $1/tmp -o bind
mount proc $1/proc -t proc -o nosuid,noexec,nodev
mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
$ sudo scripts/mount_chroot.sh ../build/tmp/work/debian-stretch-armhf/sdkchroot-debian-stretch-amd64/rootfs
- chroot to isar SDK rootfs:
$ sudo chroot ../build/tmp/work/debian-stretch-armhf/sdkchroot-debian-stretch-amd64/rootfs
- Check that cross toolchains are installed
:~# dpkg -l | grep crossbuild-essential-armhf
ii crossbuild-essential-armhf 12.3 all Informational list of cross-build-essential packages
- Install needed prebuilt target packages.
:~# apt-get install libhello-dev:armhf
- Check the contents of the installed target package
:~# dpkg -L libhello-dev
/.
/usr
/usr/include
/usr/include/hello.h
/usr/lib
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf/libhello.a
/usr/lib/arm-linux-gnueabihf/libhello.la
/usr/share
/usr/share/doc
/usr/share/doc/libhello-dev
/usr/share/doc/libhello-dev/changelog.gz
/usr/share/doc/libhello-dev/copyright
~#
Kind regards,
Maxim.
Alexander Smirnov (2):
isar-bootstrap: Move common part to include.
isar-bootstrap: Add host architecture support
Maxim Yu. Osipov (5):
isar-bootstrap-helper: Add option --copyisarapt to
setup_root_file_system()
sdkchroot: Added recipe-devel to create SDK root filesystem
meta/class/image: Add populate_sdk task to trigger SDK rootfs creation
scripts: Add helper scripts to mount/umount chroot directory
doc: Add description of ISAR SDK root filesystem creation
doc/user_manual.md | 95 ++++++++++++++++++++++
meta/classes/image.bbclass | 17 +++-
meta/classes/isar-bootstrap-helper.bbclass | 27 +++++-
.../isar-bootstrap/isar-bootstrap-host.bb | 75 +++++++++++++++++
.../isar-bootstrap/isar-bootstrap-target.bb | 74 +++++++++++++++++
.../{isar-bootstrap.bb => isar-bootstrap.inc} | 83 +++----------------
meta/recipes-devtools/buildchroot/buildchroot.bb | 2 +-
meta/recipes-devtools/isar-apt/isar-apt-host.bb | 31 +++++++
.../sdkchroot/files/configscript.sh | 14 ++++
meta/recipes-devtools/sdkchroot/sdkchroot.bb | 47 +++++++++++
scripts/mount_chroot.sh | 10 +++
scripts/umount_chroot.sh | 8 ++
12 files changed, 408 insertions(+), 75 deletions(-)
create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb
create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
rename meta/recipes-core/isar-bootstrap/{isar-bootstrap.bb => isar-bootstrap.inc} (68%)
create mode 100644 meta/recipes-devtools/isar-apt/isar-apt-host.bb
create mode 100644 meta/recipes-devtools/sdkchroot/files/configscript.sh
create mode 100644 meta/recipes-devtools/sdkchroot/sdkchroot.bb
create mode 100755 scripts/mount_chroot.sh
create mode 100755 scripts/umount_chroot.sh
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/7] isar-bootstrap: Move common part to include.
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
@ 2018-06-22 12:40 ` Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 2/7] isar-bootstrap: Add host architecture support Maxim Yu. Osipov
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-22 12:40 UTC (permalink / raw)
To: isar-users
From: Alexander Smirnov <asmirnov@ilbers.de>
Eventually there should be two bootstraps: host and target. This
patch derives the acrchitecture independent part of original isar-bootstrap
recipe and puts it in header file, the rest is moved to the target part.
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
meta/classes/image.bbclass | 2 +-
.../isar-bootstrap/isar-bootstrap-target.bb | 74 +++++++++++++++++++
.../{isar-bootstrap.bb => isar-bootstrap.inc} | 83 ++++------------------
meta/recipes-devtools/buildchroot/buildchroot.bb | 2 +-
4 files changed, 88 insertions(+), 73 deletions(-)
create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
rename meta/recipes-core/isar-bootstrap/{isar-bootstrap.bb => isar-bootstrap.inc} (68%)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 3bdcb2f..4738cb8 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -47,7 +47,7 @@ INITRD_IMAGE ?= "${@get_image_name(d, 'initrd.img')[1]}"
inherit ${IMAGE_TYPE}
do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
-do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap:do_deploy"
+do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_deploy"
do_rootfs() {
die "No root filesystem function defined, please implement in your recipe"
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
new file mode 100644
index 0000000..77b5d8d
--- /dev/null
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
@@ -0,0 +1,74 @@
+# Minimal target Debian root file system
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+Description = "Minimal target Debian root file system"
+
+WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
+
+include isar-bootstrap.inc
+
+do_generate_keyring[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+
+do_apt_config_prepare[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_apt_config_prepare[dirs] = "${WORKDIR}"
+do_apt_config_prepare[vardeps] += "\
+ APTPREFS \
+ DISTRO_APT_PREFERENCES \
+ DEBDISTRONAME \
+ APTSRCS \
+ DISTRO_APT_SOURCES \
+ "
+python do_apt_config_prepare() {
+ apt_preferences_out = d.getVar("APTPREFS", True)
+ apt_preferences_list = (d.getVar("DISTRO_APT_PREFERENCES", True) or ""
+ ).split()
+ aggregate_files(d, apt_preferences_list, apt_preferences_out)
+
+ apt_sources_out = d.getVar("APTSRCS", True)
+ apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split()
+
+ aggregate_aptsources_list(d, apt_sources_list, apt_sources_out)
+}
+addtask apt_config_prepare before do_build after do_unpack
+
+do_apt_config_install[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+
+do_bootstrap[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_bootstrap[vardeps] += "DISTRO_APT_SOURCES"
+do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS"
+do_bootstrap() {
+ if [ -e "${ROOTFSDIR}" ]; then
+ sudo umount -l "${ROOTFSDIR}/dev" || true
+ sudo umount -l "${ROOTFSDIR}/proc" || true
+ sudo rm -rf "${ROOTFSDIR}"
+ fi
+ E="${@bb.utils.export_proxies(d)}"
+ sudo -E "${DEBOOTSTRAP}" --verbose \
+ --variant=minbase \
+ --arch="${DISTRO_ARCH}" \
+ --include=locales \
+ ${@get_distro_components_argument(d, False)} \
+ ${DEBOOTSTRAP_KEYRING} \
+ "${@get_distro_suite(d, False)}" \
+ "${ROOTFSDIR}" \
+ "${@get_distro_source(d, False)}"
+}
+addtask bootstrap before do_build after do_generate_keyring
+
+do_deploy[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
+do_deploy() {
+ ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}"
+}
+addtask deploy before do_build after do_apt_update
+
+do_apt_update[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+
+CLEANFUNCS = "clean_deploy"
+clean_deploy() {
+ rm -f "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${DISTRO_ARCH}"
+}
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
similarity index 68%
rename from meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
rename to meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 497a4f4..18ec72f 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -5,8 +5,6 @@
#
# SPDX-License-Identifier: MIT
-Description = "Minimal debian root file system"
-
LICENSE = "gpl-2.0"
LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
FILESPATH_prepend := "${THISDIR}/files:"
@@ -17,7 +15,6 @@ SRC_URI = " \
file://chroot-setup.sh"
PV = "1.0"
-WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
DEBOOTSTRAP ?= "qemu-debootstrap"
ROOTFSDIR = "${WORKDIR}/rootfs"
APTPREFS = "${WORKDIR}/apt-preferences"
@@ -111,8 +108,11 @@ def aggregate_aptsources_list(d, file_list, file_out):
out_fd.write("\n".encode())
out_fd.write("\n".encode())
-def get_distro_primary_source_entry(d):
- apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split()
+def get_distro_primary_source_entry(d, is_host=False):
+ if is_host:
+ apt_sources_list = (d.getVar("HOST_DISTRO_APT_SOURCES", True) or "").split()
+ else:
+ apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split()
for entry in apt_sources_list:
entry_real = bb.parse.resolve_file(entry, d)
with open(entry_real, "r") as in_fd:
@@ -124,20 +124,19 @@ def get_distro_primary_source_entry(d):
return parsed[2:]
return ["", "", ""]
-def get_distro_source(d):
- return get_distro_primary_source_entry(d)[0]
+def get_distro_source(d, is_host):
+ return get_distro_primary_source_entry(d, is_host)[0]
-def get_distro_suite(d):
- return get_distro_primary_source_entry(d)[1]
+def get_distro_suite(d, is_host):
+ return get_distro_primary_source_entry(d, is_host)[1]
-def get_distro_components_argument(d):
- components = get_distro_primary_source_entry(d)[2]
+def get_distro_components_argument(d, is_host):
+ components = get_distro_primary_source_entry(d, is_host)[2]
if components and components.strip():
return "--components=%s" % ",".join(components.split())
else:
return ""
-do_generate_keyring[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
do_generate_keyring[dirs] = "${WORKDIR}"
do_generate_keyring[vardeps] += "DISTRO_APT_KEYS"
do_generate_keyring() {
@@ -150,50 +149,6 @@ do_generate_keyring() {
}
addtask generate_keyring before do_build after do_unpack
-do_apt_config_prepare[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-do_apt_config_prepare[dirs] = "${WORKDIR}"
-do_apt_config_prepare[vardeps] += "\
- APTPREFS \
- DISTRO_APT_PREFERENCES \
- DEBDISTRONAME \
- APTSRCS \
- DISTRO_APT_SOURCES \
- "
-python do_apt_config_prepare() {
- apt_preferences_out = d.getVar("APTPREFS", True)
- apt_preferences_list = (d.getVar("DISTRO_APT_PREFERENCES", True) or ""
- ).split()
- aggregate_files(d, apt_preferences_list, apt_preferences_out)
-
- apt_sources_out = d.getVar("APTSRCS", True)
- apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split()
-
- aggregate_aptsources_list(d, apt_sources_list, apt_sources_out)
-}
-addtask apt_config_prepare before do_build after do_unpack
-
-do_bootstrap[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-do_bootstrap[vardeps] += "DISTRO_APT_SOURCES"
-do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS"
-do_bootstrap() {
- if [ -e "${ROOTFSDIR}" ]; then
- sudo umount -l "${ROOTFSDIR}/dev" || true
- sudo umount -l "${ROOTFSDIR}/proc" || true
- sudo rm -rf "${ROOTFSDIR}"
- fi
- E="${@bb.utils.export_proxies(d)}"
- sudo -E "${DEBOOTSTRAP}" --verbose \
- --variant=minbase \
- --arch="${DISTRO_ARCH}" \
- --include=locales \
- ${@get_distro_components_argument(d)} \
- ${DEBOOTSTRAP_KEYRING} \
- "${@get_distro_suite(d)}" \
- "${ROOTFSDIR}" \
- "${@get_distro_source(d)}"
-}
-addtask bootstrap before do_build after do_generate_keyring
-
do_set_locale() {
sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale"
@@ -213,7 +168,6 @@ def get_host_release():
rel = platform.release()
return rel
-do_apt_config_install[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
do_apt_config_install() {
sudo mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d"
sudo install -v -m644 "${APTPREFS}" \
@@ -226,14 +180,13 @@ do_apt_config_install() {
sudo install -v -m644 "${WORKDIR}/isar-apt.conf" \
"${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf"
- if [ "${@get_distro_suite(d)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then
+ if [ "${@get_distro_suite(d, True)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then
sudo install -v -m644 "${WORKDIR}/isar-apt-fallback.conf" \
"${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf"
fi
}
addtask apt_config_install before do_build after do_bootstrap do_apt_config_prepare
-do_apt_update[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
do_apt_update() {
sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
sudo mount -t proc none ${ROOTFSDIR}/proc
@@ -245,15 +198,3 @@ do_apt_update() {
-o Debug::pkgProblemResolver=yes
}
addtask apt_update before do_build after do_apt_config_install do_set_locale do_setup_chroot
-
-do_deploy[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
-do_deploy() {
- ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${DISTRO_ARCH}"
-}
-addtask deploy before do_build after do_apt_update
-
-CLEANFUNCS = "clean_deploy"
-clean_deploy() {
- rm -f "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${DISTRO_ARCH}"
-}
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 2ed5cf2..e0d2302 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -66,7 +66,7 @@ do_build[root_cleandirs] = "${BUILDCHROOT_DIR} \
${BUILDCHROOT_DIR}/isar-apt \
${BUILDCHROOT_DIR}/downloads \
${BUILDCHROOT_DIR}/home/builder"
-do_build[depends] = "isar-apt:do_cache_config isar-bootstrap:do_deploy"
+do_build[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_deploy"
do_build() {
setup_root_file_system "${BUILDCHROOT_DIR}" ${BUILDCHROOT_PREINSTALL}
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/7] isar-bootstrap: Add host architecture support
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 1/7] isar-bootstrap: Move common part to include Maxim Yu. Osipov
@ 2018-06-22 12:40 ` Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 3/7] isar-bootstrap-helper: Add option --copyisarapt to setup_root_file_system() Maxim Yu. Osipov
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-22 12:40 UTC (permalink / raw)
To: isar-users
From: Alexander Smirnov <asmirnov@ilbers.de>
Add HOST_* definitions and recipe to generate
ISAR boostrap with the host architecture.
Add corresponding options to setup_root_file_system().
Generate reprepro config for host distro
if it doesn't exist.
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
meta/classes/isar-bootstrap-helper.bbclass | 22 ++++++-
.../isar-bootstrap/isar-bootstrap-host.bb | 75 ++++++++++++++++++++++
meta/recipes-devtools/isar-apt/isar-apt-host.bb | 31 +++++++++
3 files changed, 126 insertions(+), 2 deletions(-)
create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb
create mode 100644 meta/recipes-devtools/isar-apt/isar-apt-host.bb
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 3c10fc7..bc23ad2 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -7,6 +7,18 @@
IMAGE_TRANSIENT_PACKAGES ??= ""
+def get_deb_host_arch():
+ import subprocess
+ arch = subprocess.check_output(['dpkg-architecture', '-q', 'DEB_HOST_ARCH'], universal_newlines=True)
+ return str.splitlines(arch)[0]
+
+#Debian Distribution for SDK host
+HOST_DISTRO ?= "debian-stretch"
+#Determine SDK host architecture if not explicitly set
+HOST_ARCH ?= "${@get_deb_host_arch()}"
+
+HOST_DISTRO_APT_SOURCES += "conf/distro/${HOST_DISTRO}.list"
+
def reverse_bb_array(d, varname):
array = d.getVar(varname, True)
if array is None:
@@ -14,13 +26,18 @@ def reverse_bb_array(d, varname):
array = reversed(array.split())
return " ".join(i for i in array)
+
setup_root_file_system() {
CLEAN=""
FSTAB=""
+ ROOTFS_ARCH="${DISTRO_ARCH}"
+ ROOTFS_DISTRO="${DISTRO}"
while true; do
case "$1" in
--clean) CLEAN=1 ;;
--fstab) FSTAB=$2; shift ;;
+ --host-arch) ROOTFS_ARCH=${HOST_ARCH} ;;
+ --host-distro) ROOTFS_DISTRO=${HOST_DISTRO} ;;
-*) bbfatal "$0: invalid option specified: $1" ;;
*) break ;;
esac
@@ -33,7 +50,7 @@ setup_root_file_system() {
CLEAN_FILES="${ROOTFSDIR}/etc/hostname ${ROOTFSDIR}/etc/resolv.conf"
sudo cp -Trpfx \
- "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/" \
+ "${DEPLOY_DIR_IMAGE}/isar-bootstrap-$ROOTFS_DISTRO-$ROOTFS_ARCH/" \
"$ROOTFSDIR"
[ -n "${FSTAB}" ] && cat ${FSTAB} | sudo tee "$ROOTFSDIR/etc/fstab"
@@ -43,7 +60,8 @@ setup_root_file_system() {
echo "Package: *\nPin: release n=${DEBDISTRONAME}\nPin-Priority: 1000" | \
sudo tee "$ROOTFSDIR/etc/apt/preferences.d/isar" >/dev/null
- sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} $ROOTFSDIR/isar-apt
+ sudo mount --bind ${DEPLOY_DIR_APT}/${ROOTFS_DISTRO} $ROOTFSDIR/isar-apt
+
sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
sudo mount -t proc none $ROOTFSDIR/proc
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb
new file mode 100644
index 0000000..cca0984
--- /dev/null
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb
@@ -0,0 +1,75 @@
+# Minimal host Debian root file system
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+Description = "Minimal host Debian root file system"
+
+WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}-${HOST_DISTRO}-${HOST_ARCH}"
+
+include isar-bootstrap.inc
+inherit isar-bootstrap-helper
+
+do_generate_keyring[stamp-extra-info] = "${HOST_DISTRO}-${HOST_ARCH}"
+
+do_apt_config_prepare[stamp-extra-info] = "${HOST_DISTRO}-${HOST_ARCH}"
+do_apt_config_prepare[dirs] = "${WORKDIR}"
+do_apt_config_prepare[vardeps] += "\
+ APTPREFS \
+ HOST_DISTRO_APT_PREFERENCES \
+ DEBDISTRONAME \
+ APTSRCS \
+ HOST_DISTRO_APT_SOURCES \
+ "
+python do_apt_config_prepare() {
+ apt_preferences_out = d.getVar("APTPREFS", True)
+ apt_preferences_list = (d.getVar("HOST_DISTRO_APT_PREFERENCES", True) or ""
+ ).split()
+ aggregate_files(d, apt_preferences_list, apt_preferences_out)
+
+ apt_sources_out = d.getVar("APTSRCS", True)
+ apt_sources_list = (d.getVar("HOST_DISTRO_APT_SOURCES", True) or "").split()
+
+ aggregate_aptsources_list(d, apt_sources_list, apt_sources_out)
+}
+addtask apt_config_prepare before do_build after do_unpack
+
+do_apt_config_install[stamp-extra-info] = "${HOST_DISTRO}-${HOST_ARCH}"
+
+
+do_bootstrap[stamp-extra-info] = "${HOST_DISTRO}-${HOST_ARCH}"
+do_bootstrap[vardeps] += "HOST_DISTRO_APT_SOURCES"
+do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS"
+do_bootstrap() {
+ if [ -e "${ROOTFSDIR}" ]; then
+ sudo umount -l "${ROOTFSDIR}/dev" || true
+ sudo umount -l "${ROOTFSDIR}/proc" || true
+ sudo rm -rf "${ROOTFSDIR}"
+ fi
+ E="${@bb.utils.export_proxies(d)}"
+ sudo -E "${DEBOOTSTRAP}" --verbose \
+ --variant=minbase \
+ --include=locales \
+ ${@get_distro_components_argument(d, True)} \
+ ${DEBOOTSTRAP_KEYRING} \
+ "${@get_distro_suite(d, True)}" \
+ "${ROOTFSDIR}" \
+ "${@get_distro_source(d, True)}"
+}
+addtask bootstrap before do_build after do_generate_keyring
+
+do_deploy[stamp-extra-info] = "${HOST_DISTRO}-${HOST_ARCH}"
+do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
+do_deploy() {
+ ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${HOST_DISTRO}-${HOST_ARCH}"
+}
+addtask deploy before do_build after do_apt_update
+
+do_apt_update[stamp-extra-info] = "${HOST_DISTRO}-${HOST_ARCH}"
+
+CLEANFUNCS = "clean_deploy"
+clean_deploy() {
+ rm -f "${DEPLOY_DIR_IMAGE}/isar-bootstrap}-${HOST_DISTRO}-${HOST_ARCH}"
+}
diff --git a/meta/recipes-devtools/isar-apt/isar-apt-host.bb b/meta/recipes-devtools/isar-apt/isar-apt-host.bb
new file mode 100644
index 0000000..0cf5ce1
--- /dev/null
+++ b/meta/recipes-devtools/isar-apt/isar-apt-host.bb
@@ -0,0 +1,31 @@
+# This software is a part of ISAR.
+# Copyright (C) 2015-2018 ilbers GmbH
+
+inherit isar-bootstrap-helper
+
+SRC_URI = "file://distributions.in"
+
+CACHE_CONF_DIR = "${DEPLOY_DIR_APT}/${HOST_DISTRO}/conf"
+do_cache_config[dirs] = "${CACHE_CONF_DIR}"
+do_cache_config[stamp-extra-info] = "${HOST_DISTRO}"
+do_cache_config[lockfiles] = "${DEPLOY_DIR_APT}/isar.lock"
+
+# Generate reprepro config for current host distro if it doesn't exist. Once it's
+# generated, this task should do nothing.
+do_cache_config() {
+ if [ ! -e "${CACHE_CONF_DIR}/distributions" ]; then
+ sed -e "s#{DISTRO_NAME}#"${DEBDISTRONAME}"#g" \
+ ${WORKDIR}/distributions.in > ${CACHE_CONF_DIR}/distributions
+ fi
+
+ path_cache="${DEPLOY_DIR_APT}/${HOST_DISTRO}"
+ path_databases="${DEPLOY_DIR_DB}/${HOST_DISTRO}"
+
+ if [ ! -d "${path_databases}" ]; then
+ reprepro -b ${path_cache} \
+ --dbdir ${path_databases} \
+ export ${DEBDISTRONAME}
+ fi
+}
+
+addtask cache_config after do_unpack
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/7] isar-bootstrap-helper: Add option --copyisarapt to setup_root_file_system()
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 1/7] isar-bootstrap: Move common part to include Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 2/7] isar-bootstrap: Add host architecture support Maxim Yu. Osipov
@ 2018-06-22 12:40 ` Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 4/7] sdkchroot: Added recipe-devel to create SDK root filesystem Maxim Yu. Osipov
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-22 12:40 UTC (permalink / raw)
To: isar-users
Add the option of copying isar-apt repo to rootfs instead of mounting it.
Signed-off-by: Maxim Osipov <mosipov@ilbers.de>
---
meta/classes/isar-bootstrap-helper.bbclass | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index bc23ad2..9a3f710 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -29,12 +29,14 @@ def reverse_bb_array(d, varname):
setup_root_file_system() {
CLEAN=""
+ COPYISARAPT=""
FSTAB=""
ROOTFS_ARCH="${DISTRO_ARCH}"
ROOTFS_DISTRO="${DISTRO}"
while true; do
case "$1" in
--clean) CLEAN=1 ;;
+ --copyisarapt) COPYISARAPT=1 ;;
--fstab) FSTAB=$2; shift ;;
--host-arch) ROOTFS_ARCH=${HOST_ARCH} ;;
--host-distro) ROOTFS_DISTRO=${HOST_DISTRO} ;;
@@ -60,8 +62,11 @@ setup_root_file_system() {
echo "Package: *\nPin: release n=${DEBDISTRONAME}\nPin-Priority: 1000" | \
sudo tee "$ROOTFSDIR/etc/apt/preferences.d/isar" >/dev/null
- sudo mount --bind ${DEPLOY_DIR_APT}/${ROOTFS_DISTRO} $ROOTFSDIR/isar-apt
-
+ if [ ${COPYISARAPT} ]; then
+ sudo cp -Trpfx ${DEPLOY_DIR_APT}/${ROOTFS_DISTRO} $ROOTFSDIR/isar-apt
+ else
+ sudo mount --bind ${DEPLOY_DIR_APT}/${ROOTFS_DISTRO} $ROOTFSDIR/isar-apt
+ fi
sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
sudo mount -t proc none $ROOTFSDIR/proc
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 4/7] sdkchroot: Added recipe-devel to create SDK root filesystem
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
` (2 preceding siblings ...)
2018-06-22 12:40 ` [PATCH v2 3/7] isar-bootstrap-helper: Add option --copyisarapt to setup_root_file_system() Maxim Yu. Osipov
@ 2018-06-22 12:40 ` Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 5/7] meta/class/image: Add populate_sdk task to trigger SDK rootfs creation Maxim Yu. Osipov
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-22 12:40 UTC (permalink / raw)
To: isar-users
Building applications for targets in ISAR takes a lot of time as
they are built under QEMU. SDK providing crossbuild environment
will help to solve this problem.
Create SDK root file system for host with installed cross-toolchain for
target architecture and ability to install already prebuilt target binary
artifacts. Developer chroots to sdk rootfs and develops applications
for target platform.
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
.../sdkchroot/files/configscript.sh | 14 +++++++
meta/recipes-devtools/sdkchroot/sdkchroot.bb | 47 ++++++++++++++++++++++
2 files changed, 61 insertions(+)
create mode 100644 meta/recipes-devtools/sdkchroot/files/configscript.sh
create mode 100644 meta/recipes-devtools/sdkchroot/sdkchroot.bb
diff --git a/meta/recipes-devtools/sdkchroot/files/configscript.sh b/meta/recipes-devtools/sdkchroot/files/configscript.sh
new file mode 100644
index 0000000..62c1cf0
--- /dev/null
+++ b/meta/recipes-devtools/sdkchroot/files/configscript.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2018 ilbers GmbH
+
+set -e
+
+debconf-set-selections <<END
+locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
+locales locales/default_environment_locale select en_US.UTF-8
+END
+
+dpkg --add-architecture $1
+apt-get update --yes -o Debug::pkgProblemResolver=yes
diff --git a/meta/recipes-devtools/sdkchroot/sdkchroot.bb b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
new file mode 100644
index 0000000..70aa4ce
--- /dev/null
+++ b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
@@ -0,0 +1,47 @@
+# SDK Root filesystem
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2018 ilbers GmbH
+
+DESCRIPTION = "Isar SDK Root filesystem"
+
+LICENSE = "gpl-2.0"
+LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
+
+SRC_URI = "file://configscript.sh"
+PV = "0.1"
+
+inherit isar-bootstrap-helper
+
+SDKCHROOT_PREINSTALL := "crossbuild-essential-${DISTRO_ARCH} \
+ debhelper \
+ autotools-dev \
+ dpkg \
+ locales \
+ docbook-to-man \
+ apt \
+ automake \
+ devscripts \
+ equivs"
+
+WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}-${HOST_DISTRO}-${HOST_ARCH}"
+S = "${WORKDIR}/rootfs"
+
+do_build[stamp-extra-info] = "${HOST_DISTRO}-${HOST_ARCH}"
+do_build[root_cleandirs] = "${S} \
+ ${S}/isar-apt"
+
+do_build[depends] = "isar-apt-host:do_cache_config isar-bootstrap-host:do_deploy"
+
+do_build() {
+
+ if [ ${HOST_DISTRO} != "debian-stretch" ]; then
+ bbfatal "SDK doesn't support ${HOST_DISTRO}"
+ fi
+
+ setup_root_file_system --copyisarapt --host-arch --host-distro "${S}" ${SDKCHROOT_PREINSTALL}
+
+ # Configure root filesystem
+ sudo install -m 755 ${WORKDIR}/configscript.sh ${S}
+ sudo chroot ${S} /configscript.sh ${DISTRO_ARCH}
+}
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 5/7] meta/class/image: Add populate_sdk task to trigger SDK rootfs creation
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
` (3 preceding siblings ...)
2018-06-22 12:40 ` [PATCH v2 4/7] sdkchroot: Added recipe-devel to create SDK root filesystem Maxim Yu. Osipov
@ 2018-06-22 12:40 ` Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 6/7] scripts: Add helper scripts to mount/umount chroot directory Maxim Yu. Osipov
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-22 12:40 UTC (permalink / raw)
To: isar-users
User manually triggers creation of SDK root filesystem for target platform by
launching the task `do_populate_sdk` for target image, f.e.
`bitbake -c do_populate_sdk multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
Adding such dependency to image class is to make sure that
target packages listed in IMAGE_INSTALL are already built.
The resulting SDK rootfs is located under
`tmp/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}/rootfs`.
SDK rootfs directory `/isar-apt` contains the copy of isar-apt repo with locally
prebuilt target debian packages for <HOST_DISTRO>.
One may chroot to SDK and install required target packages with the help of
`apt-get install <package_name>:<DISTRO_ARCH>` command.
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
meta/classes/image.bbclass | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 4738cb8..1cb6ea8 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -71,3 +71,18 @@ do_copy_boot_files() {
addtask copy_boot_files before do_build after do_rootfs
do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
do_copy_boot_files[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+
+
+SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}/rootfs"
+
+do_populate_sdk() {
+ if [ ${HOST_DISTRO} != "debian-stretch" ]; then
+ bbfatal "SDK doesn't support ${HOST_DISTRO}"
+ fi
+ sudo cp -Trpfx ${DEPLOY_DIR_APT}/${HOST_DISTRO} ${SDKCHROOT_DIR}/isar-apt
+}
+
+do_populate_sdk[stamp-extra-info] = "${MACHINE}-${DISTRO}"
+do_populate_sdk[depends] = "sdkchroot:do_build"
+
+addtask populate_sdk after do_rootfs
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 6/7] scripts: Add helper scripts to mount/umount chroot directory
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
` (4 preceding siblings ...)
2018-06-22 12:40 ` [PATCH v2 5/7] meta/class/image: Add populate_sdk task to trigger SDK rootfs creation Maxim Yu. Osipov
@ 2018-06-22 12:40 ` Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 7/7] doc: Add description of ISAR SDK root filesystem creation Maxim Yu. Osipov
2018-06-29 12:57 ` [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
7 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-22 12:40 UTC (permalink / raw)
To: isar-users
Mount/umount under 'sudo' the required directories in chroot
by passing path to rootfs directory as an argument.
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
scripts/mount_chroot.sh | 10 ++++++++++
scripts/umount_chroot.sh | 8 ++++++++
2 files changed, 18 insertions(+)
create mode 100755 scripts/mount_chroot.sh
create mode 100755 scripts/umount_chroot.sh
diff --git a/scripts/mount_chroot.sh b/scripts/mount_chroot.sh
new file mode 100755
index 0000000..74f2b22
--- /dev/null
+++ b/scripts/mount_chroot.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+mount /tmp $1/tmp -o bind
+mount proc $1/proc -t proc -o nosuid,noexec,nodev
+mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
+mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
+mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
+mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
diff --git a/scripts/umount_chroot.sh b/scripts/umount_chroot.sh
new file mode 100755
index 0000000..5dc11bb
--- /dev/null
+++ b/scripts/umount_chroot.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+umount $1/tmp
+umount $1/proc
+umount $1/sys
+umount $1/dev
+umount $1/dev/pts
+umount $1/dev/shm
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 7/7] doc: Add description of ISAR SDK root filesystem creation
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
` (5 preceding siblings ...)
2018-06-22 12:40 ` [PATCH v2 6/7] scripts: Add helper scripts to mount/umount chroot directory Maxim Yu. Osipov
@ 2018-06-22 12:40 ` Maxim Yu. Osipov
2018-06-29 12:57 ` [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
7 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-22 12:40 UTC (permalink / raw)
To: isar-users
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
doc/user_manual.md | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
diff --git a/doc/user_manual.md b/doc/user_manual.md
index 9921f3a..3263bf2 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -17,6 +17,7 @@ Copyright (C) 2016-2017, ilbers GmbH
- [Add a New Image](https://github.com/ilbers/isar/blob/master/doc/user_manual.md#add-a-new-image)
- [Add a New Image Type](https://github.com/ilbers/isar/blob/master/doc/user_manual.md#add-a-new-image-type)
- [Add a Custom Application](https://github.com/ilbers/isar/blob/master/doc/user_manual.md#add-a-custom-application)
+ - [Create an ISAR SDK root filesystem](https://github.com/ilbers/isar/blob/master/doc/user_manual.md#create-an-isar-sdk-root-filesystem)
## Introduction
@@ -320,6 +321,10 @@ Some other variables include:
- `BB_NUMBER_THREADS` - The number of `bitbake` jobs that can be run in parallel. Please set this option according your host CPU cores number.
- `LOCALE_GEN` - A `\n` seperated list of `/etc/locale.gen` entries desired on the target.
- `LOCALE_DEFAULT` - The default locale used for the `LANG` and `LANGUAGE` variable in `/etc/locale`.
+ - `HOST_DISTRO` - The distro to use for SDK root filesystem (so far limited only to `debian-stretch`). This variable is optional.
+ - `HOST_ARCH` - The Debian architecture of SDK root filesystem (e.g., `amd64`). By default set to current Debian host architecture. This variable is optional.
+ - `HOST_DISTRO_APT_SOURCES` - List of apt source files for SDK root filesystem. This variable is optional.
+ - `HOST_DISTRO_APT_PREFERENCES` - List of apt preference files for SDK root filesystem. This variable is optional.
---
@@ -574,3 +579,93 @@ For the variables please have a look at the previous example, the following new
- `DEBIAN_DEPENDS` - Debian packages that the package depends on
Have a look at the `example-raw` recipe to get an idea how the `dpkg-raw` class can be used to customize your image.
+
+## Create an ISAR SDK root filesystem
+
+### Motivation
+
+Building applications for targets in ISAR takes a lot of time as they are built under QEMU.
+SDK providing crossbuild environment will help to solve this problem.
+
+### Approach
+
+Create SDK root file system for host with installed cross-toolchain for target architecture and ability to install already prebuilt
+target binary artifacts. Developer chroots to sdk rootfs and develops applications for target platform.
+
+### Solution
+
+User manually triggers creation of SDK root filesystem for his target platform by launching the task `do_populate_sdk` for target image, f.e.
+`bitbake -c do_populate_sdk multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
+
+The resulting SDK rootfs is located under `tmp/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}/rootfs`.
+SDK rootfs directory `/isar-apt` contains the copy of isar-apt repo with locally prebuilt target debian packages (for <HOST_DISTRO>).
+One may chroot to SDK and install required target packages with the help of `apt-get install <package_name>:<DISTRO_ARCH>` command.
+
+### Limitation
+
+Only Debian Stretch for SDK root filesystem is supported as only Stretch provides crossbuild environment by default.
+(Debian Jessie requires some additional preconfiguration steps see https://wiki.debian.org/CrossToolchains#Installation for details).
+
+### Example
+
+ - Trigger creation of SDK root filesystem
+
+```
+bitbake -c do_populate_sdk multiconfig:qemuarm-stretch:isar-image-base
+```
+
+ - Mount the following directories in chroot by passing resulting rootfs as an argument to the script `mount_chroot.sh`:
+
+```
+cat scripts/mount_chroot.sh
+#!/bin/sh
+
+set -e
+
+mount /tmp $1/tmp -o bind
+mount proc $1/proc -t proc -o nosuid,noexec,nodev
+mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
+mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
+mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
+mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
+
+$ sudo scripts/mount_chroot.sh ../build/tmp/work/debian-stretch-armhf/sdkchroot-debian-stretch-amd64/rootfs
+```
+
+ - chroot to isar SDK rootfs:
+
+```
+$ sudo chroot ../build/tmp/work/debian-stretch-armhf/sdkchroot-debian-stretch-amd64/rootfs
+```
+ - Check that cross toolchains are installed
+
+```
+:~# dpkg -l | grep crossbuild-essential-armhf
+ii crossbuild-essential-armhf 12.3 all Informational list of cross-build-essential packages
+```
+
+ - Install needed prebuilt target packages.
+
+```
+:~# apt-get install libhello-dev:armhf
+```
+
+ - Check the contents of the installed target package
+
+```
+:~# dpkg -L libhello-dev
+/.
+/usr
+/usr/include
+/usr/include/hello.h
+/usr/lib
+/usr/lib/arm-linux-gnueabihf
+/usr/lib/arm-linux-gnueabihf/libhello.a
+/usr/lib/arm-linux-gnueabihf/libhello.la
+/usr/share
+/usr/share/doc
+/usr/share/doc/libhello-dev
+/usr/share/doc/libhello-dev/changelog.gz
+/usr/share/doc/libhello-dev/copyright
+~#
+```
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/7] Add ISAR SDK support
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
` (6 preceding siblings ...)
2018-06-22 12:40 ` [PATCH v2 7/7] doc: Add description of ISAR SDK root filesystem creation Maxim Yu. Osipov
@ 2018-06-29 12:57 ` Maxim Yu. Osipov
7 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-29 12:57 UTC (permalink / raw)
To: isar-users
Applied to the 'next',
Maxim.
On 06/22/2018 02:40 PM, Maxim Yu. Osipov wrote:
> Hello everybody,
>
> Changes in v2:
> - Patches corrected after review
> - Improved isar-bootstrap separation into host and target parts.
> - Renamed 'do_isar_task' to 'do_populate_sdk' to harmonize with Deby
>
> Motivation
>
> Building applications for targets in ISAR takes a lot of time as they are built under QEMU.
> SDK providing crossbuild environment will help to solve this problem.
>
> Approach
>
> Create SDK root file system for host with installed cross-toolchain for target architecture and ability to install already prebuilt
> target binary artifacts. Developer chroots to sdk rootfs and develops applications for target platform.
>
> Solution
>
> User manually triggers creation of SDK root filesystem for his target platform by launching the task `do_populate_sdk` for target image, f.e.
> `bitbake -c do_populate_sdk multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
>
> The resulting SDK rootfs is located under `tmp/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}/rootfs`.
> SDK rootfs directory `/isar-apt` contains the copy of isar-apt repo with locally prebuilt target debian packages (for <HOST_DISTRO>).
> One may chroot to SDK and install required target packages with the help of `apt-get install <package_name>:<DISTRO_ARCH>` command.
>
> Limitation
>
> Only Debian Stretch for SDK root filesystem is supported as only Stretch provides crossbuild environment by default.
> (Debian Jessie requires some additional preconfiguration steps see https://wiki.debian.org/CrossToolchains#Installation for details).
>
> Example
>
> - Trigger creation of SDK root filesystem
>
> bitbake -c do_populate_sdk multiconfig:qemuarm-stretch:isar-image-base
>
> - Mount the following directories in chroot by passing resulting rootfs as an argument to the script `mount_chroot.sh`:
>
> cat scripts/mount_chroot.sh
> #!/bin/sh
>
> set -e
>
> mount /tmp $1/tmp -o bind
> mount proc $1/proc -t proc -o nosuid,noexec,nodev
> mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
> mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
> mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
> mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
>
> $ sudo scripts/mount_chroot.sh ../build/tmp/work/debian-stretch-armhf/sdkchroot-debian-stretch-amd64/rootfs
>
> - chroot to isar SDK rootfs:
>
> $ sudo chroot ../build/tmp/work/debian-stretch-armhf/sdkchroot-debian-stretch-amd64/rootfs
>
> - Check that cross toolchains are installed
>
>
> :~# dpkg -l | grep crossbuild-essential-armhf
> ii crossbuild-essential-armhf 12.3 all Informational list of cross-build-essential packages
>
>
> - Install needed prebuilt target packages.
>
>
> :~# apt-get install libhello-dev:armhf
>
>
> - Check the contents of the installed target package
>
> :~# dpkg -L libhello-dev
> /.
> /usr
> /usr/include
> /usr/include/hello.h
> /usr/lib
> /usr/lib/arm-linux-gnueabihf
> /usr/lib/arm-linux-gnueabihf/libhello.a
> /usr/lib/arm-linux-gnueabihf/libhello.la
> /usr/share
> /usr/share/doc
> /usr/share/doc/libhello-dev
> /usr/share/doc/libhello-dev/changelog.gz
> /usr/share/doc/libhello-dev/copyright
> ~#
>
> Kind regards,
> Maxim.
>
>
>
> Alexander Smirnov (2):
> isar-bootstrap: Move common part to include.
> isar-bootstrap: Add host architecture support
>
> Maxim Yu. Osipov (5):
> isar-bootstrap-helper: Add option --copyisarapt to
> setup_root_file_system()
> sdkchroot: Added recipe-devel to create SDK root filesystem
> meta/class/image: Add populate_sdk task to trigger SDK rootfs creation
> scripts: Add helper scripts to mount/umount chroot directory
> doc: Add description of ISAR SDK root filesystem creation
>
> doc/user_manual.md | 95 ++++++++++++++++++++++
> meta/classes/image.bbclass | 17 +++-
> meta/classes/isar-bootstrap-helper.bbclass | 27 +++++-
> .../isar-bootstrap/isar-bootstrap-host.bb | 75 +++++++++++++++++
> .../isar-bootstrap/isar-bootstrap-target.bb | 74 +++++++++++++++++
> .../{isar-bootstrap.bb => isar-bootstrap.inc} | 83 +++----------------
> meta/recipes-devtools/buildchroot/buildchroot.bb | 2 +-
> meta/recipes-devtools/isar-apt/isar-apt-host.bb | 31 +++++++
> .../sdkchroot/files/configscript.sh | 14 ++++
> meta/recipes-devtools/sdkchroot/sdkchroot.bb | 47 +++++++++++
> scripts/mount_chroot.sh | 10 +++
> scripts/umount_chroot.sh | 8 ++
> 12 files changed, 408 insertions(+), 75 deletions(-)
> create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb
> create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
> rename meta/recipes-core/isar-bootstrap/{isar-bootstrap.bb => isar-bootstrap.inc} (68%)
> create mode 100644 meta/recipes-devtools/isar-apt/isar-apt-host.bb
> create mode 100644 meta/recipes-devtools/sdkchroot/files/configscript.sh
> create mode 100644 meta/recipes-devtools/sdkchroot/sdkchroot.bb
> create mode 100755 scripts/mount_chroot.sh
> create mode 100755 scripts/umount_chroot.sh
>
--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-06-29 12:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 1/7] isar-bootstrap: Move common part to include Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 2/7] isar-bootstrap: Add host architecture support Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 3/7] isar-bootstrap-helper: Add option --copyisarapt to setup_root_file_system() Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 4/7] sdkchroot: Added recipe-devel to create SDK root filesystem Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 5/7] meta/class/image: Add populate_sdk task to trigger SDK rootfs creation Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 6/7] scripts: Add helper scripts to mount/umount chroot directory Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 7/7] doc: Add description of ISAR SDK root filesystem creation Maxim Yu. Osipov
2018-06-29 12:57 ` [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox