Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
operating system development from another operating system
development(7) manual page describes the primary way of building the operating system, which is under itself. The secondary way is to cross-compile it from a sufficiently similar operating system such as Linux with the GNU tools installed. The build system assumes the presence of some GNU extensions in the standard command line tools. This document will detail the process of bootstrapping a Sortix system from another operating system.Be sure you are reading the latest version of this document, rather than an old copy installed on the system or on an online manual page viewer, if you want to build the latest development code rather than the stable release. To view the instructions for the latest source code using the command line:GRUB with BIOS support is required. If you are on an UEFI system, you may need to install further files to get BIOS support. For instance, on an apt-based system you might install the grub-pc-bin package.The overall process is:The following sections describe these variables in detail.Consult the official binutils and gcc documentation for the exact dependencies.This command builds and installs the build tools and the cross-compiler. The build downloads the source code for binutils and gcc modified with support for this operating system.If you want to build a toolchain for every architecture at once, use the install-cross-toolchain-all-archs makefile target instead and omit the TARGET variable.following-development(7) gains a notice whenever the build tools or cross-compiler must be upgraded.
cd /latest/source/code && man share/man/man7/cross-development.7
- GRUB (for iso creation)
- xorriso (for iso creation)
- mtools (for iso creation) (if on UEFI systems)
- mandoc (for html manuals if building a release directory)
- Retrieving the source code.
- Installing the build tools.
- Creating a cross-compiler.
- Cross-compiling the operating system.
https://sortix.org/source/The source code for the ports are in the ports subdirectory as URLs to the upstream tarball, alongside any patches to the upstream release, which are downloaded when each port is built.
- The path to the directory containing the Sortix source code. This could for instance be /home/user/sortix.
- The Sortix target platform. This could for instance be x86_64-sortix.
- The directory path where the cross-toolchain will be installed. This could for instance be /home/user/opt/sortix-toolchain.
$SORTIX.Don't make a sortix directory and git clone inside it, you redundantly get a ~/sortix/sortix directory instead.
i686-sortix and x86_64-sortix. In this guide we will refer to that platform triplet as $SORTIX_PLATFORM. If you want to build another platform afterwards, then repeat the steps with the other platform.
PATH variable:This will modify the PATH variable in this particular shell session. You can make this permanent by adding that line to your ~/.profile or the applicable file for your shell and system. Consult your shell documentation. Otherwise type it in all Sortix-related shells before doing anything.
cd "$SORTIX" && make clean-cross-toolchain && make PREFIX="$CROSS_PREFIX" TARGET=$SORTIX_PLATFORM install-cross-toolchain
install-cross-toolchain command already built the build tools needed to bootstrap the operating system.However, whenever they change you can reinstall the build utilities only by running:following-development(7) gains a notice whenever the build tools must be upgraded, as they must match the source code being built.
cd "$SORTIX" && make clean-build-tools && make PREFIX="$CROSS_PREFIX" install-build-tools
PATH is it now possible to build the operating system as described in development(7) by setting HOST to your value of $SORTIX_PLATFORM. This tells the build system you are cross-compiling and it will run the appropriate cross-compiler. For instance, to build an bootable cdrom image using a x86_64-sortix cross-compiler you can run:This creates a bootable sortix.iso including all ports of third party software. To build only the minimal set of ports required for installation, set the PACKAGES environment variable to minimal! or set it to the empty string to only build the base system. Cross-compiling the ports requires installing additional dependencies locally in order to bootstrap the cross-compilation of some ports.
cd "$SORTIX" && make HOST=x86_64-sortix sortix.iso
development(7) manual page documents how to develop Sortix and how to use the build system. This manual page only documents how to set up a cross-development environment and is not sufficient to develop Sortix.The following-development(7) manual page documents what needs to be done to stay updated with the latest developments. You will need to read the new version of that document whenever you update the source code.