Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs for cross-build #14539

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@

# Makefile
/Makefile

# Python virtualenv
/venv
46 changes: 42 additions & 4 deletions docs/howto/how-to-cross-build-runtime-for-arm.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RootFS will be prepared at `tools/cross/rootfs/arm` or `tools/cross/rootfs/aarch

***\* CAUTION: The OS version of rootfs must match the OS version of execution target device. On the other hand, you need to match the Ubuntu version of the development PC with the Ubuntu version of rootfs to be used for cross-build. Otherwise, unexpected build errors may occur.***

If you are using Ubuntu 20.04 LTS, select `focal`, if you are using Ubuntu 22.04 LTS, select `jammy`. You can check your Ubuntu code name in the following way.
If you are using Ubuntu 20.04 LTS, select `focal`, if you are using Ubuntu 22.04 LTS, select `jammy`, for Ubuntu 24.04 LTS, select `noble`. You can check your Ubuntu code name in the following way.

```
$ cat /etc/lsb-release
Expand Down Expand Up @@ -81,7 +81,7 @@ If you select specific version, update symbolic link for build toolchain.
Otherwise, you should set your custom cmake crossbuild toolchain. You can find cmake toolchain files in `infra/nnfw/cmake/buildtool/cross/`.

```
$ update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-10 80 \
$ sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-10 80 \
--slave /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-10 \
--slave /usr/bin/arm-linux-gnueabihf-gcov arm-linux-gnueabihf-gcov /usr/bin/arm-linux-gnueabihf-gcov-10
```
Expand All @@ -104,17 +104,55 @@ ACL source will be automatically installed in `externals/ARMCOMPUTE` when you bu

You can check ACL source information in `infra/cmake/packages/ARMComputeSourceConfig.cmake`

## Install numpy

Python package `numpy` is needed for build. It's recommended to always install python packages in virtualenv.
To do this, at first you need to install python venv package:

```
$ sudo apt-get install python3-venv
```
Next, create virtualenv:

```
$ python3 -m venv venv
```

and activate it (please keep in mind that you will have to activate it always before build)

```
$ source /venv/bin/activate
```

Next, just in case upgrade pip package:

```
(venv)$ pip install -U pip
```

and finally install `numpy`:

```
(venv)$ pip install numpy
```

## Cross build for ARM by using Makefile.template

Give `TARGET_ARCH` variable to set the target architecture.

If you used `ROOTFS_DIR` to prepare in alternative folder, you should also give this to makefile.

Remember to activate venv if you didn't activate it already:

```
$ source /venv/bin/activate
```

```
$ CROSS_BUILD=1 TARGET_ARCH=armv7l make -f Makefile.template
(venv)$ CROSS_BUILD=1 TARGET_ARCH=armv7l make -f Makefile.template

# If ROOTFS_DIR is in alternative folder
$ ROOTFS_DIR=/path/to/your/rootfs/arm \
(venv)$ ROOTFS_DIR=/path/to/your/rootfs/arm \
CROSS_BUILD=1 TARGET_ARCH=armv7l make
```

Expand Down