Commit 9c41f323 authored by David Marceau's avatar David Marceau
Browse files

Update ch02-04-preparing-the-build.md

parent 7cb67273
Pipeline #8987 passed with stage
in 4 minutes and 46 seconds
......@@ -3,78 +3,118 @@ Preparing the build
Woah! You made it so far, all the way to here. Congrats! Now we gotta build Redox.
Using the bootstrap Script
--------------------------
FIRST-TIME BEGINNERS
--------------------
If you're on a Linux or macOS computer, you can just run the bootstrapping script, which does the build preparation for you. Change to the folder where you want the source code to live and run the following command:
### Bootstrap Pre-Requisites And Fetch Sources
If you're on a Linux or macOS computer, you can just run the bootstrapping script, which does the build preparation for you. Run the following commands:
```sh
$ curl -sf https://gitlab.redox-os.org/redox-os/redox/raw/master/bootstrap.sh -o bootstrap.sh && bash -e bootstrap.sh
$ mkdir -p ~/tryredox
$ cd ~/tryredox
$ curl -sf https://gitlab.redox-os.org/redox-os/redox/raw/master/bootstrap.sh -o bootstrap.sh
$ bash -e bootstrap.sh
```
This script fetches build dependencies using a package manager for your platform and clones the Redox code from GitLab. It checks whether you might already have a dependency and skips the installation in this case. On some systems this is simply done by checking whether the binary exists and doesn't take into account which version of the program you have. This can lead to build errors if you have old versions already installed. In this case, please install the skipped dependencies manually.
The above does the following:
- creates a parent folder called "tryredox". Within that folder, it will create another folder called "redox" where all the sources will reside.
- installs the pre-requisite packages using your operating system's package manager(popos/ubuntu/debian apt, redhat/centos/fedora dnf, archlinux pacman).
- clones the Redox code from GitLab and checks out a redox-team tagged version of the different subprojects intended for the community to test and submit success/bug reports for.
Please be patient this can take 5 minutes to an hour depending on the hardware and network you're running it on.
Advanced Users
--------------
Advanced users may accomplish the same as the above bootstrap.sh script with the following steps.
Be forewarned, the documentation can't keep up with the bootstrap.sh script since there are so many distros from which to build Redox-Os from: MacOS, PopOS, Archlinux, Redhat/Centos/Fedora.
Manual Setup
------------
NOTE: The core redox-os developers use PopOs to build Redox-Os. We recommend to use PopOs for repeatable zero-painpoint Redox-os builds.
### Cloning the repository
### Clone the repository
Change to the folder where you want your copy of Redox to be stored and issue the following command:
```sh
$ git clone https://gitlab.redox-os.org/redox-os/redox.git --origin upstream --recursive && \
cd redox && git submodule update --recursive --init
$ mkdir -p ~/tryredox
$ cd ~/tryredox
$ git clone https://gitlab.redox-os.org/redox-os/redox.git --origin upstream --recursive
$ cd redox
$ git submodule update --recursive --init
```
Please be patient this can take 5 minutes to an hour depending on the hardware and network you're running it on.
Give it a while. Redox is big.
### Install Pre-Requisite Packages
### Installing the build dependencies
I assume you have a package manager, which you know how to use (if not, you have to install the build dependencies even more manually). We need the following deps: `make` (probably already installed), `nasm` (the assembler, we use in the build process), `qemu` (the hardware emulator, we will use. If you want to run Redox on real hardware, you should read the `fun` chapter):)
Linux Users:
#### Linux Users:
```
$ [your package manager] install cmake make nasm qemu pkg-config libfuse-dev wget gperf libhtml-parser-perl autoconf flex autogen
$ [your package manager] install cmake make nasm qemu pkg-config libfuse-dev wget gperf libhtml-parser-perl autoconf flex autogen po4a expat
```
MacOS Users using MacPorts:
#### MacOS Users using MacPorts:
```
$ sudo port install make nasm qemu gcc7 pkg-config osxfuse x86_64-elf-gcc
```
MacOS Users using Homebrew:
#### MacOS Users using Homebrew:
```
$ brew install automake bison gettext libtool make nasm qemu gcc@7 pkg-config Caskroom/cask/osxfuse
$ brew install redox-os/gcc_cross_compilers/x86_64-elf-gcc
```
Setting Up Nightly Rust
-----------------------
The following step is not required _if_ you already have a functioning Rust nightly installation. Nightly is required.
Install Rust Stable And Nightly
-------------------------------
We will use `rustup` to manage our Rust versions:
Install Rust, make the nightly version your default toolchain, the list the installed toolchains:
```sh
$ curl https://sh.rustup.rs -sSf | sh
$ rustup default nightly
$ rustup toolchain list
$ cargo install --force --version 0.3.20 xargo
```
You may need to run rustup to install the recommended nightly version.
NOTE: **xargo** allows redox-os to have a custom `libstd`
There is one more tool we need from Rust to install Redox. It is called Xargo. Xargo allows us to have a custom `libstd`
```sh
$ cargo install xargo
NOTE: **~/.cargo/bin** has been added to your PATH for the running session.
Add the following line to your shell start-up file, like ".bashrc" or ".bash_profile" for future rust sessions:
```
export PATH=${PATH}:~/.cargo/bin
```
Once it is installed, add its install directory to your path by running the following
```sh
$ export PATH=${PATH}:~/.cargo/bin
### Updating The Sources
#### How to update submodules using make pull
WIP this section needs more work
```
make pull
```
#### How to update package sources using make fetch
WIP this section needs more work
```
make fetch
```
### Change Sources To Build ARM 64-bit Redox-Os Image
WIP this section needs more work
```
make distclean # important to remove x86_64 stuff
git remote update
git fetch
git restore mk/config.mk
git checkout aarch64-rebase
git pull
git submodule update --init --recursive
git rev-parse HEAD
git pull
```
This line can be added to your shell start-up file, like .bashrc, so that it is automatically set up for you in future.
Next steps
----------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment