public inbox for gentoo-soc@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-soc] cross_container_support - progress report #7
@ 2012-07-10 13:31 Jing Huang
  2012-07-10 14:12 ` Luca Barbato
  0 siblings, 1 reply; 2+ messages in thread
From: Jing Huang @ 2012-07-10 13:31 UTC (permalink / raw
  To: lu_zero, gentoo-soc

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

Hi,

   == Progress of last Week ==

In the last week, I continue to debug the lxc script for arm-gentoo
container and investigate how to execute x86 program in arm container.


First, I try to fix the ping issues in qemu-user of arm-gentoo
container. The patch is attached.

* The do_setsockopts function in qemu-user does not support SOL_RAW
socket which is used in ping program.

* The recvmsg in main_loop of ping_common.c could not fetch
sockaddr_in struct. That is because do_sendrecvmsg in qemu-user does
not pass the msg->msg_name to the target.
So the ping will show "64 bytes from 0.0.0.0: icmp_req=1 ttl=64 time=1.16 ms".


Second, I am investigating how to execute local gcc toolchain in
arm-gentoo container.

At begging, I want to use ldd to parse each cross-gcc toolchain
executable in arm container. Then copy the related libraries to
gentoo-arm rootfs and config the ld.so.conf to make cross-gcc running
locally.

Now, I think I could modify the crossdev script and build cross-gcc
with LDFLAGS="-static". So the cross-gcc can be executed locally in
arm-gentoo container.


I have about one week behind the schedule. I hope I could catch up it
as soon as possible.


Jing.

[-- Attachment #2: support-to-guest-ping-nettool.patch --]
[-- Type: application/octet-stream, Size: 1800 bytes --]

diff -ruN a/linux-user/syscall.c b/linux-user/syscall.c
--- a/linux-user/syscall.c	2012-07-06 13:23:47.000000000 +0000
+++ b/linux-user/syscall.c	2012-07-10 04:22:20.000000000 +0000
@@ -1349,7 +1349,14 @@
         target_cmsg->cmsg_len = tswapal(TARGET_CMSG_LEN(len));
 
         if (cmsg->cmsg_level != TARGET_SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
-            gemu_log("Unsupported ancillary data: %d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type);
+            if(cmsg->cmsg_type == SO_TIMESTAMP) {
+               /*copy msg_name to target_msgh*/
+               target_msgh->msg_namelen = msgh->msg_namelen;
+               memcpy(g2h((void *)(unsigned long)(target_ulong)target_msgh->msg_name), msgh->msg_name, msgh->msg_namelen);
+            } else {
+               gemu_log("Unsupported ancillary data: %d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type);
+            }
             memcpy(target_data, data, len);
         } else {
             int *fd = (int *)data;
@@ -1442,6 +1449,23 @@
             goto unimplemented;
         }
         break;
+        case SOL_RAW:
+            switch (optname) {
+#define ICMP_FILTER 1
+                case ICMP_FILTER:
+                /*struct icmp_filter takes an u32 value*/
+                    optname = ICMP_FILTER;
+                    if (optlen < sizeof(uint32_t))
+                        return -TARGET_EINVAL;
+
+                    if (get_user_u32(val, optval_addr))
+                        return -TARGET_EFAULT;
+                    ret = get_errno(setsockopt(sockfd, level, optname, (char *)&val, sizeof(val)));
+                    break;
+            default:
+                goto unimplemented;
+        }
+    break;
     case TARGET_SOL_SOCKET:
         switch (optname) {
             /* Options with 'int' argument.  */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-soc] cross_container_support - progress report #7
  2012-07-10 13:31 [gentoo-soc] cross_container_support - progress report #7 Jing Huang
@ 2012-07-10 14:12 ` Luca Barbato
  0 siblings, 0 replies; 2+ messages in thread
From: Luca Barbato @ 2012-07-10 14:12 UTC (permalink / raw
  To: Jing Huang; +Cc: gentoo-soc

On 07/10/2012 03:31 PM, Jing Huang wrote:
> First, I try to fix the ping issues in qemu-user of arm-gentoo
> container. The patch is attached.

Try to propose it to the qemu ml.

> * The do_setsockopts function in qemu-user does not support SOL_RAW
> socket which is used in ping program.
> 
> * The recvmsg in main_loop of ping_common.c could not fetch
> sockaddr_in struct. That is because do_sendrecvmsg in qemu-user does
> not pass the msg->msg_name to the target.
> So the ping will show "64 bytes from 0.0.0.0: icmp_req=1 ttl=64 time=1.16 ms".

Good investigation =)

> Second, I am investigating how to execute local gcc toolchain in
> arm-gentoo container.
> 
> At begging, I want to use ldd to parse each cross-gcc toolchain
> executable in arm container. Then copy the related libraries to
> gentoo-arm rootfs and config the ld.so.conf to make cross-gcc running
> locally.

You could also investigate mount --bind over files, that's how I'm doing
it currently and works up to a point =)

> Now, I think I could modify the crossdev script and build cross-gcc
> with LDFLAGS="-static". So the cross-gcc can be executed locally in
> arm-gentoo container.

Seems an interesting approach as well. Less fun manging with runtime
paths and runtime linkers.

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-10 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10 13:31 [gentoo-soc] cross_container_support - progress report #7 Jing Huang
2012-07-10 14:12 ` Luca Barbato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox