Building FreshTomato

Discussion in 'Tomato Firmware' started by Cold Winter, Aug 30, 2018.

  1. Cold Winter

    Cold Winter Networkin' Nut Member

    At the risk of seeming dense, I'm looking at the git repo
    and wondering where the top level makefile is situated.

    I'm studying the process to see if this can be built under
    an Arch Linux system... just for the challenge.

    Is there a more detailed build process doc somewhere?
     
  2. koitsu

    koitsu Network Guru Member

    1. Are the literal step-by-step-with-commands instructions in README.md not sufficient? They're literally the best walk-through I've seen outside of what I wrote years ago for building Toastman (I've since taken down my blog so that info is gone). You have to read them slowly and carefully, but they're crystal clear:

    ARM: https://bitbucket.org/kille72/freshtomato-arm/src
    MIPS: https://bitbucket.org/pedro311/freshtomato-mips/src

    Or is all of that working for you and you're trying to figure out "where" to run make from? If so, what you need to know is this (for ARM. For MIPS, you want directory release/src-rt IIRC):

    cd release/src-rt-6.x.4708
    make {buildtype}


    {buildtype} is the type of firmware you want. Try make help else review the Makefile to get a list.

    Your firmware(s) will end up in the image/ directory.

    There are arguments V1 and V2 you can give make (ex. make V1=foo V2=bar {buildtype}) that will get auto-populated into the firmware itself as well as the filename. You'll need to experiment with these, as I believe they're different in FreshTomato (or Shibby?) than in Toastman.

    Your PATH being correct is probably the most important thing. Do not try to move directories around (ex. the /opt situation, symlinks, etc.); you must comply with the pathname convention. A lot of this is Broadcom's fault, not Tomato.

    You're also going to need to know that you quite often will need to "start over from scratch" when building the firmware if something goes awry. This doesn't mean reinstalling the OS, this means making sure the entire git directory structure is clean/pristine -- all object files/etc. are stored within the repo itself. make clean or make distclean will not clean things up or come even close. This is just how Tomato is. How to clean things out properly (verify with git status after!) to make sure your next make attempt is from the ground up:

    git reset --hard && git clean -dxf

    2. You are going to run into major packaging complications using ArchLinux, I can promise you that. They don't provide the exact same versions of necessary toolchain and build software (particularly GNU autotools) as others. I've discussed in the past in detail major issues with trying to use distros other than what the maintainers use (Debian 9.x 64-bit). The reason I was using Mint, BTW, was because that's what Toastman firmware is built with.

    As such, you should use the exact OS/distro, version, and architecture -- all 3 are VERY important! -- mentioned in README.md to guarantee success. This isn't so much the fault of Tomato as it is the fault of the distros, packages, and GNU autotools.

    If you don't want to reinstall your OS then use a VM (ex. VirtualBox, VMware Workstation), or consider paying a small amount of money per month for a service like Linode to get such a machine.

    If despite these warnings you still want to give it a shot anyway, great. But you are on your own to troubleshoot and analyse any problems (the thread I linked is proof of the skill set depth you're going to need; the patch_files stuff that's unique to FreshTomato is a good example), and solve them in a way that continues works on the distro used per the README.md, if you wish to contribute your work back upstream.

    This sounds a bit brash/harsh, but you're going to be expected to review the Makefile (and things they include), their targets, etc. to try and figure out what does what. It's not documented and there's basically no comments anywhere, so reverse-engineering everything is pretty much par for the course every step of the way.

    Welcome to present-day Linux where nothing is consistent! :)
     
    Last edited: Aug 30, 2018
    AndreDVJ likes this.
  3. moffa

    moffa Networkin' Nut Member

    The problem you will have is that arch being a rolling distro will use a newer version of gcc. With gcc 7, you get a bunch of errors that you have to work your way through. It's a pretty big headache and I don't recommend it.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice