This setup was orignially done on FC release version 2 yesterday I had the
opertunity of setting one up for a friend from
a hands on point of view.
I currently have the WRT54GS version but yesterdays was on a older model WRT54G
version 2.0 which installed successfully.
These are not the orignal notes taken from yesterdays intall but simular to
what the install path we took.
Install your OS on your laptop or desktop then go to the Linksys site where
the GPL source is available. I recommend downloading
the binnary version along with the source package. Once your 180 meg download
of the orignal and lastest version of the
source for the WRT54G is finished you can move the files to
"/usr/local/src" on your linux distrbution.
The first time I read the documentation for building the firmware it didn't
make any sense but after a few times it becomes clear.
I hope this post and yesterdays hands on will open up new doors and a new learning
experience for my friend.
Back to are install, once everything is in "/usr/local/src" we can
decompress are source file and also are binnary bin image. For
those of you who are confident with building your own source or experienced
with kernel compiles and trusting your own source then
you can skip updating your device with the finished binnary image provided by
Linksys.
Once you untar your source you should now have a directory called "WRT54G"
which is the source from the Linksys Firmware. First cd into
the "WRT54G" directory. You will see a few folders "release","tools",
"tools-src", and a README.TXT file.
The "release" directory is the actual source for your firmware that
you will be building in a few minutes. "tools" directory is the
uclibc library files and the mipsel stuff that is required to use to build your
firmware.
From previous times of installing and building my own firmware I ran into alot
of issues with protecting my current installation from
getting thrashed from setting up my own custom paths and along with not using
root to build the firmware which in my experience was and
maybe my own mistakes but to follow the doc's and make this work i recommend
you sudo to root to build.
In side the "/usr/local/src/WRT54GS/tools" directory you'll see a
folder name "brcm", you'll want to move that folder or copy that directory
to the
"/opt" directory on your systems "/opt" directory. We can
do that by using this command which will copy the directory there.
"cp -r brcm/ /usr/local/src/WRT54GS/tools/"
Once that is done we want to take a look at our enviromental path because we
will need the mipsel and uclibc in our current path. We can do
this by using this command here.
"env"
Your OS will show you a list of stuff like your alias's and such but the thing
we're looking for is this here,
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/fuck/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/mysql/bin:
/usr/local/snort/bin:.
We will be adding to new lines to our users enviromental path. The paths we
need are going to be
"/opt/brcm/hndtools-mipsel-linux-3.2.3/bin" and "/opt/brcm/hndtools-mipsel-uclibc-0.9.19/bin"
So from your CLI "command line interface" or shell please type this
to add the two directories to your PATH. You can do this by typing
this command here and it will also add the two new directories to your PATH.
"PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/fuck/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/mysql/bin:
/usr/local/snort/bin:/opt/brcm/hndtools-mipsel-linux-3.2.3/bin:/opt/brcm/hndtools-mipsel-uclibc-0.9.19/bin:."
Once the above is executed you'll see the new two paths added to your current
enviroment. You can double check by using the
"env"
command in your console and we should double check to make sure that it is
in our path. So double check and we should see this
in the PATH section after issuing the
"env"
command.
"PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/fuck/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/mysql/bin:
/usr/local/snort/bin:/opt/brcm/hndtools-mipsel-linux-3.2.3/bin:/opt/brcm/hndtools-mipsel-uclibc-0.9.19/bin:."
If you follow the above it should all work out if not then I suggest you go
back and try again before going on any farther. Okay if
everything when fine we can move on to the next step.
Now we need to change directory and go up into the release folder from our
current directory in "/usr/local/src/WRT54G/tools" so we will
want to cd ../ into
"/usr/local/src/WRT54GS"
once there we can double check to see where we're at by issuing the
"pwd"
command to see what directory we're in.
"pwd"
And now we can see that the "pwd" command shows us we're in "/usr/local/src/WRT54G",
from here we will want to go into the "release" directory and start
building
are source from scratch. In the
"/usr/local/src/WRT54G/release" folder we will see these folders.
"image", "src", and "tools"
The image folder is where are final or our image or firmware will be dropped
off when we have a successful compile. Please change diretories
into the src folder by using this command here.
"cd src"
Once in the src folder we will see a few more folders, with the
"ls" command we'll see
"cy_conf.h", "cy_conf.mak", "et", "et.4702",
"include/", "linux/", "Makefile", "router/",
"rts/", "shared/", "tools/", and "wl/"
The "router" directory is where all of our work will be done at. For
a quick heads up when building your own source with added features the
"/usr/local/src/WRT54G/release/src/router"
folder is where you'll put your added software at. For this current build we
will not be doing that since this is just a walk through on
building the default Linksys firmware by itself.
Okay back to bussiness, we will now change directories into the router folder
by using
"cd router"
Once in the router directory we can do
"ls"
We will see these directories in the "/usr/local/src/WRT54G/release/src/router"
folder.
bpalogin/ cron/ iptables/ libpcap/ misc/ openssl/ pptp-client/ rp-pppoe/ upnp/
www/
bridge/ dnsmasq/ ipupdate/ Makefile netconf/ others/ rc/ shared/ utils/ zebra/
busybox/ httpd/ lib/ mipsel/ ntpclient/ ppp/ README traceroute/ vlan/
config/ iproute2/ libnet/ mipsel-uclibc/ nvram/ pppd/ rp-l2tp/ udhcpd/ wlconf/
See the above direcotories ? I hope so if not try going back into /usr/local/src
and cd into the WRT54G folder then into the release
folder from there cd into the "src/" directory and then cd into the
"router" directory and you'll be up to pace with us.
Are we all caught up ?
I'm sure it wasn't that hard if your still lost just follow the few steps I
just gave you.
The "Makefile" here is where all the instructions for building our
firmware is located and the "README" file is the documentation
for adding your own paths and etc. along with adding new or more features to
your build.
We will now execute this command to start the firmware build so put your seatbelts
on!
"make menuconfig"
The "make menuconfig" will load the menu with the routers options
and interfaces it will look just like the kernel interface when
building a custom linux kernel. Word of advice please take the time to browse
the features and extra options available but at this
time don't take out or add any features to the build we're just building this
to get a feel for building a custom build later on in
another tutorial i waill publish.
I hope you took the time to see all the options and etc available, please use
the arrow keys on your key board and move it to save
your build and select "YES" and this will automaticly take you into
another interface which will be the actual kernel itself like from
a linux kernel installation.
Another heads up again for the future if you wanted to add support for ipv6
or other features can be added from here, but again this
is just a walk through to get your hands and feet wet with building.
Again if your experienced with building linux kernels you can just use your
arrow keys and select exit and "YES" to save your kernel,
if this is your first time seeing the second menu the kernel options go ahead
and browse though the options and don't add or remove
anything here. When finished go ahead and select the save and "yes"
to the menu.
Once all of this is done you'll see a line on your screen saying run "make
dep" go ahead and ignore this message and cd up back into the
"/usr/local/src/WRT54G/release/src" directory.
Once your in the
"/usr/local/src/WRT54G/release/src"
you can just simply type "make" in your CLI "command line interface"
or shell and let your firmware build and once this
step is done and you get no errors your build is now finished and you will
now have a hand made or custom firmware that you built yourself
in "/usr/local/src/WRT54GS/release/image" directory.
The files in
"/usr/local/src/WRT54GS/release/image"
will have a extention of
".bin" and ".trx"
the ".bin" is the actual firmware that you can use from the administration
firmware upgrade menu from the web-based interface for upgrading
your routers firmware.
I hope these instructions will help you when building your own firmware and
at a later time i will show you how to setup kismet and snort in another
documentation.
|