# Compile from scratch Buildroot 2023.02.8 for Fox Board D27

<abstract>
Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems through cross-compilation 
</abstract>

* <a href="https://buildroot.org/" target="_new">Buildroot home page</a>

This article illustrates how to generate a ready-to-use microSD image 
from scratch using the Buildroot scripts and utilities to download 
the sources of any code, compile them and generate a fully working bootable microSD.

The version used are:

* At91Boostrap version 4.0.4
* Linux Kernel 6.1.13
* Buildroot 2023.02.8

The article steps has been tested using a Linux PC with Linux Ubuntu 22.04.2 LTS.

It is advisable to have an [USB to 3V TTL serial cable](/USB-3V-SER).

## Building procedure

Install on your Linux PC the requested packages listed here:

* <http://buildroot.uclibc.org/downloads/manual/manual.html#requirement-mandatory>

Open a command line terminal and download Buildroot from the official web site:

	wget https://buildroot.org/downloads/buildroot-2023.02.8.tar.xz
	tar -xvf buildroot-2023.02.8.tar.xz
	cd buildroot-2023.02.8
	
Download and apply the Acme Systems patch: 

	wget https://www.acmesystems.it/www/foxd27_buildroot/acme_foxd27.patch
	patch -p1 < acme_foxd27.patch

select the h10_microgateway configuration for Buildroot by typing:

	make acme_h10_microgateway_defconfig
	
Launch the compilation:

	make

This operation will take about 1 hour to download and compile any sources. 

If all went well you will obtain this file in <code>output/images</code> directory:

	sdcard.img

Download and install the free tool [Balena Etcher](https://www.balena.io/etcher/) available for any platform to write the microSD using the 
<code>sdcard.img</code> generated:

* <https://www.balena.io/etcher/>

Insert the microSD generated in your Berta D2 board and use the debug port to check the boot messages and get the 
access to the Linux prompt.

## How to install new packages

To install new packages from the menuconfig menu type:

	make menuconfig
	
Then repeat the procedure to generate the new microSD image from <code>Make</code> command.

## Notes

### Regenerate the target directory

	rm -rf output/target
	find output/ -name ".stamp_target_installed" -delete
	rm -f output/build/host-gcc-final-*/.stamp_host_installed
	
