readme bbb update for linux and windows

This commit is contained in:
Robin Müller 2021-05-02 13:21:32 +02:00
parent 891d9e1822
commit a3fb7974ba
1 changed files with 103 additions and 11 deletions

View File

@ -68,6 +68,87 @@ These prerequisites are valid for Linux as well as Windows hosts.
## Cross-Compiling on a Linux Host
### Setting up prerequisites for cross-compiling
1. Install `CMake` and `rsync`
```
sudo apt-get install cmake rsync
```
2. Configure the Beagle Bone Black linux environment. The last section of the
[Linux REAMDE](README-linux.md#top) specifies how to set up a UNIX environment
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/arm-linux-gnueabihf/).
provided by Linaro.
Test the toolchain by running:
```sh
arm-linux-gnueabihf-gcc --version
```
4. Set up a sysroot folder on the local host machine. Make sure the SSH connection to
the BBB is working without issues. Then perform the following steps
```sh
cd $HOME
mkdir beaglebone
cd beaglebone
mkdir rootfs
cd rootfs
pwd
```
Store the result of `pwd`, it is going to be used by `rsync` later.
Now use `rsync` to clone the BBB sysroot to the local host machine.
You can replace `<ip-address>` with `beaglebone.local` to use DNS.
Use the rootfs location stored from the previous steps as `<rootfs-path>`.
```sh
rsync -avHAXR --delete-after --info=progress2 --numeric-ids <user_name>@<ip_address>:/{usr,lib} <rootfs_path>
```
On Linux, it is recommended to repair some symlinks which can be problematic:
Navigate to the folder containing the symlinks first:
```sh
cd <rootfs_path>/usr/lib/arm-linux-gnueabihf
```
You can now use
```sh
readlink libpthread.so
```
which will show an absolute location of a shared library the symlinks points to. This location
needs to be converted into a relative path.
Run the following command to create a relative symlinks instead of an absolute ones. The pointed
to location might change to check it with `readlink` first before removing the symlinks:
```sh
rm libpthread.so
rm librt.so
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
ln -s ../../../lib/arm-linux-gnueabihf/librt.so.1 librt.so
```
For more information on issues which can occur when cloning the root filesystem,
see the [troubleshooting](#troubleshooting) section.
5. It is recommended to install `gdb-multiarch`. This tool will allow remote debugging on the host
computer. This is not required if the `tcf-agent` is used.
```sh
sudo apt-get install multiarch
```
6. Perform the steps [in the following chapter](#cross-test) to build the
software for the BBB and test it.
## Cross-Compiling on a Windows Host
@ -126,15 +207,15 @@ These prerequisites are valid for Linux as well as Windows hosts.
Please note that `rsync` sometimes does not copy shared libraries or symlinks properly,
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:
the following commands in addition to the `rsync` command on Windows:
```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.
For more information on issues which can occur when cloning the root filesystem,
see the [troubleshooting](#troubleshooting) section.
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.
@ -281,25 +362,36 @@ There might be some issues with the pthread symbolic links.
Navigate to the folder containing the symlinks
```sh
cd /c/User/<UserName>/beaglebone/rootfs/usr/lib/arm-linux-gnueabihf
cd <rootfs_path>/usr/lib/arm-linux-gnueabihf
```
Type `more libpthread`, press `TAB` and check whether the symbolic
link `libpthread.so` is shown. If it is not, we are going to set it up
manually to avoid issues when linking against `pthread` later.
Type `more libpthread`, press `TAB` and check whether the symbolic
link `libpthread.so` is shown. If it is not, we are going to set it up
manually to avoid issues when linking against `pthread` later.
Now you can find out where `libpthread.so` points with `readlink libpthread.so`.
This information is used to convert the absolute symlink to relative ones, for example with:
Run the following command to create a symlink to `libpthread.so.0`
Run the following command to copy the symlink `libpthread.so.0` if it does not exist yet:
```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
Alternatively, you can correct the symlinks to use relative paths, for example with:
```sh
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
ln -s ../../../lib/arm-linux-gnueabihf/librt.so.1 librt.so
```
Please note that there might also be issues with some symlinks or libraries not being copied
properly, especially on Windows. This has occured with files like `libc.so.6`.
If there are linker issues at a later stage, you can try to copy the 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
If there are issues with the cross-compilation process, manually copying the following
symlinks can help: