yann@2076: File.........: 5 - Using the toolchain.txt yann@2076: Copyrigth....: (C) 2010 Yann E. MORIN yann@2076: License......: Creative Commons Attribution Share Alike (CC-by-sa), v2.5 yann@2076: yann@2076: yann@2076: Using the toolchain / yann@2076: ____________________/ yann@2076: yann@2076: yann@2076: Using the toolchain is as simple as adding the toolchain's bin directory in yann@2076: your PATH, such as: yann@2076: export PATH="${PATH}:/your/toolchain/path/bin" yann@2076: yann@2076: and then using the target tuple to tell the build systems to use your yann@2076: toolchain: yann@2076: ./configure --target=your-target-tuple yann@2076: or yann@2076: make CC=your-target-tuple-gcc yann@2076: or yann@2076: make CROSS_COMPILE=your-target-tuple- yann@2076: and so on... yann@2076: yann@2279: It is strongly advised not to use the toolchain sysroot directory as an yann@2076: install directory for your programs/packages. If you do so, you will not be yann@2076: able to use your toolchain for another project. It is even strongly advised yann@2076: that your toolchain is chmod-ed to read-only once successfully build, so that yann@2076: you don't go polluting your toolchain with your programs/packages' files. yann@2076: yann@2076: Thus, when you build a program/package, install it in a separate directory, yann@2076: eg. /your/root. This directory is the /image/ of what would be in the root file yann@2076: system of your target, and will contain all that your programs/packages have yann@2076: installed. yann@2076: yann@2076: yann@2076: The 'populate' script | yann@2076: ----------------------+ yann@2076: yann@2076: When your root directory is ready, it is still missing some important bits: the yann@2076: toolchain's libraries. To populate your root directory with those libs, just yann@2076: run: yann@2076: your-target-tuple-populate -s /your/root -d /your/root-populated yann@2076: yann@2076: This will copy /your/root into /your/root-populated, and put the needed and only yann@2076: the needed libraries there. Thus you don't polute /your/root with any cruft that yann@2076: would no longer be needed should you have to remove stuff. /your/root always yann@2076: contains only those things you install in it. yann@2076: yann@2076: You can then use /your/root-populated to build up your file system image, a yann@2076: tarball, or to NFS-mount it from your target, or whatever you need. yann@2076: yann@2076: The populate script accepts the following options: yann@2076: yann@2076: -s src_dir yann@2076: Use 'src_dir' as the un-populated root directory. yann@2076: yann@2076: -d dst_dir yann@2076: Put the populated root directory in 'dst_dir'. yann@2076: yann@2076: -l lib1 [...] yann@2076: Always add specified libraries. yann@2076: yann@2076: -L file yann@2076: Always add libraries listed in 'file'. yann@2076: yann@2076: -f yann@2076: Remove 'dst_dir' if it previously existed; continue even if any library yann@2076: specified with -l or -L is missing. yann@2076: yann@2076: -v yann@2076: Be verbose, and tell what's going on (you can see exactly where libs are yann@2076: coming from). yann@2076: yann@2076: -h yann@2076: Print the help. yann@2076: yann@2076: See 'your-target-tuple-populate -h' for more information on the options. yann@2076: yann@2076: Here is how populate works: yann@2076: yann@2076: 1) performs some sanity checks: yann@2076: - src_dir and dst_dir are specified yann@2076: - src_dir exists yann@2076: - unless forced, dst_dir does not exist yann@2076: - src_dir != dst_dir yann@2076: yann@2076: 2) copy src_dir to dst_dir yann@2076: yann@2076: 3) add forced libraries to dst_dir yann@2076: - build the list from -l and -L options yann@2076: - get forced libraries from the sysroot (see below for heuristics) yann@2076: - abort on the first missing library, unless -f is specified yann@2076: yann@2076: 4) add all missing libraries to dst_dir yann@2076: - scan dst_dir for every ELF files that are 'executable' or yann@2076: 'shared object' yann@2076: - list the "NEEDED Shared library" fields yann@2076: - check if the library is already in dst_dir/lib or dst_dir/usr/lib yann@2076: - if not, get the library from the sysroot yann@2076: - if it's in sysroot/lib, copy it to dst_dir/lib yann@2076: - if it's in sysroot/usr/lib, copy it to dst_dir/usr/lib yann@2076: - in both cases, use the SONAME of the library to create the file yann@2076: in dst_dir yann@2076: - if it was not found in the sysroot, this is an error.