Bootstrapping Phase 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.
Ensuring the musl C library is ported 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.
Creating the cross-compilation toolchain 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.
Making <package>abuild</package> aware of your target 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 addition of PA-RISC to <function>arch_to_hostspec</function> 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 addition of PA-RISC to <function>hostspec_to_arch</function> 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 0001-Add-foo-architecture-to-functions.patch. 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.
Adding your target to essential software build recipes 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.
GCC Add the appropriate line to system/gcc/APKBUILD (the case in build() with default arch/tune etc).
musl Add the appropriate line to system/musl/APKBUILD (the ARCH case in package()).