User:Zulu Foxtrott/GentooOnARM/EasyInstall/Preparing

From Gentoo Wiki
Jump to:navigation Jump to:search

Installing a build toolchain

On the host system (the Linux command-line environment that is used to install Gentoo to a storage device of choice) a working regular build toolchain has to be installed. On Gentoo systems this is usually always already the case. On systems running Debian or derivatives like Ubuntu install the toolchain with apt install build-essential. For other Linux distributions please consult their respective documentation.

Setting up a cross build environment

Depending on the host system's operating system, instructions on how to install the toolchain for cross compilation differ. Consult the specific distribution's documentation. On debian and the likes gcc-aarch64-linux-gnu and binutils-aarch64-linux-gnu would need to be installed.

In case the host system runs Gentoo, set up sys-devel/crossdev:

Installing crossdev

First create an overlay that crossdev can use:

root #mkdir -p /var/db/repos/localrepo-crossdev/{profiles,metadata}
root #echo 'crossdev' > /var/db/repos/localrepo-crossdev/profiles/repo_name
root #echo 'masters = gentoo' > /var/db/repos/localrepo-crossdev/metadata/layout.conf
root #chown -R portage:portage /var/db/repos/localrepo-crossdev
If the main Portage tree is synchronized by using Git, or any other method with Manifest files that do not include checksums for ebuilds, prevent masked by: corruption errors by appending thin-manifests = true at the bottom of /var/db/repos/localrepo-crossdev/metadata/layout.conf

Then instruct Portage and crossdev to use this overlay create:

FILE /etc/portage/repos.conf/crossdev.conf
location = /var/db/repos/localrepo-crossdev
priority = 10
masters = gentoo
auto-sync = no

Now install crossdev:

root #emerge --ask sys-devel/crossdev

Installing the cross build toolchain

Install the cross toolchain:

root #crossdev --stable --target aarch64-linux-gnu

Installing required tools

Install GNU Parted and the Device Tree Compiler (dtc). The easiest way to do that again depends on the host system's operating system. On debian and descendants one would usually use apt install followed by the package name.

On Gentoo the respective packages - sys-block/parted and sys-apps/dtc - can be installed with:

root #emerge --ask sys-block/parted sys-apps/dtc

Optional: Installing cryptsetup for device encryption

In case the new installation is to be encrypted install cryptsetup version 2.0.0 or newer.

On a Gentoo host system this can be accomplished by installing sys-fs/cryptsetup:

root #emerge --ask sys-fs/cryptsetup

If unsure, verify the version with:

root #cryptsetup --version

Setting required environment variables

TODO: move section forward (target arch specific)

Finally set the necessary environment variables:

root #export ARCH=arm64

Do not omit the trailing "-":

root #export CROSS_COMPILE=aarch64-linux-gnu-
If the installation is interrupted anywhere after this point, it is necessary to set these environment variables again on resume.


Preparing the storage device