Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changes between Version 31 and Version 32 of UsersGuide/CompilingFromSource


Ignore:
Timestamp:
2019-08-19T11:43:48Z (5 weeks ago)
Author:
Jiří Zárevúcky
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • UsersGuide/CompilingFromSource

    v31 v32  
    1818
    1919{{{
    20 $ git clone git@github.com:HelenOS/helenos.git HelenOS
    21 }}}
    22 
    23 If you do not have !GitHub account (with public keys set), you may need to use HTTPS instead:
    24 
    25 {{{
    2620$ git clone https://github.com/HelenOS/helenos.git HelenOS
    2721}}}
    2822
    29 ''Note:'' To get versions up to 0.7.1 you have to access the abandoned Bazaar repository
    30 
    31 {{{
    32 $ bzr branch bzr://bzr.helenos.org/mainline HelenOS
    33 }}}
    34 
    35 ''Note:'' To get versions older than 0.4.1 you have to access the original Subversion repository
    36 
    37 {{{
    38 $ svn checkout svn://svn.helenos.org/HelenOS/trunk HelenOS
    39 }}}
    40 
    4123== 2. Build a supported cross-compiler ==
    4224
    43 Use our script to install a supported cross-compiler toolchain. The script either needs to be run as the `root` user (because it will install the cross-compiler to the `/usr/local/cross/ia32` directory) or you need to set the `CROSS_PREFIX` environment variable to use custom toolchain installation directory.
     25Use our script to install a supported cross-compiler toolchain. The script either needs to be run as the `root` user (because it will install the cross-compiler to the `/usr/local/cross` directory) or you need to set the `CROSS_PREFIX` environment variable to use custom toolchain installation directory.
    4426
    4527{{{
    4628$ cd HelenOS/tools
    47 $ ./toolchain.sh ia32
    48 }}}
    49 
    50 '''Note:''' In older revisions of the source tree the ''toolchain.sh'' script was present in the ''contrib'' directory (not the ''tools'' directory where it is now).
     29$ ./toolchain.sh amd64
     30}}}
    5131
    5232The toolchain script will print a list of software packages that are required for the toolchain to correctly build. Make sure you install all the dependencies. Unfortunately, the script cannot install the required dependencies for you automatically since the host environments are very diverse. In case the compilation of the toolchain fails half way through, try to analyze the error message(s), add appropriate missing dependencies and try again.
     
    5535
    5636{{{
    57 $ sudo apt install build-essential wget texinfo bison dialog python-yaml genisoimage
     37$ sudo apt install build-essential wget texinfo flex bison dialog python-yaml genisoimage
    5838}}}
    5939
     
    7858== 4. Configure and build ==
    7959
    80 Go back to the source root of HelenOS and start the build process
    81 
    82 {{{
    83 $ cd ..
    84 $ make PROFILE=ia32
     60Since the summer of 2019, HelenOS uses the Meson build system.
     61Make sure you have a recent-enough version of Meson and Ninja.
     62The safest bet is installing both using `pip3` tool.
     63
     64{{{
     65$ pip3 install ninja
     66$ pip3 install meson
     67}}}
     68
     69Meson does not support in-tree builds, so you have to create a directory
     70for your build. You can have as many build directories as you want, each with
     71its own configuration. `cd` into your build directory and run `configure.sh`
     72script which exists in the source root. `configure.sh` can be run with a profile
     73name, to use one of the predefined profiles, or without arguments for interactive
     74configuration.
     75
     76{{{
     77$ cd HelenOS
     78$ mkdir -p ../HelenOS-build/amd64
     79$ cd ../HelenOS-build/amd64
     80$ ../../HelenOS/configure.sh amd64
     81}}}
     82
     83Note: If you installed the toolchain to a custom directory, make sure `CROSS_PREFIX`
     84environment variable is correctly set.
     85
     86Once configuration is finished, use `ninja` to build HelenOS.
     87Invoking `ninja` without arguments builds all binaries and
     88debug files, but not bootable image. This is because during
     89development, most builds are incremental and only meant to check
     90that code builds properly. In this case, the time-consuming process of
     91creating a boot image is not useful and takes most time. This behavior
     92might change in the future.
     93
     94In case you want to rebuild the bootable image, you must invoke
     95`ninja image_path`. This also emits the name of the bootable image into the
     96file `image_path` in build directory.
     97
     98{{{
     99$ ninja
     100$ ninja image_path
    85101}}}
    86102
    87103Now HelenOS should automatically start building.
    88104
    89 '''Note:''' If you installed the toolchain to a custom directory, make sure `CROSS_PREFIX` environment variable is correctly set.
    90105
    91106== 5. Run it ==
     
    106121
    107122== Advanced Topics ==
     123
     124=== Building all predefined profiles ===
     125
     126First, you need to build all required cross-compiler targets.
     127The `toolchain.sh` script makes this easy.
     128
     129Remember to set your `CROSS_PREFIX` variable if you want non-default location.
     130
     131{{{
     132$ cd HelenOS/tools
     133$ ./toolchain.sh essential
     134}}}
     135
     136Next, create a directory in which you want build files to be created.
     137
     138{{{
     139$ cd HelenOS
     140$ mkdir ../HelenOS-build-all
     141$ cd ../HelenOS-build-all
     142}}}
     143
     144To run the build, use `tools/build_all.sh`.
     145
     146{{{
     147$ ../HelenOS/tools/build_all.sh
     148}}}
     149
     150Now wait for all profiles to be configured and built.
     151This is the recommended way to check all default (supported) configurations.
     152
     153If you are lazy, you can run `tools/build_all.sh` right in the source directory.
     154
     155{{{
     156$ cd HelenOS
     157$ tools/build_all.sh
     158}}}
     159
     160This will build everything in a `build_all` subdirectory in the source directory, as a special case.
    108161
    109162=== Which profiles are available? ===
     
    137190With manual configuration you can change the initial screen resolution, disable building of some components, etc.
    138191
    139 '''Warning:''' Do not select a different compiler unless you really know what you are doing! If you use ''gcc_native'' instead of ''gcc_cross'', it won't work, so please don't ask in the mailing list! Building HelenOS with a native compiler is '''not supported'''!
    140 
    141192To configure:
    142193
    143194{{{
    144 $ make distclean && make config
     195$ cd HelenOS-build
     196$ ../HelenOS/configure.sh   # Interactive configuration
     197$ ninja                     # Build code
     198$ ninja image_path          # Build boot image
    145199}}}
    146200
     
    148202
    149203{{{
    150 $ make distclean && make
    151 }}}
    152 
    153 this will cause the HelenOS build to automatically start once you are done with the configuration.
     204$ cd HelenOS-build
     205$ ../HelenOS/configure.sh profile
     206$ ninja config              # Interactive configuration
     207$ ninja                     # Build code
     208$ ninja image_path          # Build boot image
     209}}}
     210
     211You can change configuration at any time, and the build system should be able to resolve all necessary rebuilds automatically.
     212Note however that you cannot change target platform/machine type once the initial configuration is finished.
     213To build for a different device, you need to create a new build directory for it.
    154214
    155215=== Building release files ===
     
    157217This procedure is used to create HelenOS realease files before releasing a new HelenOS version, or for simulating that process. The resulting system image is based on one of the predefined configuration profiles (as opposed to the current configuration).
    158218
    159 Before building release files make sure you have no uncommitted changes. These will not be build since we are building from exported sources.
    160 
    161 To build all release files go to the source root and run:
    162 
    163 {{{
    164 $ make release
    165 }}}
    166 
    167 To build an individual release file go to the source root and run:
    168 
    169 {{{
    170 $ make -C release release PROFILES=profile_name
    171 }}}
    172 
    173 This builds a release file (boot image / disk image) based on the specified configuration profile `profile_name`.
     219Before building release files make sure you have no uncommitted changes. These would get incorporated into the release.
     220
     221To build all release files, create a build directory and run:
     222
     223{{{
     224$ path/to/HelenOS/tools/release.sh
     225}}}
     226