Manual build howto

This page describes the process to combine sunxi U-Boot, linux kernel and other bits together to create a useful SD-card from scratch, the basis for further hacking.

This page is only suited for A10, A13/A10s and A20 based devices. The manual build howtos for other SoCs are at the end of this page.

We of course do not build a whole distribution, we only build U-Boot, the kernel and a handful of tools, and then use an existing rootfs to get a useful system. Depending on the rootfs size, you might want to use a 2GB or larger SD Card. SD-card partitioning and formatting will be taken care of later.

= Getting a cross toolchain =

For this part, you need to refer to our toolchain page.

= Building U-Boot = Please refer to Compile U-Boot. When the build has completed, there will be spl/sunxi-spl.bin and u-boot.img available in your U-Boot tree.

The installation to SD card is covered in Bootable_SD_card.


 * (If you intend to boot older 3.4.x kernels with mainline U-Boot, make sure you also understand its boot configuration. Some information presented on this page needs to be adjusted accordingly - especially bootm_boot_mode could be important in that case.)

= Building script.bin =

To build script.bin you must first get the following repositories: git clone git://github.com/linux-sunxi/sunxi-tools.git git clone git://github.com/linux-sunxi/sunxi-boards.git

Descend into sunxi-tools and run the command 'make fex2bin'.

Then, get into the sunxi-board tree and find the fex file for your board. You also need to find out the MAC Address of Ethernet adapter, as you will need to fix the MAC in the  section of the fex file, to match the one for your device: [dynamic] MAC = "000000000000" to, for example: [dynamic] MAC = "0123456789AB"

For more information see Ethernet.

Now you can create the script.bin file: ../../../sunxi-tools/fex2bin .fex script.bin You will need this later on when finishing U-Boot installation.

= Building the kernel = Please refer to our Kernel compilation guide. = Setting up the boot partition =

install bootloader and partition card
Please execute commands in Bootable_SD_card, Bootable_SD_card, Bootable_SD_card

Mount your boot or root partition again: mount /dev/${card}1 /mnt

install kernel and script.bin
Now you can install your built kernel into the boot partition: cp /home/user/dir/linux-sunxi/arch/arm/boot/uImage /mnt Same for the script.bin: cp /home/user/dir/sunxi-boards/sys_config/aXX/script.bin /mnt

boot.cmd and boot.scr
Follow instructions to set up either mainline or legacy sunxi U-Boot:
 * mainline U-Boot
 * legacy U-Boot

cleanup
Unmount the partition again. umount /mnt

= Setting up the rootfs = Please refer to Bootable_SD_card

As a last step you need to copy the kernel modules into the newly created rootfs. Change into the top level directory of the newly created rootfs and run: mount ${cardroot} /mnt mkdir -p /mnt/lib/modules rm -rf /mnt/lib/modules/ cp -r /output/lib /mnt/ umount /mnt (Replace  with the directory you have built your kernel in as described above.)

= Boot! =

Now you should be able to unmount your SDCard filesystems, and you should be able to boot your brand new installation.

= See also =

We have Manual build howtos for all SoCs: