public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Srinuvasan Arjunan <srinuvasan_a@mentor.com>
To: <isar-users@googlegroups.com>
Cc: <jan.kiszka@siemens.com>, <amikan@ilbers.de>,
	<adriaan.schmidt@siemens.com>,
	Srinuvasan A <srinuvasan_a@mentor.com>
Subject: [PATCH v2] meta/classes/sdk.bbclass: add --transform in TAR_OPTIONS
Date: Wed, 19 Apr 2023 19:39:40 +0530	[thread overview]
Message-ID: <20230419140940.1268690-1-srinuvasan_a@mentor.com> (raw)
In-Reply-To: <CAB2Z2nOZkSJ9HJCLHSybJmK5AXOh+9ELWCRQSDn44ToqSSUkdg@mail.gmail.com>

From: Srinuvasan A <srinuvasan_a@mentor.com>

When we untar the SDK rootfs archive file, all the contents are extracted
into the current directory, not a folder, this looks ugly hence fixed
it with the file name transformations option.

But the below transform pattern not works, specifically with the symlink
TAR_OPTIONS:append:class-sdk = " --transform="s|.|${IMAGE_FULLNAME}|""

instead of changedir -C with {PP_ROOTFS} and choose all files (.),
use {PP} and choose rootfs dir, now by default extracted into a rootfs
sub folder, in this case --transform works fine with the filename.

Updated the document as well.

Signed-off-by: Srinuvasan A <srinuvasan_a@mentor.com>
---
 doc/user_manual.md              | 20 ++++++++++----------
 meta/classes/imagetypes.bbclass |  2 +-
 meta/classes/sdk.bbclass        |  1 +
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/doc/user_manual.md b/doc/user_manual.md
index 92075a8..60b7ca9 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1063,8 +1063,8 @@ User manually triggers creation of SDK root filesystem for his target platform b
 `bitbake -c do_populate_sdk mc:${MACHINE}-${DISTRO}:isar-image-base`.
 Packages that should be additionally installed into the SDK can be appended to `SDK_PREINSTALL` (external repositories) and `SDK_INSTALL` (self-built).
 
-The resulting SDK rootfs is archived into `tmp/deploy/images/${MACHINE}/sdk-${DISTRO}-${DISTRO_ARCH}.tar.xz`.
-It is additionally available for direct use under `tmp/deploy/images/${MACHINE}/sdk-${DISTRO}-${DISTRO_ARCH}/`.
+The resulting SDK rootfs is archived into `tmp/deploy/images/${MACHINE}/${IMAGE_FULLNAME}.tar.xz`.
+Once you untar the compressed file, the content will be extracted into the ${IMAGE_FULLNAME} sub folder.
 The SDK rootfs directory `/isar-apt` contains a copy of isar-apt repo with locally prebuilt target debian packages (for <HOST_DISTRO>).
 One may chroot into the SDK and install required target packages with the help of `apt-get install <package_name>:<DISTRO_ARCH>` command.
 
@@ -1073,7 +1073,7 @@ One may chroot into the SDK and install required target packages with the help o
  - Trigger creation of SDK root filesystem
 
 ```
-bitbake -c do_populate_sdk mc:qemuarm-buster:isar-image-base
+bitbake -c do_populate_sdk mc:qemuarm-bullseye:isar-image-base
 ```
 
  - Mount the following directories in chroot by passing resulting rootfs as an argument to the script `mount_chroot.sh`:
@@ -1091,14 +1091,14 @@ 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/deploy/images/qemuarm/sdk-debian-buster-armhf
+$ sudo scripts/mount_chroot.sh ../build/tmp/deploy/images/qemuarm/isar-image-base-sdk-debian-bullseye-qemuarm
 
 ```
 
  - chroot to isar SDK rootfs:
 
 ```
-$ sudo chroot build/tmp/deploy/images/qemuarm/sdk-debian-buster-armhf
+$ sudo chroot build/tmp/deploy/images/qemuarm/isar-image-base-sdk-debian-bullseye-qemuarm
 ```
  - Check that cross toolchains are installed
 
@@ -1190,7 +1190,7 @@ Daemon socket) accessible in the container.
 What can endanger the stability and security of the host.
 
 The resulting SDK formats are archived into 
-`tmp/deploy/images/${MACHINE}/sdk-${DISTRO}-${DISTRO_ARCH}-${sdk_format}.tar.xz` 
+`tmp/deploy/images/${MACHINE}/isar-image-base-sdk-${DISTRO}-${DISTRO_ARCH}-${sdk_format}.tar.xz`
 (being `sdk_format` each one of the formats specified in `SDK_FORMATS`).
 The SDK container directory `/isar-apt` contains a copy of isar-apt repo with 
 locally prebuilt target debian packages (for <HOST_DISTRO>).
@@ -1207,27 +1207,27 @@ to edit files in the host with an IDE and build in the container.
 For one-shot builds (use `local.conf` otherwise):
 
 ```
