U-Boot
Building uboot manually
Prerequisites
These instructions are written with a host Arch Linux desktop system in mind.
This guide will be especially useful if you are looking to overclock the ram on your Pinephone following the information found here.
You must have these packages installed: dtc swig bc aarch64-linux-gnu-gcc
If you are using a different system such as Ubuntu, there are plenty of cross compilation instructions available online with which you can grab the needed package names from, however you should be able to follow these instructions with these packages installed: build-essentials bison flex swig gcc-aarch64-linux-gnu
Compilation
Note by default these instructions utilize all of your computers cores to compile thanks to the -j
and $(nproc)
parameters. If you wish to only use one core to compile, or change the number of cores used for example to only two cores, then you can either completely remove the -j$(nproc)
parameter from the make commands, or just take off $(nproc)
and add the number of threads you want used in it's place: -j4
First, You need to compile ATF (Arm Trusted Firmware):
git clone https://github.com/crust-firmware/arm-trusted-firmware/ cd arm-trusted-firmware export CROSS_COMPILE=aarch64-linux-gnu- export ARCH=arm64 make PLAT=sun50i_a64 -j$(nproc) bl31 cd ..
After ATF is compiled clone u-boot and copy the bl31.bin file into the u-boot directory.
git clone https://gitlab.com/pine64-org/u-boot.git cd arm-trusted-firmware cp build/sun50i_a64/release/bl31.bin ../u-boot/ cd ..
Download the toolchain's archive: https://musl.cc/or1k-linux-musl-cross.tgz
Extract the compressed archive: tar zxvf or1k-linux-musl-cross.tgz
Move the extracted archive to wherever you would like to install the toolchain to. In these instructions it will simply be installed to the users documents folder.
The final step is to edit your .bashrc
and add the following to the end:
# Path for or1k toolchain export PATH="$PATH:/home/USER/Documents/or1k-linux-musl-cross/bin/" #
After you've completed that you can close out the terminal and reopen it and proceed to the following instructions.
git clone https://github.com/crust-firmware/crust cd crust export CROSS_COMPILE=or1k-linux-musl- make pinephone_defconfig make -j$(nproc) scp cp build/scp/scp.bin ../u-boot/ cd ..
cd u-boot/ git checkout crust export CROSS_COMPILE=aarch64-linux-gnu- export BL31=bl31.bin export ARCH=arm64 export SCP=scp.bin make distclean make pinephone_defconfig make all -j$(nproc)
Uboot installation
Once successfully compiled you can proceed to flash the device
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/[CHANGE THIS] bs=1024 seek=8
Pboot multi-bootloader
One of the smallest and fastest pinephone bootloaders, it was developed by Ondrej Jirman with the ability of booting multiple distros on the pinephone in mind.
More information can be found here