From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6569888326546882560 X-Received: by 2002:a2e:98c8:: with SMTP id s8-v6mr59940ljj.14.1529671332031; Fri, 22 Jun 2018 05:42:12 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:8001:: with SMTP id j1-v6ls984554ljg.16.gmail; Fri, 22 Jun 2018 05:42:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKTFOI6h1sw0pnfwiwjxfrdoV2LY3zxANX8QPegWfIPHOy/7mzx5Ake5cWSqo5SrqOuxg9Q X-Received: by 2002:a2e:9e83:: with SMTP id f3-v6mr56161ljk.16.1529671331723; Fri, 22 Jun 2018 05:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529671331; cv=none; d=google.com; s=arc-20160816; b=uvgzle3UdPq9fOtvN50ogkeu+JVOsuFBRqg6v3opEWN8r692ASC+M6Qj2TCo1Pvi/3 ldN6sFi9Eyn+J2Ygeg+09Bd1N6nBCavAn1UlqXcqXDQvuZzeOCIcuvZTwybyVZxFRw+z jpYD9nTU4pJ2AftCh2+8Ych6NyIU7M2w2B6YhVw/NjR3UY+mqqmxMSHEt2f7Y4Apb6oN g4JNmy2DaB9Mi6rvbMDZi3q3x7CS+8wpF76f/7GYCef79UU2EXLMsu0WbTSYqKvgGQke kY8PX+eacLjH/bU38aTDZ3TRPe7bP5hDEHDiODXMA8oMdYZGkZ22b5F+W+Y+juO3HFXU zVSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :arc-authentication-results; bh=D6qvmR2vLm++d7dOntO8PG3xlMNvX1xdiFtBqTQVwdg=; b=wruaFbAULMUY57tSfOG2pe/au2qnMIdgUNVkOeS/gc/7+CImGGB0YUMLOa/2yq3fFO 67If3Qom+/dO6jd1SLoLMTNpf+1NZZpU4RzfQBAJGErxh8yMpAukkO556pgGrbqF6a1b eGHcUX1Tyiu/n9xy3irof5c+OcnKt3SuecULcCBkh3Z9Mn+qX5g3N+kTGopVCDF6yykY XtnhN+R9jgrhn4WB7Dd9c7Jw2TWH8zhGjMkZFVqQx150pTcg5j4znKU/y1xEO7tyGI/2 XEOrKx5BtN955ZXUkkUlWNzHgZbWVPcl7Spy3rqHVCKjuBxEUXDiSmzE50Y4aipyegAo n3hg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id y20-v6si283227ljh.2.2018.06.22.05.42.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jun 2018 05:42:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Received: from azat.i.ilbers.de (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w5MCeN8S030516 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Fri, 22 Jun 2018 14:42:10 +0200 From: "Maxim Yu. Osipov" To: isar-users@googlegroups.com Subject: [PATCH v2 7/7] doc: Add description of ISAR SDK root filesystem creation Date: Fri, 22 Jun 2018 14:40:22 +0200 Message-Id: <20180622124022.30192-8-mosipov@ilbers.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180622124022.30192-1-mosipov@ilbers.de> References: <20180622124022.30192-1-mosipov@ilbers.de> X-TUID: 8+8SnqKn1TCX Signed-off-by: Maxim Yu. Osipov --- doc/user_manual.md | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/doc/user_manual.md b/doc/user_manual.md index 9921f3a..3263bf2 100644 --- a/doc/user_manual.md +++ b/doc/user_manual.md @@ -17,6 +17,7 @@ Copyright (C) 2016-2017, ilbers GmbH - [Add a New Image](https://github.com/ilbers/isar/blob/master/doc/user_manual.md#add-a-new-image) - [Add a New Image Type](https://github.com/ilbers/isar/blob/master/doc/user_manual.md#add-a-new-image-type) - [Add a Custom Application](https://github.com/ilbers/isar/blob/master/doc/user_manual.md#add-a-custom-application) + - [Create an ISAR SDK root filesystem](https://github.com/ilbers/isar/blob/master/doc/user_manual.md#create-an-isar-sdk-root-filesystem) ## Introduction @@ -320,6 +321,10 @@ Some other variables include: - `BB_NUMBER_THREADS` - The number of `bitbake` jobs that can be run in parallel. Please set this option according your host CPU cores number. - `LOCALE_GEN` - A `\n` seperated list of `/etc/locale.gen` entries desired on the target. - `LOCALE_DEFAULT` - The default locale used for the `LANG` and `LANGUAGE` variable in `/etc/locale`. + - `HOST_DISTRO` - The distro to use for SDK root filesystem (so far limited only to `debian-stretch`). This variable is optional. + - `HOST_ARCH` - The Debian architecture of SDK root filesystem (e.g., `amd64`). By default set to current Debian host architecture. This variable is optional. + - `HOST_DISTRO_APT_SOURCES` - List of apt source files for SDK root filesystem. This variable is optional. + - `HOST_DISTRO_APT_PREFERENCES` - List of apt preference files for SDK root filesystem. This variable is optional. --- @@ -574,3 +579,93 @@ For the variables please have a look at the previous example, the following new - `DEBIAN_DEPENDS` - Debian packages that the package depends on Have a look at the `example-raw` recipe to get an idea how the `dpkg-raw` class can be used to customize your image. + +## Create an ISAR SDK root filesystem + +### Motivation + +Building applications for targets in ISAR takes a lot of time as they are built under QEMU. +SDK providing crossbuild environment will help to solve this problem. + +### Approach + +Create SDK root file system for host with installed cross-toolchain for target architecture and ability to install already prebuilt +target binary artifacts. Developer chroots to sdk rootfs and develops applications for target platform. + +### Solution + +User manually triggers creation of SDK root filesystem for his target platform by launching the task `do_populate_sdk` for target image, f.e. +`bitbake -c do_populate_sdk multiconfig:${MACHINE}-${DISTRO}:isar-image-base`. + +The resulting SDK rootfs is located under `tmp/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}/rootfs`. +SDK rootfs directory `/isar-apt` contains the copy of isar-apt repo with locally prebuilt target debian packages (for ). +One may chroot to SDK and install required target packages with the help of `apt-get install :` command. + +### Limitation + +Only Debian Stretch for SDK root filesystem is supported as only Stretch provides crossbuild environment by default. +(Debian Jessie requires some additional preconfiguration steps see https://wiki.debian.org/CrossToolchains#Installation for details). + +### Example + + - Trigger creation of SDK root filesystem + +``` +bitbake -c do_populate_sdk multiconfig:qemuarm-stretch:isar-image-base +``` + + - Mount the following directories in chroot by passing resulting rootfs as an argument to the script `mount_chroot.sh`: + +``` +cat scripts/mount_chroot.sh +#!/bin/sh + +set -e + +mount /tmp $1/tmp -o bind +mount proc $1/proc -t proc -o nosuid,noexec,nodev +mount sysfs $1/sys -t sysfs -o nosuid,noexec,nodev +mount devtmpfs $1/dev -t devtmpfs -o mode=0755,nosuid +mount devpts $1/dev/pts -t devpts -o gid=5,mode=620 +mount tmpfs $1/dev/shm -t tmpfs -o rw,seclabel,nosuid,nodev + +$ sudo scripts/mount_chroot.sh ../build/tmp/work/debian-stretch-armhf/sdkchroot-debian-stretch-amd64/rootfs +``` + + - chroot to isar SDK rootfs: + +``` +$ sudo chroot ../build/tmp/work/debian-stretch-armhf/sdkchroot-debian-stretch-amd64/rootfs +``` + - Check that cross toolchains are installed + +``` +:~# dpkg -l | grep crossbuild-essential-armhf +ii crossbuild-essential-armhf 12.3 all Informational list of cross-build-essential packages +``` + + - Install needed prebuilt target packages. + +``` +:~# apt-get install libhello-dev:armhf +``` + + - Check the contents of the installed target package + +``` +:~# dpkg -L libhello-dev +/. +/usr +/usr/include +/usr/include/hello.h +/usr/lib +/usr/lib/arm-linux-gnueabihf +/usr/lib/arm-linux-gnueabihf/libhello.a +/usr/lib/arm-linux-gnueabihf/libhello.la +/usr/share +/usr/share/doc +/usr/share/doc/libhello-dev +/usr/share/doc/libhello-dev/changelog.gz +/usr/share/doc/libhello-dev/copyright +~# +``` -- 2.11.0