-export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE SDK_FORMATS"
+export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_EXTRAWHITE SDK_FORMATS"
 export SDK_FORMATS="docker-archive"
 ```
 
  - Trigger creation of SDK root filesystem
 
 ```
-bitbake -c do_populate_sdk mc:qemuarm-buster:isar-image-base
+bitbake -c do_populate_sdk mc:qemuarm-bullseye:isar-image-base
 ```
 
  - Load the SDK container image into the Docker Daemon
 
 ```
-docker load -i build/tmp/deploy/images/qemuarm/sdk-isar-image-base-debian-buster-armhf-1.0-r0-docker-archive.tar.xz
+docker load -i build/tmp/deploy/images/qemuarm/isar-image-base-sdk-debian-bullseye-armhf-1.0-r0-docker-archive.tar.xz
 ```
 
  - Run a container using the SDK container image (following commands starting 
    with `#~:` are to be run in the container)
 
 ```
-docker run --rm -ti --volume "$(pwd):/build" sdk-isar-image-base-debian-buster-armhf:1.0-r0
+docker run --rm -ti --volume "$(pwd):/build" isar-image-base-sdk-debian-bullseye-armhf:1.0-r0
 ```
 
  - Check that cross toolchains are installed
diff --git a/meta/classes/imagetypes.bbclass b/meta/classes/imagetypes.bbclass
index 2ee3240..e476778 100644
--- a/meta/classes/imagetypes.bbclass
+++ b/meta/classes/imagetypes.bbclass
@@ -9,7 +9,7 @@ TAR_OPTIONS ?= ""
 
 IMAGE_CMD:tar() {
     ${SUDO_CHROOT} tar ${TAR_OPTIONS} -cvSf \
-                 ${IMAGE_FILE_CHROOT} --one-file-system -C ${PP_ROOTFS} .
+                 ${IMAGE_FILE_CHROOT} --one-file-system -C ${PP} rootfs
 }
 
 # image type: ext4
diff --git a/meta/classes/sdk.bbclass b/meta/classes/sdk.bbclass
index 06cae02..c6dc689 100644
--- a/meta/classes/sdk.bbclass
+++ b/meta/classes/sdk.bbclass
@@ -53,6 +53,7 @@ ROOTFS_MANIFEST_DEPLOY_DIR:class-sdk = "${DEPLOY_DIR_SDKCHROOT}"
 ROOTFS_DPKGSTATUS_DEPLOY_DIR:class-sdk = "${DEPLOY_DIR_SDKCHROOT}"
 
 IMAGE_FSTYPES:class-sdk = "${SDK_FORMATS}"
+TAR_OPTIONS:append:class-sdk = " --transform="s|rootfs|${IMAGE_FULLNAME}|""
 
 # bitbake dependencies
 SDKDEPENDS += "sdk-files ${SDK_INSTALL}"
-- 
2.34.1


  reply	other threads:[~2023-04-19 14:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31  8:49 [PATCH] " Srinuvasan Arjunan
2023-03-31  9:06 ` Schmidt, Adriaan
2023-03-31 10:33   ` Srinuvasan Arjunan
2023-04-03 10:01     ` Srinuvasan Arjunan
2023-04-05 10:40       ` Schmidt, Adriaan
2023-04-05 10:57     ` Jan Kiszka
2023-04-12 13:38       ` Srinuvasan Arjunan
2023-04-19 14:09         ` Srinuvasan Arjunan [this message]
2023-04-24 10:43           ` [PATCH v2] " Srinuvasan Arjunan
2023-05-08 17:57           ` Anton Mikanovich
2023-09-25 10:55           ` Jan Kiszka
2023-09-28  8:26             ` Gylstorff Quirin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230419140940.1268690-1-srinuvasan_a@mentor.com \
    --to=srinuvasan_a@mentor.com \
    --cc=adriaan.schmidt@siemens.com \
    --cc=amikan@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox