domenica 17 gennaio 2016

Build Gargoyle for Raspberry Pi



Here we go:

1. Go to the building section of the official Gargoyle site and download repo:

http://www.gargoyle-router.com/wiki/doku.php?id=developer_documentation#building_from_source

Usually:

sudo apt-get install git
git clone git://gargoyle-router.com/gargoyle.git

2. Install all the packages needed:

http://www.gargoyle-router.com/wiki/doku.php?id=developer_documentation#building

On a 32 bit system:
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev subversion flex uglifyjs texinfo

Or for a 64 bit system:

sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo

Install package proposed by OpenWRT wiki:

https://wiki.openwrt.org/doc/howto/buildroot.exigence

sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk
sudo apt-get install subversion mercurial


Install dependency like UglifyJS.
Require Nodejs.
https://nodejs.org/en/download/package-manager/

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

UglifyJS global install via NPM:
https://www.npmjs.com/package/uglify-js

sudo npm install uglify-js -g

3. Change directory:

cd gargoyle


4. Make custom to choose the Raspberry pi build config:

make custom


5. Choose from the menu:

Target System (Broadcom BCM2708/BCM2709)


For Raspberry Pi 1:

Subtarget (BCM2708 based boards)

Target Profile (Raspberry Pi 1)


For Raspberry Pi 2:

Subtarget (BCM2709 based boards)

Target Profile (Raspberry Pi 2)


6. Save and before exit go into the "custom-src" folder and copy your config file into "/targets/raspberrypi/profiles/default/" as "config".

7. In the terminal window where you have started the "make config" do Ctrl+C to kill the process.

8. Now do:

make raspberrypi


9. Gargoyle will compile and build your image in /images/raspberrypi-src/ ready to be flashed on sdcard!

If some packages are missing, try to search them here:
https://downloads.openwrt.org/latest/

Troubleshoot

If your building process keep failing try to switch to a previous branch like for Raspberry Pi 1:

git checkout 1.8
Then execute your "make custom" like usual. Try even to delete and redownload the repo if things get broken after the first successful build.

make clean

make cleanup

make distclean

If Gargoyle keep compiling without asking you to configure your building,
try to enlarge your terminal window.
If it's to small compiling will start without asking anything because it can't render the MENUCONFIG window.

If it keeps to building the wrong target like "ar71xx" config, try to put your generated config file of MENUCONFIG (If you save it in menuconfig you can find it in "custom-src" folder inside the "gargoyle" folder) in /targets/custom/profiles/default/ to override the default one or try to create a different folder in targets with your configuration file (placed like the others in 'profiles/default/') and then do

make yourtarget