Tomato build environment - Virtualbox image

Discussion in 'Tomato Firmware' started by Justio, Jan 1, 2019.

  1. Justio

    Justio Networkin' Nut Member

    Fellow forum user(s) have asked for help with the "Tomato build environment" for the Tomato firmware (most recent request).
    My interested is to see the development of Tomato continue so, taking this into account, i have decided to help this community as much as i can, therefore i am sharing hereunder my "Tomato build environment - Virtualbox disk".
    [The virtual Guest machine i'm using is running under a Linux Host but may be imported to other operating systems. Here's a link on "how to" do that.]
    This post does not cover the "How to build Tomato firmware"
    For more info on the "how to compile", you can read (not skim) this post and this post. Of course other posts are available, just use the forum "search" button or a search engine.
    Also take into account that i'm not an expert in compiling so i will not be able to answer / reply to future questions related to compilation errors. If this will be the case, please try to get help from other users on the forum. Anyway, when asking for help please be polite and wait for an answer, sometimes it takes weeks or even months to get the expected answer.

    These are my Virtualbox "Guest machine" settings (of course, yours may vary):

    Virtualbox version used: 5.2.18 r124319
    Host OS: Linux
    Guest OS: Linux Mint 17.3 - 64bit
    Guest VM user: vbox
    Guest VM password: tomatoVM
    Base Memory: 3072MB
    Acceleration: VT-x/AMD-V, Nested Paging, PAE/NX, KVM Paravirtualization
    No. of processors: 2
    Video Memory: 128MB
    Storage:

    Controller: SATA
    Sata Port0: Linux Mint 17.3 - Tomato-disk.vdi (download)

    Actual disk size (compacted) and to be downloaded: 7,26 Gb
    Disk size when full: 16Gb
    Audio: yes
    Network: Intel PRO/1000 MT Desktop (Bridged adapter); you can also use NAT
    USB Controller: Yes (2.0)
    Shared Folders: Yes, recommend to be added for easy file sharing between Host and Guest.
    If you decide to add, the Guest OS is already configured to access the "Shared folder"


    After the download and the import into your VM of the Tomato-disk.vdi image, you'll have to clone the desired repo. To help with this i left on the "Guest Machine" desktop some hints in case you do not know your way around. Try to follow those and maybe you'll have a successful result :p

    Other hints:
    After each successful compilation do not forget to "make clean"
    If issue compiling, try to re-download or reset your git: git clean -fdxq && git reset --hard
    or checkout an older commit (maybe that is the issue) ;).

    Thanks to @azdps, @AndreDVJ, @tomatosoup, @koitsu, @kille72, @Toastman @RMerlin who helped me with precious information required to build this VM

    Disclaimer: I am not responsible for any bricked router or computer. Use this at your own risk!:D
     
    Last edited: Jan 4, 2019
    mmosoll, kille72, cloneman and 2 others like this.
  2. rs232

    rs232 Network Guru Member

    First of all: thanks! :)

    Few feedbacks as I'm testing this on vbox in Windows (vbox 6.x)

    - Great idea about the README in the VM
    - There's no Linux Mint option under Guest OS in my vbox so I have imported this as Other Linux (x64)
    - I've just noticed that the root password is not provided and it's not "tomatoVM"
    - I'm wondering if a vmware image could be produced out of this
    - ssh is not enabled, perhaps a good idea to do so in the before creating the VMimage?
    - probably audio and usb are not needed

    Great stuff! :cool:
     
    Justio likes this.
  3. Justio

    Justio Networkin' Nut Member

    Glad to help!

    Please find here-under my comments on your remarks:
    - There's no Linux Mint option under Guest OS in my vbox so I have imported this as Other Linux (x64)
    It can be imported as "Ubuntu X64" (Mint actually is based on Ubuntu).

    - I've just noticed that the root password is not provided and it's not "tomatoVM"
    The "vbox" user is a member of "administrators" so just use "sudo" command to work your way around.
    https://unix.stackexchange.com/ques...-root-password-on-linux-mint-my-user-password

    - I'm wondering if a vmware image could be produced out of this
    No idea, i guess the answer is yes if it worth the time spent
    https://duckduckgo.com/?q=convert+virtualbox+to+vmware&t=lm&ia=web

    - ssh is not enabled, perhaps a good idea to do so in the before creating the VMimage?
    I as was using the VM to access the online repos from time to time, so i've activated the firewall as a security precaution (Check GUFW GUI or just write firewall in the Menu). So in order to use ssh you have 2 options: disable the firewall or allow ssh ports if you know your way around.

    - probably audio and usb are not needed
    Probably not. For me it was useful :)

    Edit regarding ssh comment above:
    i've checked and ssh server is not installed on the VM (probably i forgot...) anyway you just need to open the terminal and do "sudo apt-get install openssh-server" and after everything works like a charm. Don't forget to deal with the firewall
     
    Last edited: Jan 2, 2019
    kille72 likes this.
  4. rs232

    rs232 Network Guru Member

    Thanks!

    For some reason the root password did now work when I tried to fix ssh. It did work now though... must have been me and my typos...
     
  5. Monk E. Boy

    Monk E. Boy Network Guru Member

    Stupid fingers, type what I meant, not what I told you to type! I hate bad typing days.
     
    kille72 likes this.
  6. JeffD

    JeffD Serious Server Member

    Thank Justio et. al, made getting up to speed very easy! Took a while to d/l from mega, but that was far less work than configuring another VM myself.

    Has anyone successfully done a make distclean from the src-rt directory? I suspect it should work but my attempt failed. (yes, I know it's overkill but I want to verify a few trx files with the official builds. I was watching the builds and after various errors during the clean pass I didn't notice anything serious, just warnings until pass 34 miniupnpd where it encounters problems with patches. There may have been other things but nothing which caused the build to stop.

    I'm walking though the information in this post:
    https://www.linksysinfo.org/index.php?threads/tomato-build-failure.73009/#post-281830
     
    Last edited: Jan 9, 2019
    Justio likes this.
  7. Sean B.

    Sean B. LI Guru Member

    It is highly recommended to reset the full source tree between builds. Make *clean is not reliable in the least with Tomatos spiderweb source tree and non standardized patching. This can be done quickly using git tools, or via a properly made backup tar.
     
  8. JeffD

    JeffD Serious Server Member

    Was wondering about the clean option given what I saw in the builds. Maybe possible, but wasn't sure there could be any guarantees. So distclean or all options wouldn't be recommended? Is there some other script that handles full dist sets?

    I'm not sure what you mean about "this can be done quickly with git tools", while I understand git well I don't understand what you're suggesting.

    I did build freshtomato-K26USB_RT-MIPSR2-2018.5-VPN.trx, but the file is very different than the release from pedro. I know the OSes are different but that shouldn't matter. Maybe the build tools are at different versions...
     
    Last edited: Jan 9, 2019
  9. Sean B.

    Sean B. LI Guru Member

    Using commands provided by git to manipulate your local repo. IE: " git reset --hard " and " git status " etc. I made a small script that leverages some git commands and automates removing modified files that git requires you to manually remove:

    Code:
    #!/bin/sh
    COUNT=0
    
    echo "WARNING! This will delete any and all local changes to this repo. Continue? Y/N"
    read answer
    
    if [ "$answer" == "${answer#[Yy]}" ]
      then
        echo "Exiting."
        exit 1
    fi
    
    # Reset the repo
    
    echo "Resetting repo.."
    
    git reset --hard >/dev/null
    
    echo "   done."
    
    echo "Checking source tree for remaining garbage.."
    
    if [ "$(git status --porcelain)" == "" ]
      then
        echo "   Repo source tree is sterile."
        echo "done."
        exit 0
      else
        echo "   Cleaning.."  
    fi
    
    # Cleanup any remaning modified or untracked files
    
    for line in $(git status --porcelain | cut -c4-); do
    rm -rf $line && COUNT=$((COUNT+1))
    done
    
    echo "   Deleted $COUNT modified/untracked files"
    echo "   done."
    
    # Reset the repo one more time
    
    echo "Resetting repo one more time and verifying status.."
    
    git reset --hard >/dev/null
    
    if [ "$(git status --porcelain)" == "" ]
     then
       echo "   Repo source tree is sterile."
       echo "done."
       exit 0
     else
       echo "ERROR: Git status does not report a clean source tree."
       exit 1
    fi
     
    Justio and rs232 like this.
  10. Boktai1000

    Boktai1000 Network Guru Member

    For those interested in rolling their own, I suggest adding a "one liner" to pull down all the dependencies or packages that are required for anyone wanting to build their own install and grab the dependencies themselves.

    I know I at least would appreciate it! Good work and thank you for your contribution!
     
    Justio likes this.
  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