# libreCMC build HOWTO

This generic documentation is for building libreCMC firmware images that are for supported target devices. While libreCMC does allow for building for other tagets, not all have been tested to work with libreCMC and are not supported if they are not mentioned on the libreCMC wiki.

libreCMC is licensed under the GPLv2 and contains code from other free software projects. Some code may be licensed under other free software licenses and will be noted. All software is to be distributed under the terms of the GPLv2 or their respective free software licenses.

## What do I need to get started?

* GNU/Linux distro (Trisquel, *buntu, Fedora or others)
* GNU GCC / GCC-C++
* flex
* gawk
* ncurses-dev (ncurses5-devel, etc..)
* libghc-zlib-dev
* patch
* perl5
* subversion
* git-core 

## Building libreCMC

1) Get the latest libreCMC source code:

`git clone git://gitorious.org/librecmc/librecmc.git`
`git clone http://gitboria.com/RISCi_ATOM/librecmc.git`

or download v1.2.1 :

[librecmc-v1.2.1.tar.bz2](http://downloads.librecmc.org/sources/v1.2.1/librecmc-v1.2.1.tar.bz2)

2) Configure libreCMC for your device. 

 `make menuconfig` 

 When configuring libreCMC for your device, it is imperative that the right target and profile are selected. Currently, we only _officially_ support the AR71XX target and the TP-Link TL-MR3020 and Netgear WNDR3800. If you want other packages, please keep in mind that these devices don't have very much in terms of flash ROM and your selection of packages may not work properly. Generally, a good default configuration includes:


 * luci : Collections -> luci  + luci -> protocols -> luci-proto-relayd
 * Networking : wpa-cli + wpa-supplicant + iw
 * Utilities : Editors -> Nano

3) When done configuring, run:

 `make`

 If the build fails, type:

 `make V=s`

 if there are missing dependencies in your build environment, please install them and then run `make`.

4) If the build exits without any errors, you should have a new image in:

 `$SRC_ROOT/bin/$BUILD_TARGET/librecmc-$BUILD_TARGET-generic-$TARGET_PROFILE-$VERSION-$FS_TYPE-factory.bin`

 Where `$BUILD_TARGET = target (ex. ar71xx)`, `$TARGET_PROFILE = device`, `$VERSION = device version (some don't any)`

5) Flash the newly built image (if you are confident). libreCMC project is not responsible for bricked devices.
