[[PageOutline(1-3,Contents)]] = Sources and toolchain to build fon-ng and applications = ||'''Needed packages:'''||subversion g++ libdigest-crc-perl ncurses-dev zlib1g-dev gawk bison flex autoconf intltool-debian intltool|| ||'''Subversion server:'''||http://svn.fonosfera.org|| ||'''Commands:'''||`$ svn co http://svn.fonosfera.org/fon-ng/trunk/`[[BR]]`$ cd trunk`[[BR]]`$ chmod +x install.sh`[[BR]]`$ ./install.sh`[[BR]]`$ cd openwrt`[[BR]]`$ make menuconfig #save`[[BR]]`$ make V=99`|| [[BR]] == Introduction == A corner stone of the fonosfera is its [http://svn.fonosfera.org subversion server] which feature reading writes for all enthusiasts willing to retrieve sources and toolchain to cross compile the blending edge fon-ng firmware or their own applications. If you have a development project for the fon-ng firmware, contact us we will open you a folder with witting rights. [[BR]] == Needed Packages == The set of packages needed to retrieve and compile fon-ng depends on the distribution you are using. Here is how to install them: '''Ubuntu 8.10''' {{{ $ sudo aptitude install subversion g++ libdigest-crc-perl ncurses-dev zlib1g-dev gawk bison flex autoconf intltool-debian intltool }}} '''Debian''' {{{ # apt-get install binutils cpp gcc libc6-dev linux-kernel-headers make zlib1g-dev ncurses-dev g++ gawk bison flex unzip bzip2 autoconf libdigest-crc-perl python subversion }}} [[BR]] == Retrieve Sources == To retrieve the sources from fonosfera's svn create a folder in a partition where you have at least 3GB of available space. '''Download sources''' {{{ $ svn co http://svn.fonosfera.org/fon-ng/trunk/ }}} When download is completed subversion will echo the version downloaded: ''Checked out revision XXX''. You may save that for future reference. '''Update and install FON feeds''' {{{ $ cd trunk $ chmod +x install.sh $ ./install.sh }}} [[BR]] == Menuconfig == {{{ $ cd openwrt $ make menuconfig }}} No change are compulsory. Just make sure that you have the right target system selected (Fonera 2.0 or Fonera 2.0n), then you can just exit, save and build fon-ng. [[Image(makemenuconfig_main.png)]] [[BR]] === OpenWRT Applications === Some of the packages from [http://downloads.openwrt.org/kamikaze/8.09/atheros/packages/ OpenWRT repository] will run on fon-ng. Though kernel modules (kmod-... packages) won't work as fon-ng uses a different version of the linux kernel than OpenWRT Kamikaze 8.09 In addition you will get the most recent versions of the applications if you compile them yourself. ''You can skip this step completely if you just want to build the normal Fon firmware, without any additional packages. You can also come back to this step later, after you've built the normal firmware.'' '''Update and OpenWRT feeds.''' This retrieves info about the available packages from the OpenWRT svn repository. {{{ $ ./scripts/feeds update -a }}} '''Install a package.''' This installs a specific package. For example, to install the "tcpdump" package, from ''openwrt/feeds/packages/net/tcpdump'', we run: {{{ $ ./scripts/feeds install tcpdump }}} Note that this page used to suggest using the {{{./scripts/feeds install -a}}} command, but don't do this! OpenWRT has made some changes in their build system that the Fon firmware does not contain. Some packages depend on these changes, so installing all of them (even when not enabling them in the configuration) breaks building the firmware. Also note that before 2.3.7.0 (r1740), the dependency resolution of the {{{feeds}}} script was broken. This has been fixed in r1740. * To get specific applications to be compiled each time you build fon-ng, mark them as '''''' in menuconfig so they get built as packages. * Mark them as '''<*>''' if you want them directly integrated in the built image. * Mark ''Select all packages by default'' to get all applications to be compiled as packages. Build will take way longer and you are more likely to run into errors. [[Image(makemenuconfig_package.png)]] [[BR]] === Set kernel options === Though it should not be necessary, to change the options of the linux kernel run: {{{ $ make kernel_menuconfig }}} [[BR]] === Set image to developer mode === Before building fon-ng make sure that developer mode (SSH access) is set in ''~/fon-ng/trunk/fon/fonbase/files/etc/config/registered'': 'dev' option should be set to '1' as in: {{{ config fonreg fonreg option registered 0 option dev 1 }}} Developer mode is currently the default. [[BR]] == Build == Building an image is a long process, depending highly on your hardware and on what you selected to be compiled. As a really ruf estimation, just to give an idea, you should not count on less than an hour and up to five if you want to compile all OpenWRT packages. The first time you build several extra sources will be downloaded automatically, rendering the process longer that usual. === Build image === {{{ $ make V=99 }}} ''V=99'' option gives a verbose output. If the compilation fails with an error it allows you to get back a little and see what happened, or copy/paste the the end of the output to get help. === Build a specific application as a package === {{{ $ make package/name/{clean,compile,install} V=99 DEVELOPER=1 }}} Replace ''name'' by the name of what you want to build i.e. ''amule''. All decencies will be built along, in separated packages. DEVELOPER=1 causes the build system to build the package and its dependencies regardless of whether they are enabled in menuconfig (so you can leave that out if you enabled the package in menuconfig). === Built Binaries === * Binary image are found in ''openwrt/bin'': * ''loader.bin'' is the second stage Meraki loader (2.0g only). You should not generally need this. * ''openwrt-fonera2.img'' or ''openwrt-fonera2n-squashfs.img'' is the binary image of fon-ng. It contains the rootfs and the kernel for the Fonera 2.0 and can be directly written to the ''image'' partition. Note that before 2.3.7.0 / r1710, the image filename for 2.0g was different and a few extra files were generated. * Packages are found in ''openwrt/bin/packages/mips'' (or ''mipsel'' for 2.0n). Note that both the ones included in the built image and the ones compiled as package are there. === Flashing in the built firmware === Now you've built your firmware, you should flash it in. You can't use the webgui upload for this, since that only accepts signed tarballs (even in DEV mode, currently). Instead, you can upload your firmware using {{{scp}}} or {{{wget}}} and use the {{{mtd}}} command to flash it in. See [wiki:sshflash this page for details]. [[BR]] == References == * fon-ng is based on the OpenWRT kamikaze linux distribution. Most of what apply to OpenWRT as well do to fon-ng. Do not hesitate to consult [http://kamikaze.openwrt.org/docs/openwrt.html OpenWRT docucmentation] or any other OpenWRT related documentation. * Questions, problems, feedback regarding this page? Join our [http://fonosfera.org/mailman/listinfo mailing list] or drop by on [wiki:irc IRC].