From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6704144668026732544 X-Received: by 2002:a5d:4849:: with SMTP id n9mr63131523wrs.139.1560942616676; Wed, 19 Jun 2019 04:10:16 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:a2cd:: with SMTP id t13ls456201wra.8.gmail; Wed, 19 Jun 2019 04:10:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwX/mulDD6po2SXRUgvbYsy16LhZhkcR38hTJ7doliJyNw2IjO9+pC91vJ6U7R+O0ZmbPVQ X-Received: by 2002:adf:fecd:: with SMTP id q13mr16318137wrs.97.1560942616292; Wed, 19 Jun 2019 04:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560942616; cv=none; d=google.com; s=arc-20160816; b=YALKgCiq7YlkX7929r6mpeemJ2/kVQdxC/yN/MaP9+bhwV7HhBVXhdvkDL9fp9MmSt TpeuRSJIpGuD89G+nnVUwyNR4vU6fv1yV3Meai5NsmCN9xUbD50AnVeyNSeF+39giy4n 9n1dVNsiN6DFnmzM8SbuCE+UBp09hdp3DzWFyx2jnBVJ5QC8l8sSf0pENvbAizM1OD1/ NaP1PdeiU79+v21JqL8gHufktOSqAsFF3ksNAdaYKzN31jh1eNIWlm7QCHy1El1OuQ4z f9FxSpgzS1t0Y7oZ5YS2SaxaMH/K9gTLdIB7AFbE5SuCv0B/Ih6bs+MzF23GVPJbkhdr Rp8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date; bh=zblKi3lIxIVTXBbILW8cTOBv6UM0vZHVTVzpBu1swbI=; b=P20tjvjfagxa45vKdWaNbbaGLYzqXdv6ytiM6y3dDDaQyKF8YppRE4lZbfN2jKbF/f 2KvB6EajaFrfdnEpRiDj7U2a9HASeYtl+SQXxpianXBW0G9yT0TkeZTbw8SPOoaSqqU4 4w6o4nR1/XOiX8d5MQsJ7iQNv9bg5Z1kN4bbJYrS2RWI6zxEUOL8sk/dS5fJBsyLV5zr OYogVT6yEXz6N4p0UUdc2S+3mygA16J/ax83hERU8XLCSklTf8OBojbnCddc3Cp/VZpM egO2BR7nASvGAOgISarD/5WcyGNnBTZsb4PB0k7IKLItSJk4IgwzeC3Rxn/vpoWneoOI PFdQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id m18si534670wrb.2.2019.06.19.04.10.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 04:10:16 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) client-ip=194.138.37.40; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id x5JBAFwV015748 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 13:10:15 +0200 Received: from md1za8fc.ad001.siemens.net ([139.25.68.171]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x5JBAFBA014930; Wed, 19 Jun 2019 13:10:15 +0200 Date: Wed, 19 Jun 2019 13:10:14 +0200 From: Henning Schild To: "[ext] Jan Kiszka" Cc: , isar-users Subject: Re: [QUERY] wic running in buildchroot-target Message-ID: <20190619131014.369a3834@md1za8fc.ad001.siemens.net> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-TUID: 33OxjbPSNxaD Am Wed, 19 Jun 2019 12:28:45 +0200 schrieb "[ext] Jan Kiszka" : > On 19.06.19 09:45, chombourger@gmail.com wrote: > > Hello all, > >=20 > > I am continuing my journey on the MIPS architecture. > > I wanted to add wks files for my MIPS target (Creator Ci40) and Sweet, we can provide you with a RISC-V board next ;). > > do_wic_image failed: > >=20 > > INFO: Creating image(s)... > >=20 > > -rw-r--r-- 1 root root 697932185 Jun 18 13:34=20 > > /tmp/development-image-mel-omni-img-creator-ci40.wic/tmp.wic.n3m8x3xo/r= ootfs_platforma.1.ext4 > > Unsupported ioctl: cmd=3D0x0002 > > Traceback (most recent call last): > > =C2=A0 File > > "/home/chombourger/Projects/isar/scripts/lib/wic/filemap.py", line > > 40, in get_block_size binary_data =3D fcntl.ioctl(file_obj, 2, > > struct.pack('I', 0)) OSError: [Errno 89] Function not implemented > >=20 > > During handling of the above exception, another exception occurred: > >=20 > > Traceback (most recent call last): > > =C2=A0 File > > "/home/chombourger/Projects/isar/scripts/lib/wic/filemap.py", line > > 103, in __init__ self.block_size =3D get_block_size(self._f_image) > > =C2=A0 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 > >=20 > > wic appears to be running from buildchroot-target and therefore > > under qemu--static > > evidently mips does not implement the=C2=A0FIGETBSZ ioctl > >=20 > > My options would be: > >=20 > > (1) check if a more recent version of qemu does implement this ioctl > > (2) add support for this ioctl in qemu-user =20 >=20 > Support for that IOCTL seems arch-independent, but maybe the > qemu-user build was just missing some define: >=20 > qemu/linux-user/ioctls.h > /* emulated ioctl list */ > ... > #ifdef FIGETBSZ > IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG)) > #endif >=20 > But this is better discussed on qemu-devel. You are using qemu from > buster already, right? >=20 > > (3) work-around it in wic with something like: > >=20 > > 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): > > =C2=A0 =C2=A0 =C2=A0# Get the block size of the host file-system for t= he image > > file by calling # the FIGETBSZ ioctl (number 2). > > -=C2=A0 =C2=A0 binary_data =3D ioctl(file_obj, 2, struct.pack('I', 0)) > > -=C2=A0 =C2=A0 return struct.unpack('I', binary_data)[0] > > +=C2=A0 =C2=A0 try: > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 binary_data =3D ioctl(file_obj, 2, struct.= pack('I', 0)) > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return struct.unpack('I', binary_data)[0] > > +=C2=A0 =C2=A0 except OSError as err: > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if err.errno =3D=3D os.errno.ENOSYS: > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 4096 > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 raise err > > =C2=A0class ErrorNotSupp(Exception): > > =C2=A0 =C2=A0 =C2=A0""" > >=20 > > Ok. =20 >=20 > wic patches should go upstream first. We avoid patching it. In fact we carry a pretty old version of wic (unpatched), and looking into updating that is somewhere on the Isar TODO list. That might be fixed in upstream wic, or might be an issue to bring up there to motivate the patch. But upstream wic would never run on mips ... so maybe not. Henning > >=20 > > 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 !=3D amd64 > >=20 > > What are your thoughts? =20 >=20 > I do not remember all details, there might be technical difficulties, > e.g. when you need to u-boot tools from a custom build, and that > build is currently not generating native packages. But the killer > argument is: CROSS_COMPILE is only optional. The default and > production case is native (via qemu-user). Debian is not a fully > cross-buildable distro, like most others. >=20 > Jan >=20