added full crosstool-ng instructions

This commit is contained in:
2021-07-15 01:18:31 +02:00
parent 702213b831
commit fd51bae66c
3 changed files with 45 additions and 13 deletions

View File

@ -440,13 +440,14 @@ scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libc.so.6 <rootfs_path>/li
If any custom libraries are used which rely on symlinks, it might be necessary to copy them
or create them manually as well.
# <a id="ctng"></a> Building a cross-compile toolchain with crosstool-ng
# <a id="ctng"></a> Building a cross-compile toolchain with `crosstool-ng`
If you want to cross-compile the toolchain for the Raspberry Pi, you can do so
with the `crosstool-ng` tool.
Alternatively, you can also download a cross-compile toolchain built with
crosstool-ng for the Raspberry Pi 3 [from here](https://www.dropbox.com/sh/zjaex4wlv5kcm6q/AAABBFfmZSRZ7GE7ok-7vTE6a?dl=0)
crosstool-ng for the Raspberry Pi 3 and the Raspbery Pi 4
[from here](https://www.dropbox.com/sh/zjaex4wlv5kcm6q/AAABBFfmZSRZ7GE7ok-7vTE6a?dl=0)
inside the `x-tools` folder.
## Ubuntu
@ -474,8 +475,8 @@ inside the `x-tools` folder.
sudo make install
```
You can also install `ct-ng` locally by supplying `--prefix=<installPath>` to the `configure`
command. You don't need `sudo` for the `make install` command if you do this
You can also install `ct-ng` locally by replacing `--enable-local` with `--prefix=<installPath>`
to the `configure` command. You don't need `sudo` for the `make install` command if you do this.
4. You can get a list of architectures by running
@ -506,7 +507,20 @@ inside the `x-tools` folder.
It is recommended to go to `Paths and misc options` and disable `Paths and misc options`.
Remember to save the configuration.
5. Finally, after finishing the configuration you can build the toolchain with
5. The correct configuration files for the Raspberry Pi 3 and Raspberry Pi 4 are provided here
are were set up according to [these instructions](https://medium.com/@stonepreston/how-to-cross-compile-a-cmake-c-application-for-the-raspberry-pi-4-on-ubuntu-20-04-bac6735d36df).
You can download those files from [here](https://www.dropbox.com/sh/ok554i453phuqec/AACcv-fxpIXi3Nh1z8UWu4Sea?dl=0).
Put the `patches` folder, the `.config` folder and the `env.sh` in the same directory where
you run `ct-ng`. After that, you can check the configuration with `./ct-ng menuconfig`.
Set up the multiarch environment for debian by running
```sh
. env.sh
```
6. Finally, after finishing the configuration you can build the toolchain with
```sh
./ct-ng build
@ -514,3 +528,17 @@ inside the `x-tools` folder.
This takes 20-30 minutes. You can find the toolchain in the `~/x-tools` folder after building
has finished
7. You can check whether the toolchain was configured correctly for multiarch by running the
following command
```sh
cd ~/x-tools/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/bin
./ld --verbose | grep -i "search"
```
The output should include
```sh
SEARCH_DIR("=/lib/arm-linux-gnueabihf"); SEARCH_DIR("=/usr/lib/arm-linux-gnueabihf");
```