public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: chombourger@gmail.com
To: isar-users <isar-users@googlegroups.com>
Subject: [QUERY] wic running in buildchroot-target
Date: Wed, 19 Jun 2019 00:45:18 -0700 (PDT)	[thread overview]
Message-ID: <dc8e43dc-5e9f-42d5-be12-329abc453926@googlegroups.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2480 bytes --]

Hello all,

I am continuing my journey on the MIPS architecture.
I wanted to add wks files for my MIPS target (Creator Ci40) and 
do_wic_image failed:

INFO: Creating image(s)...

-rw-r--r-- 1 root root 697932185 Jun 18 13:34 
/tmp/development-image-mel-omni-img-creator-ci40.wic/tmp.wic.n3m8x3xo/rootfs_platforma.1.ext4
Unsupported ioctl: cmd=0x0002
Traceback (most recent call last):
  File "/home/chombourger/Projects/isar/scripts/lib/wic/filemap.py", line 
40, in get_block_size
    binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0))
OSError: [Errno 89] Function not implemented

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chombourger/Projects/isar/scripts/lib/wic/filemap.py", line 
103, in __init__
    self.block_size = get_block_size(self._f_image)
  File "/home/chombourger/Projects/isar/scripts/lib/wic/filemap.py", line 
42, in get_block_size
    raise IOError("Unable to determine block size")
OSError: Unable to determine block size

wic appears to be running from buildchroot-target and therefore under 
qemu-<arch>-static
evidently mips does not implement the FIGETBSZ ioctl

My options would be:

(1) check if a more recent version of qemu does implement this ioctl
(2) add support for this ioctl in qemu-user
(3) work-around it in wic with something like:

diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 080668e..1ce3ace 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -40,8 +40,13 @@ def get_block_size(file_obj):
 
     # Get the block size of the host file-system for the image file by 
calling
     # the FIGETBSZ ioctl (number 2).
-    binary_data = ioctl(file_obj, 2, struct.pack('I', 0))
-    return struct.unpack('I', binary_data)[0]
+    try:
+        binary_data = ioctl(file_obj, 2, struct.pack('I', 0))
+        return struct.unpack('I', binary_data)[0]
+    except OSError as err:
+        if err.errno == os.errno.ENOSYS:
+            return 4096
+        raise err
 
 class ErrorNotSupp(Exception):
     """

Ok.

But why are we running wic in buildchroot-target. Comments I have seen in 
the code only say that it is a prerequisite but do not say why (I should 
probably check git logs as well)
I wonder if it should run in buildchroot-host context instead (so we still 
use a host environment we control) but avoid the overhead of qemu emulation 
for DISTRO_ARCH != amd64

What are your thoughts?

Cedric


[-- Attachment #1.2: Type: text/html, Size: 3334 bytes --]

             reply	other threads:[~2019-06-19  7:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19  7:45 chombourger [this message]
2019-06-19 10:28 ` Jan Kiszka
2019-06-19 11:10   ` Henning Schild
2019-06-19 11:31     ` Jan Kiszka
2019-06-19 13:44     ` chombourger

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=dc8e43dc-5e9f-42d5-be12-329abc453926@googlegroups.com \
    --to=chombourger@gmail.com \
    --cc=isar-users@googlegroups.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