Gentoo Archives: gentoo-soc

From: Jing Huang <jing.huang.pku@×××××.com>
To: Luca Barbato <lu_zero@g.o>
Cc: gentoo-soc@l.g.o
Subject: [gentoo-soc] Re: cross_container_support - progress report #9
Date: Thu, 02 Aug 2012 18:08:49
Message-Id: CAK8mDgqSnJ5ZbB4odYEzY3oYQXBBRYhH7_EtDxVAcTTCRw6GXw@mail.gmail.com
In Reply to: [gentoo-soc] Re: cross_container_support - progress report #9 by Jing Huang
1 On Wed, Aug 1, 2012 at 5:01 PM, Jing Huang <jing.huang.pku@×××××.com> wrote:
2 > On Tue, Jul 31, 2012 at 7:30 PM, Luca Barbato <lu_zero@g.o> wrote:
3 >> On 07/31/2012 05:45 PM, Jing Huang wrote:
4 >>> Hi,
5 >>>
6 >>> == Progress of last Week ==
7 >>>
8 >>> In the last week, my qemu-linux patches had been reviewed by the qemu
9 >>> community.
10 >>>
11 >>> I investigated how to config dynamic libraries in lxc container.:
12 >>>
13 >>> 1. mount host's /lib /usr/lib /usr/local/lib to lxc container
14 >>>
15 >>> 2. modify lxc container's ld.so.conf to link these libs.
16 >>>
17 >>> 3. ldconfig -Nf /etc/ld.so.conf to make settings available. (The
18 >>> ld.so.cache will include arm libraries by default. How to ignore
19 >>> them?)
20 >>>
21 >>> I am still debugging this method.
22 >>>
23 >>> Additionally, I found I must execute "qemu-static-i386 x86-program"
24 >>> in lxc container to make it run. Is it right?
25 >>
26 >> No it is wrong, you should call the runtime linker.
27 >
28 > When I execute x86-program(builded with dynamic libraries) in lxc
29 > container, it shows:
30 > "bash: x86-program: No such file or directory"
31 >
32 > Obviously, the container has not called the right dynamic
33 > linker(ld-linux.so) to interpret the x86-program.
34 > Maybe I could register this linker or the linker wrap to
35 > /proc/sys/fs/binfmt_misc ?
36
37 Hmm.. The root cause of this fault is:
38
39 ./x86-program(built with dynamic libraries)
40 -->load_elf_binary()
41 -->open_exec("/lib/ld-linux.so.2");
42
43 lxc chroot lacks of /lib/ld-linux.so.2. This problem is a difficult
44 one. In my opinion, the following two steps are essential to solve it.
45
46 1. alter linker script to build x86-program using custom ld-linux.so.2
47 path ( /target/lib/ld-linux.so.2 ).
48
49 2. switch dynamic libraries to custom paths.
50 This point is relatively easy. I could use either LD_LIBRARY_PATH or
51 ld.so.conf.
52
53 "ldconfig /etc/ld.so.conf" is odd. I had altered ld.so.conf and
54 env.d/00basic to exclude original library path(/lib, /usr/lib,
55 /usr/local/lib), but the new generated cache file still include these
56 paths.
57 Unfortunately, linker will link libraries accroding to the ld cache
58 file unless declare the DT_RPATH and LD_LIBRARY_PATH.
59
60 >
61 >>
62 >>> == Plans for this week ==
63 >>>
64 >>> 1. Still investigate dynamic libraries configure.
65 >>
66 >> It will take probably more time.
67 >>
68 >>> 2. wait for vapier's help. If it is possible, would you offer me the
69 >>> rough tech roadmap of patching crossdev and/or the toolchain eclass
70 >>> you mentioned last letter?
71 >>
72 >> First let's try to wrap up what we have now available and get more
73 >> people trying it =) That means document all the steps in the wiki and
74 >> get voluteers to try them.
75 >
76 > OK. I am doing it.
77 >
78 >>
79 >> lu
80 >>
81 >> --
82 >>
83 >> Luca Barbato
84 >> Gentoo/linux
85 >> http://dev.gentoo.org/~lu_zero
86 >>

Replies

Subject Author
[gentoo-soc] Re: cross_container_support - progress report #9 Luca Barbato <lu_zero@g.o>