WikiDevi.Wi-Cat.RU:Tomato/How to build, and rebuild Tomato, FOR TOTAL NOOBS
Introduction
The first step is to get yourself a linux environment. I suggest using a noob friendly build like Ubuntu. You can use it as live distro, install it, or create a virtual machine. As this is a total noob guide, I am inclined to think all of you reading this come from windows, so the easiest way is to create a Virtual machine and then installing Ubuntu on it. For this guide to work correctly, or just to work, you need internet connection, except for the How to compile the latest tomato snapshots, if you have already downloaded the snapshot.
Creating a linux environment using a Virtual Machine
- Install a virtual machine, I suggest Oracle VM Virtualbox, which is free and has all you need. (http://www.virtualbox.org/wiki/Downloads)
- Create a new virtual machine following the instructions.
- Download your linux iso and mount it on a dvd drive (virtual or not).
- Now on the main window of Virtualbox (if you are using this virtual environment), right click on your newly created virtual machine and go into configuration, adjust the settings as you like, and go into storage select ide and where you read cd/dvd empty select the drive where you have your linux distro mounted.
- Accept the changes and run your virtual machine.
- Now install your distro, in my case I suggest using the latest Ubuntu build, (http://www.ubuntu.com/desktop/get-ubuntu/download).
- Now that you have your linux environment installed, you must, or should install “guest additions”. This will allow you to resize the window of the virual machine, copy text from windows to your virtual machine, and a much more pleasant experience. To do this easily just open terminal, (if you are in Ubuntu, go to applications, accessories and click on terminal), and type:
sudo apt-get install build-essential linux-headers-$(uname -r)
It will ask your user password, as sudo command needs it to give you administrative privilidges.
sudo apt-get install virtualbox-ose-guest-x11
sudo reboot
This will reboot. If you want, Ubuntu will prompt you with updates, there will be no harm if you update or if you don’t, I personally always update everything :p. Now you’ll see everything is much more fluid and friendly to use. Now that you have your linux environment up and running, lets start playing:
How to compile Official tomato releases from git
(I recommend not to close terminal on the whole process).
First you must install all dependencies and build tools necessary, for this you have two ways:
1. Go into synaptic and do it manually, I suggest this method for this packaged (it is located in Ubuntu under system, administration, synaptics package manager).
libncurses5, libncurses5-dev, m4, bison, flex, libstdc++6-4.4-dev, g++-4.4, g++, libtool, sqlite
or
2. Go into terminal and type:
sudo apt-get install libncurses5 libncurses5-dev m4 bison flex libstdc++6-4.4-dev g++-4.4 g++ libtool sqlite
Now again on terminal type:
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make gettext unzip zlib1g-dev sudo apt-get install libc6 libncurses5-dev automake automake1.7 automake1.9 sudo apt-get install git-core
For X64 systems also:
sudo apt-get install libc6-i386 lib32z-dev
and (optional)
sudo apt-get install gitk
3. Create a directory and go into it (cd)
mkdir tomato_git cd tomato_git
4. Clone the tomato repository onto your new folder, this will take a while so go take a coffee.
git clone git://repo.or.cz/tomato.git
(Once downloaded the git, to update it just type cd ~/tomato_git/tomato and git pull if that dosnt work, delet the tomato_git folder, and start the process from 3º point on)
5. Now you must select the version of tomato which you want to work with, if you want to compile Tomatousb, search for the latest version and copy its whole name, to do this type:
cd tomato
or
cd ~/tomato_git/tomato
if you closed terminal. When in tomato_git/tomato type:
git tag | grep tomato*
or
git branch -a
This will show all the names of the different tomato build available, copy the one you want to build, in our case the latest tomatousb (in this moment its tomatousb-K26-1.28.9052.beta23 or the k24 version)
or:
gitk --all &
which will show you all branches, tags and commits in a graphical UI. Once selected, type:
git checkout theversionyouselected
example:
git checkout tomatousb-K26-1.28.9052.beta23
6. Now you must create another folder to work, for example called tomato.
mkdir ~/tomato cd ~/tomato
7. Copy what is inside “~/tomato_git/tomato” into “~/tomato” just copy it manually, but leave the tomato folder inside tomato_git. If you don’t know were to look, the tomato and the tomato_git folders should be on: places, computer, file system, home, and whatever your username is.
8. When the transfer has finished, you must create a symlink, so on terminal type:
sudo ln -s ~/tomato/tools/brcm /opt/brcm
9. Execute this manually by typing it on terminal or put this line into your shell .profile file:
export PATH=$PATH:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin
10. Go into your source folder:
cd ~/tomato/release/src-rt
(for k26 builds)
or
cd ~/tomato/release/src
(for k24 build)
11. Clean the work (not necesary, but recomended if you have compiled another build before)
make clean
12. And last but not least, lets compile ^^.
make V1=version example 9052 V2=tailored name example beta23 command
some examples would be:
make V1=9052 V2=beta23 e3000 make V1=9052 V2=beta23 e2000 make V1=9052 V2=beta23 r2m etc
The compiled firmware will be under tomato/release/src-rt/image for k26 builds and tomato/release/src/image for k24.
On command you can specify specific builds, for example e3000 will build tomatousb extras with 60k nvram, e2000 will build standart no usb with 60k nvram, for more commands type make help on the specific directory you want (k24 will be src, k26 will be src-rt), here you have the list of availible commands: Commands
13. So this is all, type on terminal to clean a bit:
make clean
14. YAY if you were lucky and followed all correctly you will have a new folder (image) on tomato/realease/src-rt or tomato/realease/src, which will have your newly built firmware.
15. To restart a compile from the same source you downloaded
after compile is done. Delete contents of ~/tomato cd ~/tomato_git/tomato git clean -fdxq && git reset —hard copy the contents of ~/tomato_git/tomato to ~/tomato
start from step 8
How to compile latest tomato snapshots from git
(I recommend not to close terminal on the whole process).
First you must install all dependencies and build tools necessary, for this you have two ways:
1. Go into terminal and type:
sudo apt-get install libncurses5 libncurses5-dev m4 bison flex libstdc++6-4.4-dev g++-4.4 g++ libtool sqlite
or go into synaptic and do it manually (it is located in Ubuntu under system, administration, synaptics package manager).
2. Now again on terminall type:
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make gettext unzip zlib1g-dev
sudo apt-get install libc6 libncurses5-dev automake automake1.7 automake1.9
sudo apt-get install git-core
and (optional)
sudo apt-get install gitk
3. Create a directory and go into it (cd)
mkdir tomato_git
cd tomato_git
4. Clone the tomato repository onto your new folder, this will take a while so go take a coffee.
git clone git://repo.or.cz/tomato.git
(Once downloaded the git, to update it just type cd ~/tomato_git/tomato and git pull if that dosnt work, delet the tomato_git folder, and start the process from 3º point on)
5. Now you must select the version of tomato which you want to work with, if you want to compile Tomatousb, search for the latest version and copy its whole name, to do this type:
cd tomato
or
cd ~/tomato_git/tomato
if you closed terminal. When in tomato_git/tomato type:
For k24
git checkout origin/tomato-ND-USBmod
or for k26
git checkout origin/tomato-RT
6. Now you must create another folder to work, for example called tomato.
mkdir ~/tomato
7. Copy what is inside “~/tomato_git/tomato” into “~/tomato” just copy it manually, but leave the tomato folder inside tomato_git. If you don’t know were to look, the tomato and the tomato_git folders should be on: places, computer, file system, home, and whatever your username is.
8. When the transfer has finished, you must create a symlink, so on terminal type:
sudo ln -s ~/tomato/tools/brcm /opt/brcm
9. Execute this manually by typing it on terminal or put this line into your shell .profile file:
export PATH=$PATH:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin
10. Go into your source folder:
cd ~/tomato/release/src-rt
(for k26 builds)
or
cd ~/tomato/release/src
(for k24 build)
11. Clean the work (not necesary, but recomended if you have compiled another build before)
make clean
13. And last but not least, lets compile ^^.
make V1=version example 9052 V2=tailored name example beta23 command
some examples would be:
make V1=9052 V2=beta23 e3000 make V1=9052 V2=beta23 e2000 make V1=9052 V2=beta23 r2m etc
The compiled firmware will be under tomato/release/src-rt/image for k26 builds and tomato/release/src/image for k24.
On command you can specify specific builds, for example e3000 will build tomatousb extras with 60k nvram, e2000 will build standart no usb with 60k nvram, for more commands type make help on the specific directory you want (k24 will be src, k26 will be src-rt). The full commands are listed above under step 12 of the official git tuto.here you have the list of availible commands: Commands
14. So this is all, type on terminal to clean a bit:
make clean
15. YAY if you were lucky and followed all correctly you will have a new folder (image) on tomato/realease/src-rt or tomato/realease/src, which will have your newly built firmware.
How to compile the latest tomato snapshots
(I recommend not to close terminal on the whole process).
First you must install all dependencies and build tools necessary, for this you have two ways:
1. Go into terminal and type:
sudo apt-get install libncurses5 libncurses5-dev m4 bison flex libstdc++6-4.4-dev g++-4.4 g++ libtool sqlite
or go into synaptic and do it manually (it is located in Ubuntu under system, administration, synaptics package manager). 2. Now again on terminall type:
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make gettext unzip zlib1g-dev
sudo apt-get install libc6 libncurses5-dev automake automake1.7 automake1.9
3. Go to http://tomatousb.org/download and download the latest snapshot. There you will find the file under Downloads. Now you must untar it, type on terminal:
tar xvf Name of the file.tar.gz
Now wait until terminal has gone to normal, finished working. example:
tar xvf tomato-tomato-RT.tar.gz
4. Once untared right click on the tomato folder created on downloads and select copy to home folder.
5. When the transfer has finished, you must create a symlink, so on terminal type:
sudo ln -s ~/tomato/tools/brcm /opt/brcm
6. Execute this manually by typing it on terminal or put this line into your shell .profile file:
export PATH=$PATH:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin
7. Go into your source folder:
cd ~/tomato/release/src-rt
(for k26 builds)
or
cd ~/tomato/release/src
(for k24 build)
8. And last but not least, lets compile ^^.
make V1=version example 9052 V2=tailored name example beta23 command
some examples would be:
make V1=9052 V2=beta23 e3000 make V1=9052 V2=beta23 e2000 make V1=9052 V2=beta23 r2m etc
The compiled firmware will be under tomato/release/src-rt/image for k26 builds and tomato/release/src/image for k24.
On command you can specify specific builds, for example e3000 will build tomatousb extras with 60k nvram, e2000 will build standart no usb with 60k nvram, for more commands type make help on the specific directory you want (k24 will be src, k26 will be src-rt) here you have the list of availible commands: Commands
9. So this is all, type on terminal to clean a bit: make clean
10. YAY if you were lucky and followed all correctly you will have a new folder (image) on tomato/realease/src-rt or src/image, which will have your newly built firmware.
Flash from windows:
If you preffer to flash your router from windows, send it to your email XD and download it in windows, or use the shared folder on your virtual machine, etc. Flash it from stock(recomended) or ddwrt, do a nvram reset, and have fun with your new Tomato router.
Commands
k26 commands:
a A build (standard)
b B build (standard minus SSH)
c C build (standard minus CIFS)
d D build (standard minus Samba server)
m M build (standard plus extra utilities and NTFS support)
e E build (standard plus VPN, extra utilities and NTFS support)
s S build (no USB support)
f F build (no USB support minus JFFS and CIFS)
v V build (VPN with no USB support)
e3000 Linksys E3000 build (standard plus extras)
e3000v Linksys E3000 build (standard plus VPN)
e2000 Linksys E2000 build (no USB support)
r2m MIPS Release 2 M build (standard plus extras)
r2e MIPS Release 2 E build (standard plus VPN and extras)
r2v MIPS Release 2 V build (VPN with no USB support)
r2s MIPS Release 2 S build (no USB support)
r2f MIPS Release 2 F build (no USB support minus JFFS and CIFS)
IPV6SUPP=y - Compile with IPv6 Support
..etc.. other build configs
clean -C router clean
cleanimage rm -rf image
cleantools clean btools, mksquashfs
cleankernel -C Linux distclean (but preserves .config)
distclean distclean of Linux & busybox (but preserve .configs)
prepk -C Linux oldconfig dep
libc -C uClibc clean, all, install
k24 commands:
a A build (standard)
b B build (standard minus SSH)
c C build (standard minus CIFS)
d D build (standard minus Samba server)
m M build (standard plus extra utilities and NTFS support)
e E build (standard plus VPN, extra utilities and NTFS support)
s S build (no USB support)
f F build (no USB support minus JFFS and CIFS)
v V build (VPN with no USB support)
r2m MIPS Release 2 M build (standard plus extras)
r2e MIPS Release 2 E build (standard plus VPN and extras)
r2v MIPS Release 2 V build (VPN with no USB support)
r2s MIPS Release 2 S build (no USB support)
r2f MIPS Release 2 F build (no USB support minus JFFS and CIFS)
..etc.. other build configs
clean -C router clean
cleanimage rm -rf image
cleantools clean btools, mksquashfs
cleankernel -C Linux distclean (but preserves .config)
distclean distclean of Linux & busybox (but preserve .configs)
prepk -C Linux oldconfig dep
libc -C uClibc clean, all, install.
Videotutorial
If after all, you still have problems with your setup, here is a videotutorial I made so that steps can be followed with visual input. http://www.megaupload.com/?d=81K2AB3I
Troubleshooting
There are sometimes, when rebuilding from git, or just rebuilding, that compiling fails, and gives multiple errors, and nothing seems to solve this. This is because some configs have changed (unknown reason). There are some ways to make the files usable again:
1. As you have copied the files inside the git folder, and didnt cut them,(in theory) you can delete your work folder ~/tomato, and copy again ~/tomato_git/tomato, and so you are off with a fresh copy to work with.
2. cd into your git folder:
cd ~/tomato_git/tomato
and type
git checkout . git reset --hard
Then do a new checkout.
3. If that dosnt work, as teddy_bear suggested try:
cd into your git folder:
cd ~/tomato_git/tomato
and type
git clean -fdxq && git reset --hard
Then do a new checkout.
4. If that still dosnt work delete your git folder and do a new one clonin git and starting the process again.
Feedback
I'm leaving this page on tutorial club fore feedback and suggestions: http://tomatousb.org/forum/t-284204/how-to-build-and-rebuild-tomato-for-total-noobs
Hoped this helped someone.
All the credits of this guide goes for the ones who did http://www.linksysinfo.org/forums/showthread.php?t=64460 and
http://tomatousb.org/tut:how-to-rebuild-tomato-software
from which im making this guide, and to ddggttff3 who found http://repo.or.cz/w/tomato.git/blobdiff/a54d08e3821486dfe2cbaa712362ea712cc63694..d832816002f46a6de91f44aff961b0282ff72208:/release/src/Makefile, and of course to the developers of tomato and tomatousb, which make posible to make our routers something more.
Compiled builds
If after all you dont want to compile or are too afraid, i made some builds npt availible on http://tomatousb.org/download:
Official beta23 builds:
E3000 extras build http://www.megaupload.com/?d=VNGG56VM
E3000 Vpn+extras http://www.megaupload.com/?d=0BIWPYWD
E2000 standart http://www.megaupload.com/?d=3RAMGAZD.
Latest snapshot, dualband support:
E3000 Extras build http://www.megaupload.com/?d=ISJ9XMW0