Gentoo Archives: gentoo-embedded

From: Joe Harvell <joe.harvell.x@×××××.com>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] crossdev ROOT and SYSROOT directory confusion
Date: Thu, 09 May 2019 23:25:08
Message-Id: CACG_sdHozqM5amFAdB5=qyGO=LqtZE+ZiRX2JSC9tFK1d4LRFg@mail.gmail.com
1 I have created a toolchain using crossdev and want to use that to create
2 multiple *different* roots for two different hosts of the same target.
3 Both of these systems (A and B) are going to netboot and mount their root
4 directory read-write from a directory on the build machine.
5
6 I want to use only 1 toolchain since both systems are the same
7 architecture. But they will have different packages installed. Also,
8 since they are mounting read-write, their root filesystems inlcude system
9 configuration for the respective host.
10
11 I do not want build dependencies for any packages installed. I want any
12 build dependencies installed in the root filesystem of the build machine.
13
14 So I want the following *different* directories:
15
16 1. toolchain directory /usr/<chost>
17 2. build machine root (/). I want DEPEND and BDEPEND packages for both
18 systems A and B to go here
19 3. system A PORTAGE_CONFIGROOT
20 4. system A root directory. System A will mount this read-write over
21 NFS. I want packages I emerge for system A and their RDEPEND and PDEPEND
22 packages to go here
23 5. system B PORTAGE_CONFIGROOT
24 6. system B root directory. System B will mount this read-write over
25 NFS. I want packages I emerge for system B and their RDEPEND and PDEPEND
26 packages to go here
27
28 I have read the documentation for crossdev, portage and also looked at the
29 contents of cross-emerge, cross-pkg-config and many of the ebuilds. But I
30 am unclear on the correct settings for ROOT and SYSROOT when building for
31 each system.
32
33 Based on the documentation, I think I should be setting env variables as
34 follows when building for system A:
35
36
37 - EPREFIX=
38 - PORTAGE_CONFIGROOT=<directory #3 above>
39 - CHOST=value used as --target when building toolchain with crossdev
40 - CBUILD=x86_64-pc-linux-gnu
41 - ROOT=<directory #4 above>
42 - SYSROOT=/
43 - BROOT=/
44
45 and the following when building for system B
46
47 - EPREFIX=
48 - PORTAGE_CONFIGROOT=<directory #5 above>
49 - CHOST=value used as --target when building toolchain with crossdev
50 - CBUILD=x86_64-pc-linux-gnu
51 - ROOT=<directory #6 above>
52 - SYSROOT=/
53 - BROOT=/
54
55 I am able to accomplish this with no modifications to cross-emerge by
56 setting environment variables appropriately when envoking <chost>-emerge.
57
58 However, I notice a problem with this. When I look at the contents of
59 cross-pkg-config, I see that it sets PKG_CONFIG_SYSROOT_DIR="${SYSROOT}".
60 This means if the ebuild invokes <chost>-pkg-config, it will look for their
61 headers and libraries for their rdeps there, which is wrong in my case.
62 Also, I see there is no way to override the value of this for
63 cross-pkg-config like you can for variables set by cross-emerge.
64
65 So it looks like crossdev does not support SYSROOT=/. Is this intentional?
66
67 Also, what is the difference between DEPEND and BDEPEND? The descriptions
68 for them in the portage documentation seem like they are describing the
69 same thing.
70
71 The embedded handbook mentions a need to run emerge-wrapper --init but it
72 does not say what it does. Is this documented somewhere?
73
74 Do crossdev and the Gentoo ebuilds support what I am trying to accomplish
75 here?