Table of Contents
During this phase, you will create a number of necessary tools:
You will create a toolchain to use on your host to compile software for your target. This is called a "cross-compilation" toolchain.
You will build an essential set of software to bootstrap your target, including a toolchain to use on your target to directly compile software (or self host).
You will configure a kernel to boot on your target.
You will then create a bootable image that you will use to boot your target into Adélie Linux.
Before you begin porting Adélie Linux to your target, you must ensure that the musl C library has been ported to it. You can view a list of supported architectures for musl on the online musl Git repository,or in the
arch/ directory of the musl source code found on the Adélie Linux Platform Group Resource Disc.
If your target is not yet supported by musl, you will need to port it first. Porting the musl C library is beyond the scope of this guide. If you have an Internet connection, you may consult the official musl porting documentation.
In this section, you will:
Add the necessary information to abuild;
Install the amended abuild to your host computer;
Add your target to
APKBUILDs for essential software; and
Create the initial cross-compilation toolchain, allowing you to build packages for your target.
Please make sure that you are at your host computer's terminal before continuing.
Before you can build packages for your target, you will need to ensure abuild is aware of the architecture. This is accomplished by modifying a few files in the abuild source code. You will need to check out a clone of the abuild Git repository, or use the copy of the abuild Git tree found on the Adélie Linux Platform Group Resource Disc.
In the abuild Git tree, open the
functions.sh.in file. Locate the
arch_to_hostspec function, and add the short name of your target's architecture as a case to the case statement; it should echo the full build triplet for your target (see Example 2.1, “Example addition of PA-RISC to
Example 2.1. Example addition of PA-RISC to
armhf) echo "armv6-foxkit-linux-muslgnueabihf" ;; armv7) echo "armv7-foxkit-linux-musleabihf" ;; hppa) echo "hppa-foxkit-linux-musl" ;; i528) echo "pentium4-foxkit-linux-musl" ;; mips) echo "mips-foxkit-linux-musl" ;;
Next, locate the
hostspec_to_arch function, and add a string that would match any build triplet for your target's architecture as a case to the case statement; it should echo the short name you specified in
arch_to_hostspec (see Example 2.2, “Example addition of PA-RISC to
Example 2.2. Example addition of PA-RISC to
armv6*-*-*-*eabihf) echo "armhf" ;; armv7*-*-*-*eabihf) echo "armv7" ;; hppa-*-*-*) echo "hppa" ;; i486-*-*-*) echo "x86" ;; i586-*-*-*) echo "pmmx" ;;
Now that you have added your target to abuild, you will need to create a patch to apply to the
APKBUILD. Commit your work with a descriptive message (such as "Add the PA-RISC architecture to functions"), then run
git format-patch HEAD^ to have Git provide you a patch file. This patch file will typically be named similar to
Move (or copy) the patch file you have generated to the directory with abuild's
APKBUILD, then add it to the
source list in the
APKBUILD and rerun
abuild checksum as with any package update. Build this new copy of abuild locally, and install it to your host computer.
A few of the essential system software packages for Adélie Linux are customised per target. In this section, you will add support for your target to these packages.
Add the appropriate line to
system/gcc/APKBUILD (the case in build() with default arch/tune etc).