docs/cross-building.txt: add documentation about cross-builds
PATCH 1/1 docs/cross-building.txt: add documentation about cross-builds
From: Mauro Carvalho Chehab <[email protected]>
Cross-building IGT is not too trivial, as one needs to prepare a sysroot directory containing not only glibc, but also other libraries. Yet, such kind of builds are sometimes desired. So, document how to do that.
--- docs/cross-building.txt | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 docs/cross-building.txt
docs/cross-building.txt new file +73 -0
@@ -0,0 +1,73 @@ +Producing an IGT library for another architecture +================================================= + +Meson requires an extra file to do non-native builds. This is passed +via --cross-file parameter to it. + +Such file contains the configuration used to do a cross-compilation build. +As such, it contains: + +- the host machine data, which defines the system and architecture from + the native OS. + At the example below, the native OS is Linux, x86_64 architecture. +- the target machine data, containing the target architecture. + At the example below, the target is aarch64 (arm 64 bits architecture). +- the sysroot path, where IGT dependent libraries were compiled for a given + architecture. + This can be obtained by either cross-building a distribution using + Yocto, buildroot or similar, or by copying the system root from + an install for the desired architecture, after installing the IGT + needed library dependencies. + + At the example below, the libraries are stored under /aarch64-sysroot. + + Please notice that the binaries may require some extra libraries used + for cross-compiling. One needs to copy them from the native cross-compiler + toolchain. In the case of Fedora, such files are located under + /usr/aarch64-linux-gnu/sys-root/ (for aarch64 architecture). + +Preparing for cross compilation is done by calling meson with the +cross-compilation config file name: + + meson --cross-file arm64_cross.txt arm64 + +The actual compilation can then be done using ninja: + + ninja -C arm64 + +Please notice that some parts of the IGT build are disabled during +cross-compilation, like testlist file creation and documentation, +as such steps depend on running the generated code at the native +machine. + +arm64_cross.txt example +----------------------- + +[constants] +sysroot = '/aarch64-sysroot' +common_args = ['--sysroot=' + sysroot] + +[properties] +sys_root = sysroot +c_args = common_args +c_link_args = common_args +pkg_config_libdir = [sysroot + '/usr/lib64/pkgconfig', sysroot +'/usr/share/pkgconfig', sysroot +'/usr/local/lib/pkgconfig'] + +[binaries] +c = '/usr/bin/aarch64-linux-gnu-gcc' +ar = '/usr/bin/aarch64-linux-gnu-gcc-ar' +ld = '/usr/bin/aarch64-linux-gnu-ld' +strip = '/usr/bin/aarch64-linux-gnu-strip' +pkgconfig = 'pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[target_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little'
Signature · 1 line
2.41.0
Hi Mauro,
Quoted 4 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Cross-building IGT is not too trivial, as one needs to prepare a sysroot directory containing not only glibc, but also other
---------------------------------------------- ^^^^^ s/, but/ but/
Quoted 1 line
libraries. Yet, such kind of builds are sometimes desired.
-----------------------------------------------------------^
Quoted 1 line
So, document how to do that.
s/. So, document/ so I documented/
Quoted 13 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- docs/cross-building.txt | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 docs/cross-building.txtdocs/cross-building.txt new file +0
-0
docs/cross-building.txt line 1
Quoted 1 line
docs/cross-building.txt new file +1
-0@@ -0,0 +1,73 @@ +Producing an IGT library for another architecture
------------------- ^^^^^^^
s/library for/for/
docs/cross-building.txt line 3
Quoted 2 lines
docs/cross-building.txt new file +2
-0+================================================= +
Could you also add here what packets you installed on Fedora? Any other arm64 headers/libs needed?
Quoted 19 lines
docs/cross-building.txt new file +19
-0+Meson requires an extra file to do non-native builds. This is passed +via --cross-file parameter to it. + +Such file contains the configuration used to do a cross-compilation build. +As such, it contains: + +- the host machine data, which defines the system and architecture from + the native OS. + At the example below, the native OS is Linux, x86_64 architecture. +- the target machine data, containing the target architecture. + At the example below, the target is aarch64 (arm 64 bits architecture). +- the sysroot path, where IGT dependent libraries were compiled for a given + architecture. + This can be obtained by either cross-building a distribution using + Yocto, buildroot or similar, or by copying the system root from + an install for the desired architecture, after installing the IGT + needed library dependencies. + + At the example below, the libraries are stored under /aarch64-sysroot.
docs/cross-building.txt line 32
Quoted 10 lines
docs/cross-building.txt new file +10
-0+ + Please notice that the binaries may require some extra libraries used + for cross-compiling. One needs to copy them from the native cross-compiler + toolchain. In the case of Fedora, such files are located under + /usr/aarch64-linux-gnu/sys-root/ (for aarch64 architecture). + +Preparing for cross compilation is done by calling meson with the +cross-compilation config file name: + + meson --cross-file arm64_cross.txt arm64
-------------------------------------- ^^^^^
This should be 'build'
docs/cross-building.txt line 36
Quoted 4 lines
docs/cross-building.txt new file +4
-0+ +The actual compilation can then be done using ninja: + + ninja -C arm64
------------ ^^^^^
Same here, use build:
ninja -C build
Option -C changes path before running next actions.
Regards,
Kamil
Quoted 40 lines
docs/cross-building.txt new file +37
-0+ +Please notice that some parts of the IGT build are disabled during +cross-compilation, like testlist file creation and documentation, +as such steps depend on running the generated code at the native +machine. + +arm64_cross.txt example +----------------------- + +[constants] +sysroot = '/aarch64-sysroot' +common_args = ['--sysroot=' + sysroot] + +[properties] +sys_root = sysroot +c_args = common_args +c_link_args = common_args +pkg_config_libdir = [sysroot + '/usr/lib64/pkgconfig', sysroot +'/usr/share/pkgconfig', sysroot +'/usr/local/lib/pkgconfig'] + +[binaries] +c = '/usr/bin/aarch64-linux-gnu-gcc' +ar = '/usr/bin/aarch64-linux-gnu-gcc-ar' +ld = '/usr/bin/aarch64-linux-gnu-ld' +strip = '/usr/bin/aarch64-linux-gnu-strip' +pkgconfig = 'pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[target_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little'Signature · 1 line
2.41.0