1 |
Marc Blumentritt wrote: |
2 |
> Jason schrieb: |
3 |
>> Marc Blumentritt wrote: |
4 |
>>> Jason schrieb: |
5 |
>>>> If you haven't already, try this [1] out. Could you attach mm_emerge? |
6 |
>> [snip] |
7 |
>>>> [1] - http://www.gentoo.org/proj/en/base/embedded/cross-development.xml |
8 |
>>> I was using [1] to write mm_emerge: |
9 |
>>> |
10 |
>>> (build) hive / # cat /mediamachine/tools/mm_emerge |
11 |
>> Does '(build)' imply you are chrooted into your build environment? If |
12 |
>> so, why? |
13 |
> Because I'm working in a uclibc-stage3 setup. |
14 |
> |
15 |
>>> #!/bin/bash |
16 |
>>> |
17 |
>>> check_bind || bind_dirs |
18 |
>> This looks dangerous (speaking from experience, I overwrote my host's |
19 |
>> 64bit LSB x86 glibc files with 32bit ARM MSB uclibc once. Once. ;-) |
20 |
>> No, I didn't have to reinstall) Which dir's are you binding? |
21 |
> |
22 |
> I started with empty dirs (e.g. for $ROOT/var/db) and bind another empty |
23 |
> dir (e.g. $BIND_DIRS/var/db) to it. After emerging I have everything, |
24 |
> which is not needed for a running system, under $BIND_DIRS and not in |
25 |
> $ROOT. The only things I bind from my stage3 to my embedded system, are |
26 |
> /dev, /proc, and kernel source. Therefore I do not mix my envireonments. |
27 |
|
28 |
Okay, so you're using bind so you don't have to trim the final image. |
29 |
Neat. Personally, I 'cp -ax ${TGTROOT}/* /tmp/img_dir/', then my script |
30 |
trims out var/db, etc/portage, usr/{src,include}, and so on. I was also |
31 |
considering moving to 'rsync -FF ...', but I haven't decided yet. It |
32 |
seems more adaptable, but it litters the fs with a lot of .rsync-filter |
33 |
files (they are excluded from the transfer by the second 'F'). |
34 |
|
35 |
>>> # source and export vars |
36 |
>>> . /mediamachine/tools/vars |
37 |
>>> export PORTAGE_CONFIGROOT ROOT |
38 |
>> If you're in chroot, this should be fine. If not, I'd be cautious with |
39 |
>> this. It would be better (especially since it's in a script) to say: |
40 |
>> |
41 |
>> PORTAGE_CONFIGROOT=${SYSROOT} ROOT=${TGTROOT} emerge $* |
42 |
>> |
43 |
>> By exporting those vars, they'll be set after the script finishes. So a |
44 |
>> later 'emerge foo' in the same terminal would have unanticipated results. |
45 |
> |
46 |
> Not in my case!? |
47 |
> |
48 |
> (build) hive mediamachine # mm_emerge -pv dropbear |
49 |
> |
50 |
> These are the packages that would be merged, in order: |
51 |
> |
52 |
> Calculating dependencies... done! |
53 |
> [ebuild R ] net-misc/dropbear-0.49 to /mediamachine/devroot/ |
54 |
> USE="minimal -multicall -pam -savedconfig -static -zlib" 1,724 kB |
55 |
> |
56 |
> Total: 1 package (1 reinstall), Size of downloads: 1,724 kB |
57 |
> ****** passwd diff ******* |
58 |
> ###### shadow diff ###### |
59 |
> ++++++ group diff +++++++ |
60 |
> (build) hive mediamachine # echo $ROOT |
61 |
> |
62 |
> (build) hive mediamachine # |
63 |
> |
64 |
> Or did I miss something? |
65 |
|
66 |
my mistake. I confused sourcing the bash script with executing it. |
67 |
Good catch. :-) |
68 |
|
69 |
>>> cp /etc/passwd /tmp |
70 |
>>> cp /etc/shadow /tmp |
71 |
>>> cp /etc/group /tmp |
72 |
>>> |
73 |
>>> # run emerge |
74 |
>>> emerge $* |
75 |
>>> |
76 |
>>> echo "****** passwd diff *******" |
77 |
>>> diff /tmp/passwd /etc/passwd |
78 |
>>> mv -f /tmp/passwd /etc/passwd |
79 |
>>> echo "###### shadow diff ######" |
80 |
>>> diff /tmp/shadow /etc/shadow |
81 |
>>> mv -f /tmp/shadow /etc/shadow |
82 |
>>> echo "++++++ group diff +++++++" |
83 |
>>> diff /tmp/group /etc/group |
84 |
>>> mv -f /tmp/group /etc/group |
85 |
>> This shouldn't be necessary. When portage adds the pkg to your build |
86 |
>> system ( / ), it will update these files as it is supposed to. That |
87 |
>> should be fine. When you then install the pkg to $ROOT (assuming it is |
88 |
>> an RDEPEND or pkg you want), it should make the necessary changes to |
89 |
>> ${ROOT}/etc/{passwd,shadow,group} . |
90 |
> |
91 |
> Yes, should. When I directly install in $ROOT without building first a |
92 |
> bin pkg, portage does not change any of these files, but does change the |
93 |
> files of my build system. There is an open bug about this: |
94 |
> |
95 |
> http://bugs.gentoo.org/show_bug.cgi?id=53269 |
96 |
|
97 |
Wow, that's an old one. I haven't seen this behavior when |
98 |
cross-compiling. I also haven't been looking for it either. I'll keep |
99 |
an eye out. |
100 |
|
101 |
>>> With bind_dirs I bind some dirs, which I need for building, but not for |
102 |
>>> running my embedded system. The passwd/shadow/group stuff is there to |
103 |
>>> show me changes in these files, because they are made to my build system |
104 |
>>> and not to the embedded system in ROOT. /mediamachine/tools/vars |
105 |
>>> contains the definition of ROOT and PORTAGE_CONFIGROOT . |
106 |
>> |
107 |
>> I think the concept you may be missing here is that portage needs three |
108 |
>> locations, not two. Portage is going to PORTAGE_CONFIGROOT for portage |
109 |
>> config stuff (USE flags, package.keywords, and so on), it installs the |
110 |
>> finished pkg to ROOT, but it needs to go somewhere to find files to |
111 |
>> build against. Dependencies have to come from somewhere. In your case, |
112 |
>> this is '/'. This is correct behavior on the part of portage because we |
113 |
>> don't want to leave a bunch of non-runtime pkgs in ROOT. |
114 |
> |
115 |
> Your are right. I did not know this. Thanks for clarification. |
116 |
> |
117 |
>> So, if it doesn't see zlib.h in /usr/include/, it's going to try to |
118 |
>> install sys-libs/zlib in '/'. If sys-libs/zlib is also an RDEPEND for |
119 |
>> your pkg, it will need to be installed to $ROOT also. Most likely you |
120 |
>> only need the shared libraries in ROOT, eg 'libz.so*'. You should be |
121 |
>> able to delete the includes and static libs from $ROOT (*.h,*.a,*.la) |
122 |
>> since those are only used for building. At least, that works for me :-) |
123 |
> |
124 |
> I will try this and clean up my system. I will see, if this works. |
125 |
|
126 |
You should be able to use your BINDDIR trick on usr/{include,src}, |
127 |
however, static libs are in the same directories as shared libs. I |
128 |
usually do a: |
129 |
|
130 |
find ${TGTROOT}/ -name "*.a" -print >>${file_list} |
131 |
find ${TGTROOT}/ -name "*.la" -print >>${file_list} |
132 |
|
133 |
You could also replace '-print' with '-exec rm -f {} ';'' but I like to |
134 |
print out the list first, and hit a key to confirm. |
135 |
|
136 |
>>> Concerning [1], if I would use cross compilation with ROOT and |
137 |
>>> PORTAGE_CONFIGROOT, would the same happen there? I mean, would some |
138 |
>>> packages be installed in the build system? That would be really bad, |
139 |
>>> wouldn't it? |
140 |
>> |
141 |
>> Cross-compiling is different because those build dependencies I |
142 |
>> mentioned above have to be installed in $SYSROOT which equals |
143 |
>> PORTAGE_CONFIGROOT. This is necessary because the cross-compiler can't |
144 |
>> read any of the files in '/', they're for the wrong target architecture. |
145 |
>> And, as you mentioned, the host system can't understand anything built |
146 |
>> for the target arch. Yes, that is very bad. See my comment above about |
147 |
>> ARM uclibc being written over the host glibc. :-) |
148 |
> |
149 |
> OK, thanks again for clarification. |
150 |
|
151 |
Glad I could help. Keep in mind, I'm still learning all this myself. ;-) |
152 |
|
153 |
thx, |
154 |
|
155 |
Jason. |
156 |
-- |
157 |
gentoo-embedded@g.o mailing list |