2020-11-18 15:41:52 -05:00
# Building Armbian
## What do I need?
2016-07-02 14:20:49 -04:00
2020-03-12 11:51:39 +01:00
- x86/x64 machine running any OS; at least 4G RAM, SSD, quad core (recommended),
2020-11-07 16:50:47 +01:00
- [VirtualBox ](https://www.virtualbox.org/wiki/Downloads ) or similar virtualization software * * (highly recommended with a minimum of 25GB hard disk space for the virtual disk image)**
2022-12-28 10:39:52 +01:00
- **The officially supported** compilation environment is [Ubuntu Jammy 22.04.x amd64 ](https://releases.ubuntu.com/22.04/ubuntu-22.04.1-live-server-amd64.iso ) **only! **
2021-05-13 06:17:37 +02:00
- Ubuntu Focal can be used for building Bionic, Focal and Buster images as well, unsupported though
2020-11-07 16:50:47 +01:00
- `binfmt_misc` kernel module (some * ubuntu-cloud * images do not have this module. Switch to a generic kernel if that is the case.)
- installed basic system, OpenSSH and Samba (optional)
- no spaces in full path to the build script location allowed
2016-08-09 20:18:19 +03:00
- superuser rights (configured `sudo` or root shell).
2016-07-02 14:20:49 -04:00
2020-10-13 19:35:57 +02:00
Not officially supported build environments from community contributions:
2020-10-13 19:31:29 +02:00
- Setting up VirtualBox and compile environment is easy following our [Vagrant tutorial ](https://docs.armbian.com/Developer-Guide_Using-Vagrant/ ),
- [Docker ](Developer-Guide_Building-with-Docker.md ) environment is also supported for building kernels and full OS images,
- [Multipass ](https://gist.github.com/atomic77/7633fcdbf99dca80f31fd6d64bfd0565 )
2017-08-01 12:37:25 +03:00
Please note that system requirements (both hardware and OS/software) may differ depending on the build environment (Vagrant, Docker, Virtualbox, native).
2020-11-18 15:41:52 -05:00
## How to start?
2016-07-02 14:20:49 -04:00
2020-08-02 10:17:41 +02:00
### Native and VirtualBox environments:
2018-04-21 13:47:06 +03:00
2016-07-02 14:20:49 -04:00
Login as root and run:
2020-08-02 10:17:41 +02:00
```bash
2020-07-29 20:14:44 +02:00
apt-get -y -qq install git
2023-02-07 15:13:10 +01:00
git clone --depth=1 --branch=master https://github.com/armbian/build
2020-07-29 20:14:44 +02:00
cd build
2020-07-29 20:08:18 +02:00
```
2016-07-02 14:20:49 -04:00
Run the script
./compile.sh
2020-03-12 11:51:39 +01:00
Make sure that full path to the build script **does not contain spaces ** .
2017-10-09 15:43:41 +03:00
2021-10-21 17:28:05 +02:00
<iframe width="607" height="342" src="https://www.youtube.com/embed/0K0vtUg_cgo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
2016-07-02 14:20:49 -04:00
2020-11-18 15:41:52 -05:00
## Providing build configuration
2017-08-01 12:37:25 +03:00
2019-07-07 17:01:29 +02:00
After the first run of `compile.sh` a new configuration file `config-example.conf` and symlink `config-default.conf` will be created.
2017-08-01 12:37:25 +03:00
You may edit it to your needs or create different configuration files using it as a template.
2018-04-23 12:42:46 -07:00
Alternatively you can supply options as command line parameters to compile.sh.
2016-07-02 14:20:49 -04:00
Example:
2021-03-25 07:13:43 +01:00
./compile.sh BOARD=cubietruck BRANCH=current KERNEL_ONLY=no RELEASE=focal
2016-07-02 14:20:49 -04:00
2021-07-09 05:49:11 +02:00
Note: Option `BUILD_ALL` cannot be set to "yes" via command line parameter.
Note: Names for `BOARD` can be found [here ](https://github.com/armbian/build/tree/master/config/boards ) by looking at file names. Example: OrangePi 4 = **orangepi4.conf ** = `BOARD=orangepi4`
2017-10-21 09:11:36 +02:00
2020-11-18 15:41:52 -05:00
### Base and descendant configuration
2019-07-07 17:01:29 +02:00
2021-03-25 07:13:43 +01:00
You can create one base configuration (`config-base.conf` ) and use this in descendant config (`config-edge.conf` ). Three parameters (*BRANCH*, * RELEASE * , * COMPRESS_OUTPUTIMAGE * ) will be overwritten.
2019-07-07 17:01:29 +02:00
2020-07-29 20:08:18 +02:00
```
2020-07-29 20:14:44 +02:00
. ./config-base.conf
2021-03-25 07:13:43 +01:00
BRANCH="edge"
2020-07-29 20:14:44 +02:00
RELEASE="buster"
COMPRESS_OUTPUTIMAGE="sha,gz"
2020-07-29 20:08:18 +02:00
```
2019-07-07 17:01:29 +02:00
2020-11-18 15:41:52 -05:00
## Using our automated build system
2017-10-21 09:11:36 +02:00
2020-03-12 11:51:39 +01:00
If you do not own the proper equipment to build images on your own, you can make use of the automated build system.
2018-04-23 12:42:46 -07:00
Packages are recompiled every night (starting at 00:01 CEST) and a few testing images are produced.
2020-08-02 10:17:41 +02:00
These images are accessible on the [download server ](https://dl.armbian.com/ ) under board folder, subfolder "*Nightly*".
Packages, when successfully built, are published in the * beta * repository.
You can switch to * beta * repository in [armbian-config ](User-Guide_Armbian-Config.md ) or by changing * apt.armbian.com * to * beta.armbian.com * in /etc/apt/sources.list.d/armbian.list.
2017-10-21 09:11:36 +02:00
2018-04-23 12:42:46 -07:00
Board beta images are defined in board configuration files which are located [here ](https://github.com/armbian/build/tree/master/config/boards ).
This is a typical board configuration:
2017-10-21 09:11:36 +02:00
2020-07-29 20:08:18 +02:00
```
2020-07-29 20:14:44 +02:00
# A20 dual core 1Gb SoC
BOARD_NAME="Banana Pi"
LINUXFAMILY="sun7i"
BOOTCONFIG="Bananapi_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i 8021q a20_tp #ap6211 "
MODULES_NEXT="brcmfmac bonding"
#
2021-03-25 07:13:43 +01:00
KERNEL_TARGET="legacy,current,edge"
2021-07-23 05:45:14 +02:00
CLI_TARGET="buster,focal:current"
DESKTOP_TARGET="buster:legacy,current"
2020-07-29 20:14:44 +02:00
CLI_BETA_TARGET=""
DESKTOP_BETA_TARGET=""
#
BOARDRATING=""
2020-11-25 12:05:16 -05:00
CHIP="https://docs.armbian.com/Hardware_Allwinner-A20/"
2020-07-29 20:14:44 +02:00
HARDWARE="https://linux-sunxi.org/Banana_Pi"
FORUMS="https://forum.armbian.com/forum/7-allwinner-a10a20/"
2020-11-25 12:05:16 -05:00
BUY="https://amzn.to/2fToHjR"
2020-07-29 20:08:18 +02:00
```
2020-04-24 13:23:41 +02:00
You can find more information about those variables [here ](https://github.com/armbian/build/blob/master/config/boards/README.md ).
2017-10-21 09:11:36 +02:00
2020-03-12 11:51:39 +01:00
If you want that our automated system start making images for this particular board, you need to alter parameters `CLI_BETA_TARGET` and `DESKTOP_BETA_TARGET` .
2021-07-23 05:45:14 +02:00
Variants are dependent from `KERNEL_TARGET` definitions and supported userlands: `hirsute` , `focal` , `buster` .
2018-04-23 12:42:46 -07:00
To edit those parameters you need to push changes to the build script.
2020-03-12 11:51:39 +01:00
You need to [fork a project and create a pull request ](Process_Contribute.md ) and after it is imported by one of the administrators, images will start to show up in appropriate folder.
2017-10-21 09:11:36 +02:00
2020-03-12 11:51:39 +01:00
If you want to enable Debian buster desktop image with _ current _ kernel choose the following:
2017-10-21 09:11:36 +02:00
2020-03-12 11:51:39 +01:00
DESKTOP_BETA_TARGET="buster:current"
2017-10-21 09:11:36 +02:00
2021-07-23 05:45:14 +02:00
or for command line interfaces Ubuntu Focal based images with legacy kernel 4.19.x
2017-10-21 09:11:36 +02:00
2021-07-23 05:45:14 +02:00
CLI_BETA_TARGET="focal:legacy"
2017-10-21 09:11:36 +02:00
2021-03-25 07:13:43 +01:00
or for image with latest upstream development/bleeding edge kernel.
2017-10-21 09:11:36 +02:00
2021-03-25 07:13:43 +01:00
DESKTOP_BETA_TARGET="buster:edge"
2017-10-21 09:11:36 +02:00
2019-07-28 22:33:16 +00:00
2020-11-18 15:41:52 -05:00
## Using alternate armbian builder repos and branches
2019-07-28 22:33:16 +00:00
By default, armbian-builder assumes working from `master` of `https://github.com/armbian/build.git` . If you are working from your own repo / branch, `touch .ignore_changes` will cause armbian-builder to not attempt a repo checkout.
2019-11-27 15:26:26 +08:00
2020-11-18 15:41:52 -05:00
## Executing any bash statement
2019-11-27 15:26:26 +08:00
Currently, invoking compile.sh will run a monotonous task of building all the components into a final image.
In some situation, especially when developing with Kernel or U-Boot, it is handy to run a portion of that great task like:
2020-07-29 20:08:18 +02:00
```
2020-07-29 20:14:44 +02:00
# using default profile
./compile.sh 'fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"'
./compile.sh 'compile_uboot'
2020-07-29 20:08:18 +02:00
```
2019-11-27 15:26:26 +08:00
You can also dump the variable:
2020-07-29 20:08:18 +02:00
```
2020-07-29 20:14:44 +02:00
# using profile of `userpatches/config-my.conf`
./compile.sh my 'echo $SRC/cache/sources/$BOOTSOURCEDIR'
2020-07-29 20:08:18 +02:00
```
2019-11-27 15:26:26 +08:00
NOTE: please use single quotes to keep the `$VAR` from early expansion in the command line shell.