BBB x-compile guide added #7

Merged
gaisser merged 17 commits from mueller/bbb-guide into master 2021-05-04 15:16:28 +02:00
2 changed files with 49 additions and 39 deletions
Showing only changes of commit 891d9e1822 - Show all commits

View File

@ -93,7 +93,7 @@ These prerequisites are valid for Linux as well as Windows hosts.
for the FSFW and isalso applicable to the Raspberry Pi. SSH into the
Beagle Bone Black and follow the instructions in that section.
3. Install the correct [ARM Linux cross-compile toolchain](https://releases.linaro.org/components/toolchain/binaries/latest-7/).
3. Install the correct [ARM Linux cross-compile toolchain](https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/).
provided by Linaro.
Test the toolchain by running:
@ -121,12 +121,20 @@ These prerequisites are valid for Linux as well as Windows hosts.
Use the rootfs location stored from the previous steps as `<rootfs-path>`.
```sh
rsync -vR --progress -rl --delete-after --safe-links <username>@<ip-address>:/{lib,usr} <rootfs-path>
rsync -avHAXR --numeric-ids --info=progress2 <username>@<ip-address>:/{lib,usr} <rootfs-path>
```
Please note that `rsync` sometimes does not copy shared libraries or symlinks properly,
which might result in errors when cross-compiling and cross-linking. See the
[troubleshooting](#troubleshooting) section for more details.
which might result in errors when cross-compiling and cross-linking. It is recommended to run
the following commands in addition to the `rsync` command:
```sh
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/{libc.so.6,ld-linux-armhf.so.3,libm.so.6} <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/{libpthread.so,libc.so,librt.so} <rootfs_path>/usr/lib/arm-linux-gnueabihf
```
See the [troubleshooting](#troubleshooting) section for more details if the compilation process
is problematic.
5. It is recommended to install `gdb-multiarch`. This tool will allow remote debugging on the host
computer. Replace `x86_64` with the correct processor architecture for other architectures.
@ -267,7 +275,7 @@ debugging using the TCF agent.
# <a id="troubleshooting"></a> Troubleshooting
## Cloning Sysroot
## Cloning the root filesystem
There might be some issues with the pthread symbolic links.
Navigate to the folder containing the symlinks
@ -282,24 +290,18 @@ manually to avoid issues when linking against `pthread` later.
Run the following command to create a symlink to `libpthread.so.0`
```sh
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/libpthread.so .
```
Alternatively, you can also create the symlink pointing to the correct library with
```sh
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
```
Please note that there might also be issues with some symlinks or libraries not being copied
properly. This has occured with files like `libc.so.6`. If there are linker issues at a later
stage, you can try to rerun `rsync` without `--safe-links` or copy the shared libraries or
symlinks manually from the Linux board to the sysroot with `scp`.
For example, you can copy `libc.so.6` from the Linux board to the sysroot with
the following command
```sh
scp <user_name>@<ip-address>:lib/arm-linux-gnueabihf/lib.so.6 <rootfs-path>/lib/arm-linux-gnueabihf
```
If there are issues with the cross-compilation process, manually copying these shared
libraries can help
If there are issues with the cross-compilation process, manually copying the following
symlinks can help:
```sh
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/libc.so <rootfs_path>/usr/lib/arm-linux-gnueabihf
@ -312,4 +314,7 @@ scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/librt.so.1 <rootfs_path>/l
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libpthread.so.0 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libc.so.6 <rootfs_path>/lib/arm-linux-gnueabihf
```
```
If any custom libraries are used which rely on symlinks, it might be necessary to copy them
or create them manually as well.

View File

@ -123,12 +123,20 @@ toolchain binaries are added to the path accordingly.
`$HOME/raspberrypi/rootfs`.
```sh
rsync -vR --progress -rl --delete-after --safe-links pi@<ip-address>:/{lib,usr,opt/vc/lib} <rootfs-path>
rsync -avHAXR --numeric-ids --info=progress2 <username>@<ip-address>:/{lib,usr} <rootfs-path>
```
Please note that `rsync` sometimes does not copy shared libraries or symlinks properly,
which might result in errors when cross-compiling and cross-linking. See the
[troubleshooting](#troubleshooting) section for more details.
which might result in errors when cross-compiling and cross-linking. It is recommended to run
the following commands in addition to the `rsync` command:
```sh
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/{libc.so.6,ld-linux-armhf.so.3,libm.so.6} <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/{libpthread.so,libc.so,librt.so} <rootfs_path>/usr/lib/arm-linux-gnueabihf
```
See the [troubleshooting](#troubleshooting) section for more details if the compilation process
is problematic.
3. It is recommended to install `gdb-multiarch`. This tool will allow remote debugging
on the host computer. This step is not required if the `tcf-agent` is used.
@ -342,7 +350,7 @@ debugging using the TCF agent.
# <a id="troubleshooting"></a> Troubleshooting
## Cloning Sysroot
## Cloning the root filesystem
There might be some issues with the pthread symbolic links.
Navigate to the folder containing the symlinks
@ -357,24 +365,18 @@ manually to avoid issues when linking against `pthread` later.
Run the following command to create a symlink to `libpthread.so.0`
```sh
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/libpthread.so .
```
Alternatively, you can also create the symlink pointing to the correct library with
```sh
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
```
Please note that there might also be issues with some symlinks or libraries not being copied
properly. This has occured with files like `libc.so.6`. If there are linker issues at a later
stage, you can try to rerun `rsync` without `--safe-links` or copy the shared libraries or
symlinks manually from the Linux board to the sysroot with `scp`.
For example, you can copy `libc.so.6` from the Linux board to the sysroot with
the following command
```sh
scp <user_name>@<ip-address>:lib/arm-linux-gnueabihf/lib.so.6 <rootfs-path>/lib/arm-linux-gnueabihf
```
If there are issues with the cross-compilation process, manually copying these shared
libraries can help
If there are issues with the cross-compilation process, manually copying the following
symlinks can help:
```sh
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/libc.so <rootfs_path>/usr/lib/arm-linux-gnueabihf
@ -388,3 +390,6 @@ scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libpthread.so.0 <rootfs_pa
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libc.so.6 <rootfs_path>/lib/arm-linux-gnueabihf
```
If any custom libraries are used which rely on symlinks, it might be necessary to copy them
or create them manually as well.