* [RFC PATCH 0/6] ISAR SDK root filesystem
@ 2018-06-13 13:58 Maxim Yu. Osipov
2018-06-13 13:58 ` [RFC PATCH 1/6] isar-bootstrap-helper: Add option --copyrepo to setup_root_file_system() Maxim Yu. Osipov
` (6 more replies)
0 siblings, 7 replies; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-13 13:58 UTC (permalink / raw)
To: isar-users
Hello everybody,
This series provides preliminary support of ISAR SDK root file system.
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_isar_sdk` for target image, f.e.
`bitbake -c do_isar_sdk multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
The resulting SDK rootfs is located under `tmp/work/${DITSRO}-${DISTRO_ARCH}/sdkchroot/rootfs`.
SDK rootfs directory `/isar-apt` contains the copy of isar-apt repo with locally prebuilt target debian packages.
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_isar_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 mount_chroot.sh
#!/bin/bash
sudo mount /tmp $1/tmp -o bind
sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
sudo mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
$ ./mount_chroot.sh ./build/tmp/work/debian-stretch-armhf/sdkchroot/rootfs
- chroot to isar SDK rootfs:
$ sudo chroot ./build/tmp/work/debian-stretch-armhf/sdkchroot/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
~#
Note:
This code was not sync'ed with patchset 'Initial cross-compilation support'
sent today by Alex.
Your comments/suggestions are welcome,
Kind regards,
Maxim.
Alexander Smirnov (1):
isar-debootstrap: split into host and target recipes
Maxim Yu. Osipov (5):
isar-bootstrap-helper: Add option --copyrepo to
setup_root_file_system()
sdkchroot: Added recipe-devel to create SDK root filesystem
meta/class/image: Add do_isar 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 | 90 ++++++++++++++++++++++
meta-isar/recipes-core/images/isar-image-base.bb | 2 +-
meta/classes/image.bbclass | 10 ++-
meta/classes/isar-bootstrap-helper.bbclass | 24 +++++-
.../isar-bootstrap/isar-bootstrap-host.bb | 31 ++++++++
.../isar-bootstrap/isar-bootstrap-target.bb | 32 ++++++++
.../{isar-bootstrap.bb => isar-bootstrap.inc} | 24 ------
meta/recipes-devtools/buildchroot/buildchroot.bb | 4 +-
.../sdkchroot/files/configscript.sh | 14 ++++
meta/recipes-devtools/sdkchroot/sdkchroot.bb | 59 ++++++++++++++
scripts/mount_chroot.sh | 7 ++
scripts/umount_chroot.sh | 7 ++
12 files changed, 273 insertions(+), 31 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} (89%)
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] 22+ messages in thread
* [RFC PATCH 1/6] isar-bootstrap-helper: Add option --copyrepo to setup_root_file_system()
2018-06-13 13:58 [RFC PATCH 0/6] ISAR SDK root filesystem Maxim Yu. Osipov
@ 2018-06-13 13:58 ` Maxim Yu. Osipov
2018-06-14 8:51 ` Henning Schild
2018-06-13 13:58 ` [RFC PATCH 2/6] isar-debootstrap: split into host and target recipes Maxim Yu. Osipov
` (5 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-13 13:58 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 | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 3c10fc7..7a63914 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -16,10 +16,12 @@ def reverse_bb_array(d, varname):
setup_root_file_system() {
CLEAN=""
+ COPYREPO=""
FSTAB=""
while true; do
case "$1" in
--clean) CLEAN=1 ;;
+ --copyrepo) COPYREPO=1 ;;
--fstab) FSTAB=$2; shift ;;
-*) bbfatal "$0: invalid option specified: $1" ;;
*) break ;;
@@ -43,7 +45,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}/${DISTRO} $ROOTFSDIR/isar-apt
+ if [ ${COPYREPO} ]; then
+ sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DISTRO} $ROOTFSDIR/isar-apt
+ else
+ sudo mount --bind ${DEPLOY_DIR_APT}/${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] 22+ messages in thread
* [RFC PATCH 2/6] isar-debootstrap: split into host and target recipes
2018-06-13 13:58 [RFC PATCH 0/6] ISAR SDK root filesystem Maxim Yu. Osipov
2018-06-13 13:58 ` [RFC PATCH 1/6] isar-bootstrap-helper: Add option --copyrepo to setup_root_file_system() Maxim Yu. Osipov
@ 2018-06-13 13:58 ` Maxim Yu. Osipov
2018-06-14 8:59 ` Henning Schild
2018-06-13 13:58 ` [RFC PATCH 3/6] sdkchroot: Added recipe-devel to create SDK root filesystem Maxim Yu. Osipov
` (4 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-13 13:58 UTC (permalink / raw)
To: isar-users
From: Alexander Smirnov <asmirnov@ilbers.de>
This is required for ISAR SDK root filesystem development
to split isar-bootstrap for target platform and host (SDK).
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
Signed-off-by: Maxim Yu. Osipov <mosipov@
---
meta-isar/recipes-core/images/isar-image-base.bb | 2 +-
meta/classes/image.bbclass | 2 +-
meta/classes/isar-bootstrap-helper.bbclass | 20 +++++++++++---
.../isar-bootstrap/isar-bootstrap-host.bb | 31 +++++++++++++++++++++
.../isar-bootstrap/isar-bootstrap-target.bb | 32 ++++++++++++++++++++++
.../{isar-bootstrap.bb => isar-bootstrap.inc} | 24 ----------------
meta/recipes-devtools/buildchroot/buildchroot.bb | 4 +--
7 files changed, 83 insertions(+), 32 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} (89%)
diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index 6cdc6b2..947f4fc 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -40,7 +40,7 @@ devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
# End /etc/fstab
EOF
- setup_root_file_system --clean --fstab "${WORKDIR}/fstab" \
+ setup_target_root_file_system --clean --fstab "${WORKDIR}/fstab" \
"${IMAGE_ROOTFS}" ${IMAGE_PREINSTALL} ${IMAGE_INSTALL}
# Configure root filesystem
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/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 7a63914..51b7901 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -1,4 +1,4 @@
-# Helper functions for using isar-bootstrap
+# Helper functions for using isar-bootstrap-*
#
# This software is a part of ISAR.
# Copyright (c) Siemens AG, 2018
@@ -15,6 +15,10 @@ def reverse_bb_array(d, varname):
return " ".join(i for i in array)
setup_root_file_system() {
+ DIST="$1"
+ shift
+ ISAR_BOOTSTRAP_DIR="$1"
+ shift
CLEAN=""
COPYREPO=""
FSTAB=""
@@ -35,7 +39,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_DIR/" \
"$ROOTFSDIR"
[ -n "${FSTAB}" ] && cat ${FSTAB} | sudo tee "$ROOTFSDIR/etc/fstab"
@@ -46,9 +50,9 @@ setup_root_file_system() {
sudo tee "$ROOTFSDIR/etc/apt/preferences.d/isar" >/dev/null
if [ ${COPYREPO} ]; then
- sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DISTRO} $ROOTFSDIR/isar-apt
+ sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DIST} $ROOTFSDIR/isar-apt
else
- sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} $ROOTFSDIR/isar-apt
+ sudo mount --bind ${DEPLOY_DIR_APT}/${DIST} $ROOTFSDIR/isar-apt
fi
sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
sudo mount -t proc none $ROOTFSDIR/proc
@@ -87,3 +91,11 @@ setup_root_file_system() {
sudo rm -f "$ROOTFSDIR/chroot-setup.sh"
fi
}
+
+setup_host_root_file_system() {
+ setup_root_file_system ${DISTRO_HOST} isar-bootstrap-host-${DISTRO}-${DISTRO_ARCH} "$@"
+}
+
+setup_target_root_file_system() {
+ setup_root_file_system ${DISTRO} isar-bootstrap-target-${DISTRO}-${DISTRO_ARCH} "$@"
+}
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..6f7480d
--- /dev/null
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb
@@ -0,0 +1,31 @@
+# Minimal debian root file system
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+Description = "Minimal native Debian root file system"
+
+include isar-bootstrap.inc
+
+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 \
+ --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
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..f65f1dd
--- /dev/null
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
@@ -0,0 +1,32 @@
+# Minimal debian root file system
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+Description = "Minimal native Debian root file system"
+
+include isar-bootstrap.inc
+
+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
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
similarity index 89%
rename from meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
rename to meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 497a4f4..c473ad6 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:"
@@ -172,28 +170,6 @@ python do_apt_config_prepare() {
}
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"
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 538c577..5fa8691 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -66,10 +66,10 @@ 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}
+ setup_target_root_file_system "${BUILDCHROOT_DIR}" ${BUILDCHROOT_PREINSTALL}
# Install package builder script
sudo chmod -R a+rw "${BUILDCHROOT_DIR}/home/builder"
--
2.11.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 3/6] sdkchroot: Added recipe-devel to create SDK root filesystem
2018-06-13 13:58 [RFC PATCH 0/6] ISAR SDK root filesystem Maxim Yu. Osipov
2018-06-13 13:58 ` [RFC PATCH 1/6] isar-bootstrap-helper: Add option --copyrepo to setup_root_file_system() Maxim Yu. Osipov
2018-06-13 13:58 ` [RFC PATCH 2/6] isar-debootstrap: split into host and target recipes Maxim Yu. Osipov
@ 2018-06-13 13:58 ` Maxim Yu. Osipov
2018-06-14 9:19 ` Henning Schild
2018-06-13 13:58 ` [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation Maxim Yu. Osipov
` (3 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-13 13:58 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 | 59 ++++++++++++++++++++++
2 files changed, 73 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..d884d80
--- /dev/null
+++ b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
@@ -0,0 +1,59 @@
+# 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"
+
+FILESPATH_prepend := "${THISDIR}/files:"
+SRC_URI := "file://configscript.sh"
+PV = "1.0"
+
+inherit isar-bootstrap-helper
+
+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]
+
+#SDK Debian Distribution
+DISTRO_HOST ?= "debian-stretch"
+#Determine SDK host architecture if not explicitly set
+DISTRO_HOST_ARCH ?= "${@get_deb_host_arch()}"
+
+
+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}"
+SDKCHROOT_DIR := "${WORKDIR}/rootfs"
+
+do_build[stamp-extra-info] = "${DISTRO_HOST}-${DISTRO_HOST_ARCH}"
+do_build[root_cleandirs] = "${SDKCHROOT_DIR} \
+ ${SDKCHROOT_DIR}/isar-apt"
+
+do_build[depends] = "isar-apt:do_cache_config isar-bootstrap-host:do_deploy"
+
+do_build() {
+
+ if [ ${DISTRO_HOST} != "debian-stretch" ]; then
+ bbfatal "SDK doesn't support ${DISTRO_HOST}"
+ fi
+
+ setup_host_root_file_system --copyrepo "${SDKCHROOT_DIR}" ${SDKCHROOT_PREINSTALL}
+
+ # Configure root filesystem
+ sudo install -m 755 ${WORKDIR}/configscript.sh ${SDKCHROOT_DIR}
+ sudo chroot ${SDKCHROOT_DIR} /configscript.sh ${DISTRO_ARCH}
+}
--
2.11.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation.
2018-06-13 13:58 [RFC PATCH 0/6] ISAR SDK root filesystem Maxim Yu. Osipov
` (2 preceding siblings ...)
2018-06-13 13:58 ` [RFC PATCH 3/6] sdkchroot: Added recipe-devel to create SDK root filesystem Maxim Yu. Osipov
@ 2018-06-13 13:58 ` Maxim Yu. Osipov
2018-06-14 9:23 ` Henning Schild
2018-06-18 9:56 ` Baurzhan Ismagulov
2018-06-13 13:58 ` [RFC PATCH 5/6] scripts: Add helper scripts to mount/umount chroot directory Maxim Yu. Osipov
` (2 subsequent siblings)
6 siblings, 2 replies; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-13 13:58 UTC (permalink / raw)
To: isar-users
User manually triggers creation of SDK root filesystem for his target platform by
launching the task `do_isar_sdk` for target image, f.e.
`bitbake -c do_isar_sdk multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
The resulting SDK rootfs is located under `tmp/work/${DITSRO}-${DISTRO_ARCH}/sdkchroot/rootfs`.
SDK rootfs directory `/isar-apt` contains the copy of isar-apt repo with locally
prebuilt target debian packages.
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 | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 4738cb8..dc7da2c 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -71,3 +71,11 @@ 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}"
+
+do_isar_sdk() {
+}
+
+do_isar_sdk[stamp-extra-info] = "${MACHINE}-${DISTRO}"
+do_isar_sdk[depends] = "sdkchroot:do_build"
+
+addtask isar_sdk after do_rootfs
--
2.11.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 5/6] scripts: Add helper scripts to mount/umount chroot directory.
2018-06-13 13:58 [RFC PATCH 0/6] ISAR SDK root filesystem Maxim Yu. Osipov
` (3 preceding siblings ...)
2018-06-13 13:58 ` [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation Maxim Yu. Osipov
@ 2018-06-13 13:58 ` Maxim Yu. Osipov
2018-06-14 9:28 ` Henning Schild
2018-06-13 13:58 ` [RFC PATCH 6/6] doc: Add description of ISAR SDK root filesystem creation Maxim Yu. Osipov
2018-06-14 8:48 ` [RFC PATCH 0/6] ISAR SDK root filesystem Henning Schild
6 siblings, 1 reply; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-13 13:58 UTC (permalink / raw)
To: isar-users
Mount/umount 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 | 7 +++++++
scripts/umount_chroot.sh | 7 +++++++
2 files changed, 14 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..8390edb
--- /dev/null
+++ b/scripts/mount_chroot.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+sudo mount /tmp $1/tmp -o bind
+sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
+sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
+sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
+sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
+sudo 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..a4abde0
--- /dev/null
+++ b/scripts/umount_chroot.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+sudo umount $1/tmp
+sudo umount $1/proc
+sudo umount $1/sys
+sudo umount $1/dev
+sudo umount $1/dev/pts
+sudo umount $1/dev/shm
--
2.11.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 6/6] doc: Add description of ISAR SDK root filesystem creation
2018-06-13 13:58 [RFC PATCH 0/6] ISAR SDK root filesystem Maxim Yu. Osipov
` (4 preceding siblings ...)
2018-06-13 13:58 ` [RFC PATCH 5/6] scripts: Add helper scripts to mount/umount chroot directory Maxim Yu. Osipov
@ 2018-06-13 13:58 ` Maxim Yu. Osipov
2018-06-14 8:48 ` [RFC PATCH 0/6] ISAR SDK root filesystem Henning Schild
6 siblings, 0 replies; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-13 13:58 UTC (permalink / raw)
To: isar-users
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
doc/user_manual.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
diff --git a/doc/user_manual.md b/doc/user_manual.md
index 9921f3a..746708d 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,8 @@ 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`.
+ - `DISTRO_HOST` - The distro to use for SDK root filesystem (so far limited only to `debian-stretch`). This variable is optional.
+ - `DISTRO_HOST_ARCH` - The Debian architecture of SDK root filesystem (e.g., `amd64`). By default set to current Debian host architecture. This variable is optional.
---
@@ -574,3 +577,90 @@ 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_isar_sdk` for target image, f.e.
+`bitbake -c do_isar_sdk multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
+
+The resulting SDK rootfs is located under `tmp/work/${DITSRO}-${DISTRO_ARCH}/sdkchroot/rootfs`.
+SDK rootfs directory `/isar-apt` contains the copy of isar-apt repo with locally prebuilt target debian packages.
+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_isar_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 mount_chroot.sh
+#!/bin/bash
+sudo mount /tmp $1/tmp -o bind
+sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
+sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
+sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
+sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
+sudo mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
+
+$ ./mount_chroot.sh ./build/tmp/work/debian-stretch-armhf/sdkchroot/rootfs
+```
+
+ - chroot to isar SDK rootfs:
+
+```
+$ sudo chroot ./build/tmp/work/debian-stretch-armhf/sdkchroot/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] 22+ messages in thread
* Re: [RFC PATCH 0/6] ISAR SDK root filesystem
2018-06-13 13:58 [RFC PATCH 0/6] ISAR SDK root filesystem Maxim Yu. Osipov
` (5 preceding siblings ...)
2018-06-13 13:58 ` [RFC PATCH 6/6] doc: Add description of ISAR SDK root filesystem creation Maxim Yu. Osipov
@ 2018-06-14 8:48 ` Henning Schild
2018-06-14 8:51 ` Jan Kiszka
2018-06-14 9:46 ` Maxim Yu. Osipov
6 siblings, 2 replies; 22+ messages in thread
From: Henning Schild @ 2018-06-14 8:48 UTC (permalink / raw)
To: Maxim Yu. Osipov; +Cc: isar-users
Am Wed, 13 Jun 2018 15:58:23 +0200
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> Hello everybody,
>
> This series provides preliminary support of ISAR SDK root file system.
>
> 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_isar_sdk` for target image, f.e.
> `bitbake -c do_isar_sdk
> multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
>
> The resulting SDK rootfs is located under
> `tmp/work/${DITSRO}-${DISTRO_ARCH}/sdkchroot/rootfs`. SDK rootfs
> directory `/isar-apt` contains the copy of isar-apt repo with locally
> prebuilt target debian packages. 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).
Are we ready for buster? Not many people care about the past, but let
us make sure this will work in the future.
> Example
>
> - Trigger creation of SDK root filesystem
>
>
> bitbake -c do_isar_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 mount_chroot.sh
> #!/bin/bash
> sudo mount /tmp $1/tmp -o bind
> sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
> sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
> sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
> sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
> sudo mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
>
> $ ./mount_chroot.sh ./build/tmp/work/debian-stretch-armhf/sdkchroot/rootfs
Imagine this being copied over to a totally different Linux-distro or
into a docker container.
The "sudos" should not be in the script. So people can choose to not
use sudo at all or call the script with sudo.
Maybe adding a Dockerfile would be a good idea to understand more such
implications.
Henning
> - chroot to isar SDK rootfs:
>
> $ sudo chroot ./build/tmp/work/debian-stretch-armhf/sdkchroot/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
> ~#
>
>
> Note:
> This code was not sync'ed with patchset 'Initial cross-compilation
> support' sent today by Alex.
>
>
> Your comments/suggestions are welcome,
>
> Kind regards,
> Maxim.
>
>
> Alexander Smirnov (1):
> isar-debootstrap: split into host and target recipes
>
> Maxim Yu. Osipov (5):
> isar-bootstrap-helper: Add option --copyrepo to
> setup_root_file_system()
> sdkchroot: Added recipe-devel to create SDK root filesystem
> meta/class/image: Add do_isar 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 | 90
> ++++++++++++++++++++++
> meta-isar/recipes-core/images/isar-image-base.bb | 2 +-
> meta/classes/image.bbclass | 10 ++-
> meta/classes/isar-bootstrap-helper.bbclass | 24
> +++++- .../isar-bootstrap/isar-bootstrap-host.bb | 31
> ++++++++ .../isar-bootstrap/isar-bootstrap-target.bb | 32
> ++++++++ .../{isar-bootstrap.bb => isar-bootstrap.inc} | 24
> ------ meta/recipes-devtools/buildchroot/buildchroot.bb | 4
> +- .../sdkchroot/files/configscript.sh | 14 ++++
> meta/recipes-devtools/sdkchroot/sdkchroot.bb | 59
> ++++++++++++++ scripts/mount_chroot.sh |
> 7 ++ scripts/umount_chroot.sh | 7 ++ 12
> files changed, 273 insertions(+), 31 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} (89%) 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
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 0/6] ISAR SDK root filesystem
2018-06-14 8:48 ` [RFC PATCH 0/6] ISAR SDK root filesystem Henning Schild
@ 2018-06-14 8:51 ` Jan Kiszka
2018-06-14 9:34 ` Henning Schild
2018-06-14 9:46 ` Maxim Yu. Osipov
1 sibling, 1 reply; 22+ messages in thread
From: Jan Kiszka @ 2018-06-14 8:51 UTC (permalink / raw)
To: [ext] Henning Schild, Maxim Yu. Osipov; +Cc: isar-users
On 2018-06-14 10:48, [ext] Henning Schild wrote:
> Am Wed, 13 Jun 2018 15:58:23 +0200
> schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
>
>> Hello everybody,
>>
>> This series provides preliminary support of ISAR SDK root file system.
>>
>> 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_isar_sdk` for target image, f.e.
>> `bitbake -c do_isar_sdk
>> multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
>>
>> The resulting SDK rootfs is located under
>> `tmp/work/${DITSRO}-${DISTRO_ARCH}/sdkchroot/rootfs`. SDK rootfs
>> directory `/isar-apt` contains the copy of isar-apt repo with locally
>> prebuilt target debian packages. 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).
>
> Are we ready for buster? Not many people care about the past, but let
> us make sure this will work in the future.
>
>> Example
>>
>> - Trigger creation of SDK root filesystem
>>
>>
>> bitbake -c do_isar_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 mount_chroot.sh
>> #!/bin/bash
>> sudo mount /tmp $1/tmp -o bind
>> sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
>> sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
>> sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
>> sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
>> sudo mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
>>
>> $ ./mount_chroot.sh ./build/tmp/work/debian-stretch-armhf/sdkchroot/rootfs
>
> Imagine this being copied over to a totally different Linux-distro or
> into a docker container.
>
> The "sudos" should not be in the script. So people can choose to not
> use sudo at all or call the script with sudo.
>
> Maybe adding a Dockerfile would be a good idea to understand more such
> implications.
I wonder if there are build scenarios where we would also get away
without chroot and bind-mounting and just using --sysroot on the toolchain.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 1/6] isar-bootstrap-helper: Add option --copyrepo to setup_root_file_system()
2018-06-13 13:58 ` [RFC PATCH 1/6] isar-bootstrap-helper: Add option --copyrepo to setup_root_file_system() Maxim Yu. Osipov
@ 2018-06-14 8:51 ` Henning Schild
0 siblings, 0 replies; 22+ messages in thread
From: Henning Schild @ 2018-06-14 8:51 UTC (permalink / raw)
To: Maxim Yu. Osipov; +Cc: isar-users
Am Wed, 13 Jun 2018 15:58:24 +0200
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> 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 | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/isar-bootstrap-helper.bbclass
> b/meta/classes/isar-bootstrap-helper.bbclass index 3c10fc7..7a63914
> 100644 --- a/meta/classes/isar-bootstrap-helper.bbclass
> +++ b/meta/classes/isar-bootstrap-helper.bbclass
> @@ -16,10 +16,12 @@ def reverse_bb_array(d, varname):
>
> setup_root_file_system() {
> CLEAN=""
> + COPYREPO=""
Maybe call that COPYISARAPT --copyisarapt. With the reproducable build
feature still to come we might end up copying many "repos" and the name
could become confusing.
Henning
> FSTAB=""
> while true; do
> case "$1" in
> --clean) CLEAN=1 ;;
> + --copyrepo) COPYREPO=1 ;;
> --fstab) FSTAB=$2; shift ;;
> -*) bbfatal "$0: invalid option specified: $1" ;;
> *) break ;;
> @@ -43,7 +45,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}/${DISTRO} $ROOTFSDIR/isar-apt
> + if [ ${COPYREPO} ]; then
> + sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DISTRO}
> $ROOTFSDIR/isar-apt
> + else
> + sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO}
> $ROOTFSDIR/isar-apt
> + fi
> sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs
> $ROOTFSDIR/dev sudo mount -t proc none $ROOTFSDIR/proc
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 2/6] isar-debootstrap: split into host and target recipes
2018-06-13 13:58 ` [RFC PATCH 2/6] isar-debootstrap: split into host and target recipes Maxim Yu. Osipov
@ 2018-06-14 8:59 ` Henning Schild
0 siblings, 0 replies; 22+ messages in thread
From: Henning Schild @ 2018-06-14 8:59 UTC (permalink / raw)
To: Maxim Yu. Osipov; +Cc: isar-users
Am Wed, 13 Jun 2018 15:58:25 +0200
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> From: Alexander Smirnov <asmirnov@ilbers.de>
>
> This is required for ISAR SDK root filesystem development
> to split isar-bootstrap for target platform and host (SDK).
>
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> Signed-off-by: Maxim Yu. Osipov <mosipov@
> ---
> meta-isar/recipes-core/images/isar-image-base.bb | 2 +-
> meta/classes/image.bbclass | 2 +-
> meta/classes/isar-bootstrap-helper.bbclass | 20
> +++++++++++--- .../isar-bootstrap/isar-bootstrap-host.bb |
> 31
> +++++++++++++++++++++ .../isar-bootstrap/isar-bootstrap-target.bb
> | 32 ++++++++++++++++++++++ .../{isar-bootstrap.bb =>
> isar-bootstrap.inc} | 24 ----------------
> meta/recipes-devtools/buildchroot/buildchroot.bb | 4 +-- 7 files
> changed, 83 insertions(+), 32 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} (89%)
>
> diff --git a/meta-isar/recipes-core/images/isar-image-base.bb
> b/meta-isar/recipes-core/images/isar-image-base.bb index
> 6cdc6b2..947f4fc 100644 ---
> a/meta-isar/recipes-core/images/isar-image-base.bb +++
> b/meta-isar/recipes-core/images/isar-image-base.bb @@ -40,7 +40,7 @@
> devtmpfs /dev devtmpfs
> mode=0755,nosuid 0 0 # End /etc/fstab EOF
>
> - setup_root_file_system --clean --fstab "${WORKDIR}/fstab" \
> + setup_target_root_file_system --clean --fstab "${WORKDIR}/fstab"
> \ "${IMAGE_ROOTFS}" ${IMAGE_PREINSTALL} ${IMAGE_INSTALL}
>
> # Configure root filesystem
> 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/classes/isar-bootstrap-helper.bbclass
> b/meta/classes/isar-bootstrap-helper.bbclass index 7a63914..51b7901
> 100644 --- a/meta/classes/isar-bootstrap-helper.bbclass
> +++ b/meta/classes/isar-bootstrap-helper.bbclass
> @@ -1,4 +1,4 @@
> -# Helper functions for using isar-bootstrap
> +# Helper functions for using isar-bootstrap-*
> #
> # This software is a part of ISAR.
> # Copyright (c) Siemens AG, 2018
> @@ -15,6 +15,10 @@ def reverse_bb_array(d, varname):
> return " ".join(i for i in array)
>
> setup_root_file_system() {
> + DIST="$1"
> + shift
> + ISAR_BOOTSTRAP_DIR="$1"
> + shift
> CLEAN=""
> COPYREPO=""
> FSTAB=""
> @@ -35,7 +39,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_DIR/" \
> "$ROOTFSDIR"
> [ -n "${FSTAB}" ] && cat ${FSTAB} | sudo tee
> "$ROOTFSDIR/etc/fstab"
> @@ -46,9 +50,9 @@ setup_root_file_system() {
> sudo tee "$ROOTFSDIR/etc/apt/preferences.d/isar" >/dev/null
>
> if [ ${COPYREPO} ]; then
> - sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DISTRO}
> $ROOTFSDIR/isar-apt
> + sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DIST} $ROOTFSDIR/isar-apt
> else
> - sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO}
> $ROOTFSDIR/isar-apt
> + sudo mount --bind ${DEPLOY_DIR_APT}/${DIST}
> $ROOTFSDIR/isar-apt fi
> sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs
> $ROOTFSDIR/dev sudo mount -t proc none $ROOTFSDIR/proc
> @@ -87,3 +91,11 @@ setup_root_file_system() {
> sudo rm -f "$ROOTFSDIR/chroot-setup.sh"
> fi
> }
> +
> +setup_host_root_file_system() {
> + setup_root_file_system ${DISTRO_HOST}
> isar-bootstrap-host-${DISTRO}-${DISTRO_ARCH} "$@" +}
> +
> +setup_target_root_file_system() {
> + setup_root_file_system ${DISTRO}
> isar-bootstrap-target-${DISTRO}-${DISTRO_ARCH} "$@" +}
> 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..6f7480d
> --- /dev/null
> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb
> @@ -0,0 +1,31 @@
> +# Minimal debian root file system
> +#
> +# This software is a part of ISAR.
> +# Copyright (c) Siemens AG, 2018
> +#
> +# SPDX-License-Identifier: MIT
> +
> +Description = "Minimal native Debian root file system"
> +
> +include isar-bootstrap.inc
> +
> +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 \
> + --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
> 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..f65f1dd --- /dev/null
> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
> @@ -0,0 +1,32 @@
> +# Minimal debian root file system
> +#
> +# This software is a part of ISAR.
> +# Copyright (c) Siemens AG, 2018
> +#
> +# SPDX-License-Identifier: MIT
> +
> +Description = "Minimal native Debian root file system"
> +
> +include isar-bootstrap.inc
> +
> +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
The two DEBOOTSTRAPs are almost the same. You first pull it out and
then create almost identical copies. Cant you just pass the DISTRO
and HOST_DISTRO in and call it DIST like you do in
setup_root_file_system()?
Henning
> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc similarity
> index 89% rename from
> meta/recipes-core/isar-bootstrap/isar-bootstrap.bb rename to
> meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index
> 497a4f4..c473ad6 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:" @@ -172,28 +170,6 @@ python
> do_apt_config_prepare() { }
> 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"
> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
> b/meta/recipes-devtools/buildchroot/buildchroot.bb index
> 538c577..5fa8691 100644 ---
> a/meta/recipes-devtools/buildchroot/buildchroot.bb +++
> b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -66,10 +66,10
> @@ 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}
> + setup_target_root_file_system "${BUILDCHROOT_DIR}"
> ${BUILDCHROOT_PREINSTALL}
> # Install package builder script
> sudo chmod -R a+rw "${BUILDCHROOT_DIR}/home/builder"
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 3/6] sdkchroot: Added recipe-devel to create SDK root filesystem
2018-06-13 13:58 ` [RFC PATCH 3/6] sdkchroot: Added recipe-devel to create SDK root filesystem Maxim Yu. Osipov
@ 2018-06-14 9:19 ` Henning Schild
2018-06-14 10:46 ` Maxim Yu. Osipov
0 siblings, 1 reply; 22+ messages in thread
From: Henning Schild @ 2018-06-14 9:19 UTC (permalink / raw)
To: Maxim Yu. Osipov; +Cc: isar-users
Am Wed, 13 Jun 2018 15:58:26 +0200
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> 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 | 59
> ++++++++++++++++++++++ 2 files changed, 73 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..d884d80
> --- /dev/null
> +++ b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
> @@ -0,0 +1,59 @@
> +# 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"
> + +FILESPATH_prepend := "${THISDIR}/files:"
Should not be required.
> +SRC_URI := "file://configscript.sh"
> +PV = "1.0"
Please use proper file naming instead.
sdkchroot_1.0.bb and maybe go for 0.1 ;)
> +
> +inherit isar-bootstrap-helper
> +
> +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]
> +
> +#SDK Debian Distribution
> +DISTRO_HOST ?= "debian-stretch"
> +#Determine SDK host architecture if not explicitly set
> +DISTRO_HOST_ARCH ?= "${@get_deb_host_arch()}"
> +
> +
> +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}"
Why do you set that? Not needed and wrong ... no PV.
> +SDKCHROOT_DIR := "${WORKDIR}/rootfs"
Could you just use S and drop SDKCHROOT_DIR?
Henning
> +do_build[stamp-extra-info] = "${DISTRO_HOST}-${DISTRO_HOST_ARCH}"
> +do_build[root_cleandirs] = "${SDKCHROOT_DIR} \
> + ${SDKCHROOT_DIR}/isar-apt"
> +
> +do_build[depends] = "isar-apt:do_cache_config
> isar-bootstrap-host:do_deploy" +
> +do_build() {
> +
> + if [ ${DISTRO_HOST} != "debian-stretch" ]; then
> + bbfatal "SDK doesn't support ${DISTRO_HOST}"
> + fi
> +
> + setup_host_root_file_system --copyrepo "${SDKCHROOT_DIR}"
> ${SDKCHROOT_PREINSTALL} +
> + # Configure root filesystem
> + sudo install -m 755 ${WORKDIR}/configscript.sh ${SDKCHROOT_DIR}
> + sudo chroot ${SDKCHROOT_DIR} /configscript.sh ${DISTRO_ARCH}
> +}
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation.
2018-06-13 13:58 ` [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation Maxim Yu. Osipov
@ 2018-06-14 9:23 ` Henning Schild
2018-06-14 11:49 ` Maxim Yu. Osipov
2018-06-18 9:56 ` Baurzhan Ismagulov
1 sibling, 1 reply; 22+ messages in thread
From: Henning Schild @ 2018-06-14 9:23 UTC (permalink / raw)
To: Maxim Yu. Osipov; +Cc: isar-users
Am Wed, 13 Jun 2018 15:58:27 +0200
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> User manually triggers creation of SDK root filesystem for his target
> platform by launching the task `do_isar_sdk` for target image, f.e.
> `bitbake -c do_isar_sdk
> multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
>
> The resulting SDK rootfs is located under
> `tmp/work/${DITSRO}-${DISTRO_ARCH}/sdkchroot/rootfs`. SDK rootfs
> directory `/isar-apt` contains the copy of isar-apt repo with locally
> prebuilt target debian packages. 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 | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 4738cb8..dc7da2c 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -71,3 +71,11 @@ 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}"
> +
> +do_isar_sdk() {
> +}
>
> +
> +do_isar_sdk[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> +do_isar_sdk[depends] = "sdkchroot:do_build"
> +
> +addtask isar_sdk after do_rootfs
Could you explain why sdkchroot is a recipe of its own and you are
building that dependency chain. So why can sdkchroot:do_build not just
be implemented in do_isar_sdk? The reasoning should probably be added
to the commit message.
Henning
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 5/6] scripts: Add helper scripts to mount/umount chroot directory.
2018-06-13 13:58 ` [RFC PATCH 5/6] scripts: Add helper scripts to mount/umount chroot directory Maxim Yu. Osipov
@ 2018-06-14 9:28 ` Henning Schild
0 siblings, 0 replies; 22+ messages in thread
From: Henning Schild @ 2018-06-14 9:28 UTC (permalink / raw)
To: Maxim Yu. Osipov; +Cc: isar-users
Am Wed, 13 Jun 2018 15:58:28 +0200
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> Mount/umount 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 | 7 +++++++
> scripts/umount_chroot.sh | 7 +++++++
> 2 files changed, 14 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..8390edb
> --- /dev/null
> +++ b/scripts/mount_chroot.sh
> @@ -0,0 +1,7 @@
> +#!/bin/bash
> +sudo mount /tmp $1/tmp -o bind
> +sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
> +sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
> +sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
> +sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
> +sudo 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..a4abde0
> --- /dev/null
> +++ b/scripts/umount_chroot.sh
> @@ -0,0 +1,7 @@
> +#!/bin/bash
> +sudo umount $1/tmp
> +sudo umount $1/proc
> +sudo umount $1/sys
> +sudo umount $1/dev
> +sudo umount $1/dev/pts
> +sudo umount $1/dev/shm
I already mentioned those "sudos" should go, from both scripts. It
might be a good idea to invent something like an fstab that both
scripts access, and "set -e". For umount you could also check whether
"--recursive" can be used, that way you would not have to mention all
directories twice and the fstab idea would not be needed.
Henning
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 0/6] ISAR SDK root filesystem
2018-06-14 8:51 ` Jan Kiszka
@ 2018-06-14 9:34 ` Henning Schild
0 siblings, 0 replies; 22+ messages in thread
From: Henning Schild @ 2018-06-14 9:34 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Maxim Yu. Osipov, isar-users
Am Thu, 14 Jun 2018 10:51:39 +0200
schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> On 2018-06-14 10:48, [ext] Henning Schild wrote:
> > Am Wed, 13 Jun 2018 15:58:23 +0200
> > schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> >
> >> Hello everybody,
> >>
> >> This series provides preliminary support of ISAR SDK root file
> >> system.
> >>
> >> 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_isar_sdk` for target
> >> image, f.e. `bitbake -c do_isar_sdk
> >> multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
> >>
> >> The resulting SDK rootfs is located under
> >> `tmp/work/${DITSRO}-${DISTRO_ARCH}/sdkchroot/rootfs`. SDK rootfs
> >> directory `/isar-apt` contains the copy of isar-apt repo with
> >> locally prebuilt target debian packages. 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).
> >
> > Are we ready for buster? Not many people care about the past, but
> > let us make sure this will work in the future.
> >
> >> Example
> >>
> >> - Trigger creation of SDK root filesystem
> >>
> >>
> >> bitbake -c do_isar_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 mount_chroot.sh
> >> #!/bin/bash
> >> sudo mount /tmp $1/tmp -o bind
> >> sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
> >> sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
> >> sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
> >> sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
> >> sudo mount tmpfs $1/dev/shm -t tmpfs -o
> >> rw,seclabel,nosuid,nodev
> >>
> >> $ ./mount_chroot.sh ./build/tmp/work/debian-stretch-armhf/sdkchroot/rootfs
> >
> > Imagine this being copied over to a totally different Linux-distro
> > or into a docker container.
> >
> > The "sudos" should not be in the script. So people can choose to not
> > use sudo at all or call the script with sudo.
> >
> > Maybe adding a Dockerfile would be a good idea to understand more
> > such implications.
>
> I wonder if there are build scenarios where we would also get away
> without chroot and bind-mounting and just using --sysroot on the
> toolchain.
I bet there are. But this approach is very generic and gives you a more
controlled environment. People could still use "--sysroot" with it.
One limitiation i see is that it is not clear how you get your code in.
You have eclipse open on your host, you probably want to mount your
eclipse-workdir into the thing. Not to mention the build-button ...
hammer-time.
Maybe we stick with the "debian around the sysroot" and add a
"--sysroot" from outside example?
Henning
> Jan
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 0/6] ISAR SDK root filesystem
2018-06-14 8:48 ` [RFC PATCH 0/6] ISAR SDK root filesystem Henning Schild
2018-06-14 8:51 ` Jan Kiszka
@ 2018-06-14 9:46 ` Maxim Yu. Osipov
2018-06-18 7:08 ` Henning Schild
1 sibling, 1 reply; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-14 9:46 UTC (permalink / raw)
To: Henning Schild; +Cc: isar-users
On 06/14/2018 10:48 AM, Henning Schild wrote:
<snip>
>> 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).
>
> Are we ready for buster? Not many people care about the past, but let
> us make sure this will work in the future.
Your patch regarding buster support is still pending as additional
feedback from you is needed (see email below I've sent you a week ago).
8<---
> -------- Forwarded Message --------
> Subject: Re: [PATCHv2 2/2] conf: Add support for new debian distro "buster"
> Date: Thu, 7 Jun 2018 11:53:13 +0200
> From: Maxim Yu. Osipov <mosipov@ilbers.de>
> Organization: ilbers GmbH
> To: Henning Schild <henning.schild@siemens.com>, isar-users@googlegroups.com
> CC: Alexander Smirnov <asmirnov@ilbers.de>
>
> Hello Henning,
>
> Did you experience the problem Alexander reported in email below?
>
> Kind regards,
> Maxim.
>
> On 05/27/2018 09:54 PM, Alexander Smirnov wrote:
>> Hi Henning,
>>
>> thank you for the first patch, now there is no problem with trusted
>> repo. But there is another issue with wic:
>>
>> 8<--
>> ERROR: mc:qemui386-buster:isar-image-base-1.0-r0 do_wic_image: Function
>> failed: do_wic_image (log file is located at
>> /home/builder/isar/build/tmp/work/debian-buster-i386/isar-image-base/temp/log.do_wic_image.6282)
>>
8<---
>> Example
>>
>> - Trigger creation of SDK root filesystem
>>
>>
>> bitbake -c do_isar_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 mount_chroot.sh
>> #!/bin/bash
>> sudo mount /tmp $1/tmp -o bind
>> sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
>> sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
>> sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
>> sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
>> sudo mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev
>>
>> $ ./mount_chroot.sh ./build/tmp/work/debian-stretch-armhf/sdkchroot/rootfs
>
> Imagine this being copied over to a totally different Linux-distro or
> into a docker container.
>
> The "sudos" should not be in the script. So people can choose to not
> use sudo at all or call the script with sudo.
OK.
> Maybe adding a Dockerfile would be a good idea to understand more such
> implications.
>
> Henning
Kind regards,
Maxim.
--
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] 22+ messages in thread
* Re: [RFC PATCH 3/6] sdkchroot: Added recipe-devel to create SDK root filesystem
2018-06-14 9:19 ` Henning Schild
@ 2018-06-14 10:46 ` Maxim Yu. Osipov
2018-06-14 11:07 ` Henning Schild
0 siblings, 1 reply; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-14 10:46 UTC (permalink / raw)
To: Henning Schild; +Cc: isar-users
On 06/14/2018 11:19 AM, Henning Schild wrote:
> Am Wed, 13 Jun 2018 15:58:26 +0200
> schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
>
>> 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 | 59
>> ++++++++++++++++++++++ 2 files changed, 73 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..d884d80
>> --- /dev/null
>> +++ b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
>> @@ -0,0 +1,59 @@
>> +# 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"
>> + +FILESPATH_prepend := "${THISDIR}/files:"
>
> Should not be required.
>
>> +SRC_URI := "file://configscript.sh"
>> +PV = "1.0"
>
> Please use proper file naming instead.
>
> sdkchroot_1.0.bb and maybe go for 0.1 ;)
>
>> +
>> +inherit isar-bootstrap-helper
>> +
>> +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]
>> +
>> +#SDK Debian Distribution
>> +DISTRO_HOST ?= "debian-stretch"
>> +#Determine SDK host architecture if not explicitly set
>> +DISTRO_HOST_ARCH ?= "${@get_deb_host_arch()}"
>> +
>> +
>> +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}"
>
> Why do you set that? Not needed and wrong ... no PV.
Well...sdkchroot.bb is based on buildchroot.bb.
Does it mean that all your previous notes apply to buildchroot too?
>
>> +SDKCHROOT_DIR := "${WORKDIR}/rootfs"
>
> Could you just use S and drop SDKCHROOT_DIR?
Agree (that was inherited from buildchroot.bb as buildchroot's
counterpart - BUILDCHROOT_DIR is used in other recipes).
Maxim.
> Henning
>
>> +do_build[stamp-extra-info] = "${DISTRO_HOST}-${DISTRO_HOST_ARCH}"
>> +do_build[root_cleandirs] = "${SDKCHROOT_DIR} \
>> + ${SDKCHROOT_DIR}/isar-apt"
>> +
>> +do_build[depends] = "isar-apt:do_cache_config
>> isar-bootstrap-host:do_deploy" +
>> +do_build() {
>> +
>> + if [ ${DISTRO_HOST} != "debian-stretch" ]; then
>> + bbfatal "SDK doesn't support ${DISTRO_HOST}"
>> + fi
>> +
>> + setup_host_root_file_system --copyrepo "${SDKCHROOT_DIR}"
>> ${SDKCHROOT_PREINSTALL} +
>> + # Configure root filesystem
>> + sudo install -m 755 ${WORKDIR}/configscript.sh ${SDKCHROOT_DIR}
>> + sudo chroot ${SDKCHROOT_DIR} /configscript.sh ${DISTRO_ARCH}
>> +}
>
--
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] 22+ messages in thread
* Re: [RFC PATCH 3/6] sdkchroot: Added recipe-devel to create SDK root filesystem
2018-06-14 10:46 ` Maxim Yu. Osipov
@ 2018-06-14 11:07 ` Henning Schild
0 siblings, 0 replies; 22+ messages in thread
From: Henning Schild @ 2018-06-14 11:07 UTC (permalink / raw)
To: Maxim Yu. Osipov; +Cc: isar-users
Am Thu, 14 Jun 2018 12:46:22 +0200
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> On 06/14/2018 11:19 AM, Henning Schild wrote:
> > Am Wed, 13 Jun 2018 15:58:26 +0200
> > schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> >
> >> 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 | 59
> >> ++++++++++++++++++++++ 2 files changed, 73 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..d884d80
> >> --- /dev/null
> >> +++ b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
> >> @@ -0,0 +1,59 @@
> >> +# 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"
> >> + +FILESPATH_prepend := "${THISDIR}/files:"
> >
> > Should not be required.
> >
> >> +SRC_URI := "file://configscript.sh"
> >> +PV = "1.0"
> >
> > Please use proper file naming instead.
> >
> > sdkchroot_1.0.bb and maybe go for 0.1 ;)
> >
> >> +
> >> +inherit isar-bootstrap-helper
> >> +
> >> +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]
> >> +
> >> +#SDK Debian Distribution
> >> +DISTRO_HOST ?= "debian-stretch"
> >> +#Determine SDK host architecture if not explicitly set
> >> +DISTRO_HOST_ARCH ?= "${@get_deb_host_arch()}"
> >> +
> >> +
> >> +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}"
> >
> > Why do you set that? Not needed and wrong ... no PV.
>
> Well...sdkchroot.bb is based on buildchroot.bb.
> Does it mean that all your previous notes apply to buildchroot too?
That is old code back from the days when there where no reviews, it is
likely some notes apply there as well. i.e. versioned recipes could
some day help to introduce api modyfing changes
If you find that my notes makes sense and decide to apply them, you can
double check whether buildchroot would benefit from similar changes.
Henning
> >
> >> +SDKCHROOT_DIR := "${WORKDIR}/rootfs"
> >
> > Could you just use S and drop SDKCHROOT_DIR?
>
> Agree (that was inherited from buildchroot.bb as buildchroot's
> counterpart - BUILDCHROOT_DIR is used in other recipes).
>
> Maxim.
>
> > Henning
> >
> >> +do_build[stamp-extra-info] = "${DISTRO_HOST}-${DISTRO_HOST_ARCH}"
> >> +do_build[root_cleandirs] = "${SDKCHROOT_DIR} \
> >> + ${SDKCHROOT_DIR}/isar-apt"
> >> +
> >> +do_build[depends] = "isar-apt:do_cache_config
> >> isar-bootstrap-host:do_deploy" +
> >> +do_build() {
> >> +
> >> + if [ ${DISTRO_HOST} != "debian-stretch" ]; then
> >> + bbfatal "SDK doesn't support ${DISTRO_HOST}"
> >> + fi
> >> +
> >> + setup_host_root_file_system --copyrepo "${SDKCHROOT_DIR}"
> >> ${SDKCHROOT_PREINSTALL} +
> >> + # Configure root filesystem
> >> + sudo install -m 755 ${WORKDIR}/configscript.sh
> >> ${SDKCHROOT_DIR}
> >> + sudo chroot ${SDKCHROOT_DIR} /configscript.sh ${DISTRO_ARCH}
> >> +}
> >
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation.
2018-06-14 9:23 ` Henning Schild
@ 2018-06-14 11:49 ` Maxim Yu. Osipov
0 siblings, 0 replies; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-14 11:49 UTC (permalink / raw)
To: Henning Schild; +Cc: isar-users
On 06/14/2018 11:23 AM, Henning Schild wrote:
> Am Wed, 13 Jun 2018 15:58:27 +0200
> schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
>
>> User manually triggers creation of SDK root filesystem for his target
>> platform by launching the task `do_isar_sdk` for target image, f.e.
>> `bitbake -c do_isar_sdk
>> multiconfig:${MACHINE}-${DISTRO}:isar-image-base`.
>>
>> The resulting SDK rootfs is located under
>> `tmp/work/${DITSRO}-${DISTRO_ARCH}/sdkchroot/rootfs`. SDK rootfs
>> directory `/isar-apt` contains the copy of isar-apt repo with locally
>> prebuilt target debian packages. 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 | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
>> index 4738cb8..dc7da2c 100644
>> --- a/meta/classes/image.bbclass
>> +++ b/meta/classes/image.bbclass
>> @@ -71,3 +71,11 @@ 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}"
>> +
>> +do_isar_sdk() {
>> +}
>>
>> +
>> +do_isar_sdk[stamp-extra-info] = "${MACHINE}-${DISTRO}"
>> +do_isar_sdk[depends] = "sdkchroot:do_build"
>> +
>> +addtask isar_sdk after do_rootfs
>
> Could you explain why sdkchroot is a recipe of its own and you are
> building that dependency chain. So why can sdkchroot:do_build not just
> be implemented in do_isar_sdk? The reasoning should probably be added
> to the commit message.
One of the initial ideas of adding such dependency to image class
is to make sure that target packages which user lists in IMAGE_INSTALL
are already built.
So sdkchroot has two major dependencies
1) target rootfs (and prebuilt target packages)
This dependency is placed in meta/classes/image.bbclass:
addtask isar_sdk after do_rootfs
2) host's isar-bootstrap
This dependency is placed in meta/recipes-devtools/sdkchroot/sdkchroot.bb:
do_build[depends] = "isar-apt:do_cache_config isar-bootstrap-host:do_deploy"
As I mentioned before sdkchroot is very similar to buildchroot.
So such split between sdkchroot and image class seems to be natural.
Maxim.
--
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] 22+ messages in thread
* Re: [RFC PATCH 0/6] ISAR SDK root filesystem
2018-06-14 9:46 ` Maxim Yu. Osipov
@ 2018-06-18 7:08 ` Henning Schild
2018-06-19 7:33 ` Maxim Yu. Osipov
0 siblings, 1 reply; 22+ messages in thread
From: Henning Schild @ 2018-06-18 7:08 UTC (permalink / raw)
To: Maxim Yu. Osipov; +Cc: isar-users
Am Thu, 14 Jun 2018 11:46:23 +0200
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
> On 06/14/2018 10:48 AM, Henning Schild wrote:
> <snip>
> >> 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).
> >
> > Are we ready for buster? Not many people care about the past, but
> > let us make sure this will work in the future.
>
> Your patch regarding buster support is still pending as additional
> feedback from you is needed (see email below I've sent you a week
> ago).
Ok, i will look into the buster-wic thing. But my question is whether
the SDK/crossbuild approach that works for stretch will also work for
buster.
Henning
> 8<---
> > -------- Forwarded Message --------
> > Subject: Re: [PATCHv2 2/2] conf: Add support for new debian distro
> > "buster" Date: Thu, 7 Jun 2018 11:53:13 +0200
> > From: Maxim Yu. Osipov <mosipov@ilbers.de>
> > Organization: ilbers GmbH
> > To: Henning Schild <henning.schild@siemens.com>,
> > isar-users@googlegroups.com CC: Alexander Smirnov
> > <asmirnov@ilbers.de>
> >
> > Hello Henning,
> >
> > Did you experience the problem Alexander reported in email below?
> >
> > Kind regards,
> > Maxim.
> >
> > On 05/27/2018 09:54 PM, Alexander Smirnov wrote:
> >> Hi Henning,
> >>
> >> thank you for the first patch, now there is no problem with
> >> trusted repo. But there is another issue with wic:
> >>
> >> 8<--
> >> ERROR: mc:qemui386-buster:isar-image-base-1.0-r0 do_wic_image:
> >> Function failed: do_wic_image (log file is located at
> >> /home/builder/isar/build/tmp/work/debian-buster-i386/isar-image-base/temp/log.do_wic_image.6282)
> >>
>
> 8<---
>
>
> >> Example
> >>
> >> - Trigger creation of SDK root filesystem
> >>
> >>
> >> bitbake -c do_isar_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 mount_chroot.sh
> >> #!/bin/bash
> >> sudo mount /tmp $1/tmp -o bind
> >> sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
> >> sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
> >> sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
> >> sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
> >> sudo mount tmpfs $1/dev/shm -t tmpfs -o
> >> rw,seclabel,nosuid,nodev
> >>
> >> $ ./mount_chroot.sh ./build/tmp/work/debian-stretch-armhf/sdkchroot/rootfs
> >
> > Imagine this being copied over to a totally different Linux-distro
> > or into a docker container.
> >
> > The "sudos" should not be in the script. So people can choose to not
> > use sudo at all or call the script with sudo.
>
> OK.
>
> > Maybe adding a Dockerfile would be a good idea to understand more
> > such implications.
> >
> > Henning
>
> Kind regards,
> Maxim.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation.
2018-06-13 13:58 ` [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation Maxim Yu. Osipov
2018-06-14 9:23 ` Henning Schild
@ 2018-06-18 9:56 ` Baurzhan Ismagulov
1 sibling, 0 replies; 22+ messages in thread
From: Baurzhan Ismagulov @ 2018-06-18 9:56 UTC (permalink / raw)
To: isar-users; +Cc: kazuhiro3.hayashi
[-- Attachment #1: Type: text/plain, Size: 1996 bytes --]
On Wed, Jun 13, 2018 at 03:58:27PM +0200, Maxim Yu. Osipov wrote:
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -71,3 +71,11 @@ 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}"
> +
> +do_isar_sdk() {
> +}
> +
> +do_isar_sdk[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> +do_isar_sdk[depends] = "sdkchroot:do_build"
Yocto SDK is generated as follows [1]:
bitbake -c populate_sdk core-image-base
or in the older way [2]:
bitbake meta-toolchain
The latter doesn't include local target stuff like libhello-dev in the sysroot.
The SDK is provided as a self-extracting script under build/tmp/deploy/sdk
(e.g., product-glibc-i686-meta-toolchain-armhf-toolchain-2.0.sh). Executed with
a directory as an argument, it extracts the files there. In the directory,
there is an environment setup script (e.g.,
environment-setup-armhf-product-linux) that sets the vars used for building
(attached).
We could use populate_sdk and meta-toolchain as user-visible task and recipe
names (keeping the sdkchroot directory name to follow buildchroot and
buildchroot-cross). Advantages:
* Pick up developers familiar with Yocto.
* UX harmonization with Deby and ELBE using poky as base layer.
Disadvantages:
* People coming from Yocto might be surprised to find a chroot tarball instead
of a self-extractor and environment setup script.
What do you think?
Possible future extensions:
* Generate environment-setup for using without chrooting.
* Generate complete VM images for specific virtualization environments.
That would eliminate the sudo requirement for users.
References:
1. https://www.yoctoproject.org/docs/2.5/adt-manual/adt-manual.html#sdk-building-an-sdk-installer
2. https://www.yoctoproject.org/docs/1.6.1/adt-manual/adt-manual.html#optionally-building-a-toolchain-installer
With kind regards,
Baurzhan.
[-- Attachment #2: environment-setup-armhf-product-linux --]
[-- Type: text/plain, Size: 3138 bytes --]
export SDKTARGETSYSROOT=/opt/product/2.0/sysroots/armhf-product-linux
export PATH=/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/sbin:/opt/product/2.0/sysroots/i686-productsdk-linux/bin:/opt/product/2.0/sysroots/i686-productsdk-linux/sbin:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin/../i686-productsdk-linux/bin:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin/i686-product-linux:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin/i686-product-linux-uclibc:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin/i686-product-linux-musl:$PATH
export CCACHE_PATH=/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin/../i686-productsdk-linux/bin:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin/i686-product-linux:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin/i686-product-linux-uclibc:/opt/product/2.0/sysroots/i686-productsdk-linux/usr/bin/i686-product-linux-musl:$CCACHE_PATH
export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT
export PKG_CONFIG_PATH=$SDKTARGETSYSROOT/usr/lib/pkgconfig:$SDKTARGETSYSROOT/usr/share/pkgconfig
export CONFIG_SITE=/opt/product/2.0/site-config-armhf-product-linux
export OECORE_NATIVE_SYSROOT="/opt/product/2.0/sysroots/i686-productsdk-linux"
export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"
export OECORE_ACLOCAL_OPTS="-I /opt/product/2.0/sysroots/i686-productsdk-linux/usr/share/aclocal"
unset command_not_found_handle
export CC="i686-product-linux-gcc -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=$SDKTARGETSYSROOT"
export CXX="i686-product-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=$SDKTARGETSYSROOT"
export CPP="i686-product-linux-gcc -E -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=$SDKTARGETSYSROOT"
export AS="i686-product-linux-as "
export LD="i686-product-linux-ld --sysroot=$SDKTARGETSYSROOT"
export GDB=i686-product-linux-gdb
export STRIP=i686-product-linux-strip
export RANLIB=i686-product-linux-ranlib
export OBJCOPY=i686-product-linux-objcopy
export OBJDUMP=i686-product-linux-objdump
export AR=i686-product-linux-ar
export NM=i686-product-linux-nm
export M4=m4
export TARGET_PREFIX=i686-product-linux-
export CONFIGURE_FLAGS="--target=i686-product-linux --host=i686-product-linux --build=i686-linux --with-libtool-sysroot=$SDKTARGETSYSROOT"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu"
export CPPFLAGS=""
export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"
export OECORE_DISTRO_VERSION="2.0"
export OECORE_SDK_VERSION="2.0"
export ARCH=x86
export CROSS_COMPILE=i686-product-linux-
# Append environment subscripts
if [ -d "$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then
for envfile in $OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do
. $envfile
done
fi
if [ -d "$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
for envfile in $OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do
. $envfile
done
fi
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 0/6] ISAR SDK root filesystem
2018-06-18 7:08 ` Henning Schild
@ 2018-06-19 7:33 ` Maxim Yu. Osipov
0 siblings, 0 replies; 22+ messages in thread
From: Maxim Yu. Osipov @ 2018-06-19 7:33 UTC (permalink / raw)
To: Henning Schild; +Cc: isar-users
On 06/18/2018 09:08 AM, Henning Schild wrote:
> Am Thu, 14 Jun 2018 11:46:23 +0200
> schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:
>
>> On 06/14/2018 10:48 AM, Henning Schild wrote:
>> <snip>
>>>> 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).
>>>
>>> Are we ready for buster? Not many people care about the past, but
>>> let us make sure this will work in the future.
>>
>> Your patch regarding buster support is still pending as additional
>> feedback from you is needed (see email below I've sent you a week
>> ago).
>
> Ok, i will look into the buster-wic thing. But my question is whether
> the SDK/crossbuild approach that works for stretch will also work for
> buster.
I didn't install buster, but from the first glance, approach should work
for buster too as crossbuild-essential-* packages are shipped by default
with buster (see f.e.
ftp://ftp.de.debian.org/debian/dists/buster/main/binary-amd64/Packages.gz).
Kind regards,
Maxim.
> Henning
>
>> 8<---
>>> -------- Forwarded Message --------
>>> Subject: Re: [PATCHv2 2/2] conf: Add support for new debian distro
>>> "buster" Date: Thu, 7 Jun 2018 11:53:13 +0200
>>> From: Maxim Yu. Osipov <mosipov@ilbers.de>
>>> Organization: ilbers GmbH
>>> To: Henning Schild <henning.schild@siemens.com>,
>>> isar-users@googlegroups.com CC: Alexander Smirnov
>>> <asmirnov@ilbers.de>
>>>
>>> Hello Henning,
>>>
>>> Did you experience the problem Alexander reported in email below?
>>>
>>> Kind regards,
>>> Maxim.
>>>
>>> On 05/27/2018 09:54 PM, Alexander Smirnov wrote:
>>>> Hi Henning,
>>>>
>>>> thank you for the first patch, now there is no problem with
>>>> trusted repo. But there is another issue with wic:
>>>>
>>>> 8<--
>>>> ERROR: mc:qemui386-buster:isar-image-base-1.0-r0 do_wic_image:
>>>> Function failed: do_wic_image (log file is located at
>>>> /home/builder/isar/build/tmp/work/debian-buster-i386/isar-image-base/temp/log.do_wic_image.6282)
>>>>
>>
>> 8<---
>>
>>
>>>> Example
>>>>
>>>> - Trigger creation of SDK root filesystem
>>>>
>>>>
>>>> bitbake -c do_isar_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 mount_chroot.sh
>>>> #!/bin/bash
>>>> sudo mount /tmp $1/tmp -o bind
>>>> sudo mount proc $1/proc -t proc -o nosuid,noexec,nodev
>>>> sudo mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev
>>>> sudo mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid
>>>> sudo mount devpts $1/dev/pts -t devpts -o gid=5,mode=620
>>>> sudo mount tmpfs $1/dev/shm -t tmpfs -o
>>>> rw,seclabel,nosuid,nodev
>>>>
>>>> $ ./mount_chroot.sh ./build/tmp/work/debian-stretch-armhf/sdkchroot/rootfs
>>>
>>> Imagine this being copied over to a totally different Linux-distro
>>> or into a docker container.
>>>
>>> The "sudos" should not be in the script. So people can choose to not
>>> use sudo at all or call the script with sudo.
>>
>> OK.
>>
>>> Maybe adding a Dockerfile would be a good idea to understand more
>>> such implications.
>>>
>>> Henning
>>
>> Kind regards,
>> Maxim.
>
--
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] 22+ messages in thread
end of thread, other threads:[~2018-06-19 7:33 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-13 13:58 [RFC PATCH 0/6] ISAR SDK root filesystem Maxim Yu. Osipov
2018-06-13 13:58 ` [RFC PATCH 1/6] isar-bootstrap-helper: Add option --copyrepo to setup_root_file_system() Maxim Yu. Osipov
2018-06-14 8:51 ` Henning Schild
2018-06-13 13:58 ` [RFC PATCH 2/6] isar-debootstrap: split into host and target recipes Maxim Yu. Osipov
2018-06-14 8:59 ` Henning Schild
2018-06-13 13:58 ` [RFC PATCH 3/6] sdkchroot: Added recipe-devel to create SDK root filesystem Maxim Yu. Osipov
2018-06-14 9:19 ` Henning Schild
2018-06-14 10:46 ` Maxim Yu. Osipov
2018-06-14 11:07 ` Henning Schild
2018-06-13 13:58 ` [RFC PATCH 4/6] meta/class/image: Add do_isar task to trigger SDK rootfs creation Maxim Yu. Osipov
2018-06-14 9:23 ` Henning Schild
2018-06-14 11:49 ` Maxim Yu. Osipov
2018-06-18 9:56 ` Baurzhan Ismagulov
2018-06-13 13:58 ` [RFC PATCH 5/6] scripts: Add helper scripts to mount/umount chroot directory Maxim Yu. Osipov
2018-06-14 9:28 ` Henning Schild
2018-06-13 13:58 ` [RFC PATCH 6/6] doc: Add description of ISAR SDK root filesystem creation Maxim Yu. Osipov
2018-06-14 8:48 ` [RFC PATCH 0/6] ISAR SDK root filesystem Henning Schild
2018-06-14 8:51 ` Jan Kiszka
2018-06-14 9:34 ` Henning Schild
2018-06-14 9:46 ` Maxim Yu. Osipov
2018-06-18 7:08 ` Henning Schild
2018-06-19 7:33 ` 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