tomato compilation issues

Discussion in 'Tomato Firmware' started by clusty, May 30, 2009.

  1. clusty

    clusty Addicted to LI Member


    I am trying to compile tomato myself since I wanted to make a few tiny changes.
    I followed the readme file but i am getting some error:

    clusty@geekserve:~/router/WRT54GL-US_v4.30.11_11/release/src$ make
    make -C router all
    make[1]: Entering directory `/home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router'
    rm -rf /home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router/mipsel-uclibc/target
    rm -f /home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router/mipsel-uclibc/linux.trx /home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router/mipsel-uclibc/vmlinuz /home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router/mipsel-uclibc/target.image
    [ ! -d libbcmcrypto ] || make -C libbcmcrypto
    [ ! -d nvram ] || make -C nvram
    make[2]: Entering directory `/home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router/nvram'
    mipsel-uclibc-gcc -DBCMWPA2 -I. -I/home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/include -Wall -I/home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router/shared -s -O2 -c -o nvram_linux.o nvram_linux.c
    make[2]: *** [nvram_linux.o] Error 255
    make[2]: Leaving directory `/home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router/nvram'
    make[1]: *** [nvram] Error 2
    make[1]: Leaving directory `/home/clusty/router/WRT54GL-US_v4.30.11_11/release/src/router'
    make: *** [all] Error 2

    These errors are from trying to compile the vanilla Linksys linux (I am getting exactly same error when trying to compile the overwritten tomato).

    Any help is appreciated.

    Thanks a lot for your time
  2. mstombs

    mstombs Network Guru Member

    What version of Linux? Elsewhere in this forum you will find the additional build tools and shell path needed for Ubuntu (apt-get bison flex etc).
  3. clusty

    clusty Addicted to LI Member

    it is an ubuntu server edition 9.04
  4. nvtweak

    nvtweak LI Guru Member

    In Ubuntu I needed to do this:

    #On Ubuntu, relink /bin/sh to /bin/bash instead of dash (dash is not 100% compatible with bash)
    mv /bin/sh /bin/sh.dash
    ln -s /bin/bash /bin/sh

    Thanks to roadkill for the tip.
  5. Victek

    Victek Network Guru Member

    Clusty.. doo it simpler.. copy & execute these lines:

    victek@roller:~$ sudo apt-get install aptitude build-essential binutils flex bison autoconf gettext texinfo sharutils subversion libncurses5-dev ncurses-term zlib1g-dev g++ (press Enter)
    victek@roller:~$ sudo ln -sf /bin/bash /bin/sh (press Enter)

    and should work now..
  6. clusty

    clusty Addicted to LI Member

    did that, but did not help

    problem still stands
  7. clusty

    clusty Addicted to LI Member

    i did all that stuff before.

    I am going to release/src
    and doing a make there.

    anything else to it?
  8. mstombs

    mstombs Network Guru Member

  9. clusty

    clusty Addicted to LI Member

    32. Had the those issues with th 64 bit machine but I switch to a 32 one
  10. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Has anyone gotten the 1.25 ND version to compile? I thought it may have been a repository issue (if the source improperly has both source and compiled objects and they don't match, the results can be a bit indeterminate). However, I just downloaded the linksys source and tomato-fied it completely outside of git and still got errors.

    I've massaged it past a few errors, but they just keep seeming to pop up. Has anyone compiled it?

    I can compile 1.25 with the 1.23 ND driver just fine (and that's what I did for the TomatoVPN 1.25vpn3.3 release).
  11. nvtweak

    nvtweak LI Guru Member

    Come to think of it, maybe the problematic files were sflash.o and sflash.c

    I will try compiling tomato-ND again and get back to you.
  12. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    The tomato-ND-1.25 in the git repository is after I already made some changes (git commit) to git rid of a few other errors, but stopped one short it seems. *sigh* I guess I should have just kept plugging along at them. But, with so many problems, I thought something must be awry and wasn't ruling out something on my end. I wonder if Jon's script to bundle up the appropriate source files messed up here like it did with the regular tomato.tar...

    If I remember correctly, teddy_bear uses a different wireless driver than both regular and ND Tomato.
  13. nvtweak

    nvtweak LI Guru Member

    I never tried compiling original 1.24 or 1.25 source since it seemed to be royally broken. You fixed most of the errors but ND still doesn't compile. Sorry, I forget what I did to compile it now. I think it had to do with prom or sflash. In your tomato-ND branch there is no sflash.o in release\src\linux\linux\arch\mips\brcm-boards\bcm947xx but in the original source there is. Try copying sflash.o there or in the src\shared folder.
  14. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    sflash.o is in the tomato-ND branch (not in the tomato branch), and I'm hesitant to copy files from any other version as the wireless driver may not match.

    Maybe I'll send Jon and email and have him check to see if the sources available are correct.
  15. nvtweak

    nvtweak LI Guru Member

    Sorry, you're right. That must've gotten moved or deleted after make. However, there is also sflash.c in src/shared which I have always needed to delete to compile the ND version up until now.

    Good luck getting a response from Jon because it would be nice if everyone could easily compile the firmware without jumping through hoops.
  16. mstombs

    mstombs Network Guru Member

    I just nursed mine through

    make[1]: Leaving directory `/home/user/Code/TomatoSource_1_25/tomato/release/src/btools'
    Creating TRX: image/tomato-ND.trx
    TRX Image:
     Total Size .... : 2916352 (2848.00K)
       Images ...... : 2915880
       Padding ..... : 472
     CRC-32 ........ : D32D365D
     128K Blocks ... : 23
       0: 0x0000001C
       1: 0x000A6E28
       2: 0x00000000
    1.25.0000  ready
    user@Ubuntu:~/Code/TomatoSource_1_25/tomato/release/src$ ls image -laF
    total 2860
    drwxr-xr-x  2 user user    4096 2009-06-02 22:58 ./
    drwxr-xr-x 12 user user    4096 2009-06-02 22:58 ../
    -rw-r--r--  1 user user 2916352 2009-06-02 22:58 tomato-ND.trx
    I'll now delete it and see if I can do it from a single script...

    Not a fluke, just used this script to do it again

    #!/bin/bash -x
    cd ~/Code/TomatoSource_$ver
    tar -xzf ../WRT54GL_v4.30.11_11_US.tgz
    mv WRT54GL-US_v4.30.11_11 tomato
    cd tomato/release/src/
    rm -r et
    rm -r et.4702
    rm -r wl
    rm -r rts
    rm -r tools
    rm .model
    cd router
    rm -r busybox
    rm -r cron
    rm -r dnsmasq
    rm -r httpd
    rm -r iproute2
    rm -r iptables
    rm -r ipupdate
    rm -r lib
    rm -r libnet
    rm -r libpcap
    rm -r mipsel-uclibc
    rm -r misc
    rm -r nas
    rm -r netconf
    rm -r ntpclient
    rm -r nvram
    rm -r others
    rm -r rc
    rm -r ses
    rm -r shared
    rm -r traceroute
    rm -r udhcpd
    rm -r upnp
    rm -r utils
    rm -r www
    #read -p "Press any key…"
    cd ~/Code/TomatoSource_$ver
    if [ -f "TomatoSource_$ver.tar.bz2" ]; then
      bunzip2 TomatoSource_$ver.tar.bz2
    tar -xf TomatoSource_$ver.tar
    #read -p "Press any key…"
    tar -xf tomato.tar
    tar -xf tomato_ND.tar
    cd tomato/release/src/shared
    rm bcmsrom.c bcmutils.c hnddma.c linux_osl.c sbutils.c sflash.c  
    #patch for X86-64
    cp /home/user/Code/TomatoSource_1_23/tomato/tools-src/uClibc/ldso/util/ldd.c /home/user/Code/TomatoSource_$ver/tomato/tools-src/uClibc/ldso/util/ldd.c
    #read -p "Press any key…"
    # toolkit already installed
    cd ..
    #Patch for Makefile echo
    cp /home/user/Code/Makefile .
    #gedit ~/Code/TomatoSource_$ver/tomato/release/src/router/shared/tomato_profile.h
    #cp -f ~/Code/TomatoSource_$ver/Makefile ./Makefile
    #read -p "Press any key…"
    sudo ln -s ~/Code/TomatoSource_$ver/tomato/tools/brcm /opt/brcm
    export PATH=$PATH:/opt/brcm/hndtools-mipsel-uclibc/bin:/opt/brcm/hndtools-mipsel-linux/bin
    with result

    1.25.0000  ready
    make[1]: Leaving directory `/home/user/Code/TomatoSource_1_25/tomato/release/src'
    user@Ubuntu:~/Code/TomatoSource_1_25$ ls tomato/release/src/image/ -laF
    total 2860
    drwxr-xr-x  2 user user    4096 2009-06-02 23:13 ./
    drwxr-xr-x 12 user user    4096 2009-06-02 23:13 ../
    -rw-r--r--  1 user user 2916352 2009-06-02 23:13 tomato-ND.trx
    and it appears to work

    Tomato 1.25.0000
    BusyBox v1.14.0 (2009-06-02 23:07:56 BST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.
    But I notice teddy_bear has already updated git to

    [B]27 May 2009 -- BusyBox 1.14.1 (stable)[/B]
  17. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Ugh. I just realized a bit ago that I had simply forgotten the extra instructions Jon added to the README for ND compilation a few releases ago. All the changes I was having to make were just recreating those instructions one at a time. :redface:

    The git repository now compiles fine. Man I feel like an idiot.
  18. mstombs

    mstombs Network Guru Member

    Seems a bit strange to me that ".c" files have to be removed because they do not compile - so that pre-compiled ".o" are used. Where is the source of the ".o" that are used? - are they Broadcom binary only or does it just mask the real issue that the header files from WRT54GL are not right for the newer hardware? I thought the ND kernel came from a WHR GPL release (must also be present in Asus and Netgear GPL....?)
  19. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    I'm also a bit troubled by that, but I've chalked it up to Linksys (and probably Asus and Netgear) is not completely GPL compliant (thus, the "recent" spat with the FSF).

    If I'm not mistaken, I think teddy_bear uses a newer version that does have the source available. I think it would be great for it to be rolled into the regular Tomato ND version.
  20. bogderpirat

    bogderpirat Network Guru Member

    i was trying to compile 1.25 for the first time ever, and sorta failed a lot.
    this is what i have:
    - a virtual machine running ubuntu 9.04 32bit
    - a laptop running the same

    i have also:
    - switched ubuntu's dash over to bash
    - done: sudo apt-get install aptitude build-essential binutils flex bison autoconf gettext texinfo sharutils subversion libncurses5-dev ncurses-term zlib1g-dev g++
    - symlinked the brcm directory to /opt/brcm and added the two gcc binary paths to the PATH variable

    my attempts were made using:
    - WRT54GL_v4.30.11_11_US.tgz
    - TomatoSource_1_23.tar.bz2 AND TomatoSource_1_25.tar.bz2, both off the sourceforge page.
    - Tomato_RAF_1.25.8515ND_Source_code.tar.bz2 from victek's site

    okay, now if i try compiling the linksys firmware, everything works out smoothly. lots of compiling, then it compresses the files and builds an image.

    if i however delete the files given in jon's README file and extract any of the three tomato firmwares' tomato.tar (OR tomato.tar AND tomato-ND.tar), then try to compile again, it suddenly doesn't progress any further from a certain point, which in all three cases is the same. here's a paste including the last few successful instructions:

    install /home/julian/Code/TomatoSource_1_25/tomato/tools/brcm/hndtools-mipsel-uclibc-0.9.19/lib/ /home/julian/Code/TomatoSource_1_23/tomato/release/src/router/mipsel-uclibc/target/lib/
    install /home/julian/Code/TomatoSource_1_25/tomato/tools/brcm/hndtools-mipsel-uclibc-0.9.19/lib/ /home/julian/Code/TomatoSource_1_23/tomato/release/src/router/mipsel-uclibc/target/lib/
    install /home/julian/Code/TomatoSource_1_25/tomato/tools/brcm/hndtools-mipsel-uclibc-0.9.19/lib/ /home/julian/Code/TomatoSource_1_23/tomato/release/src/router/mipsel-uclibc/target/lib/
    install /home/julian/Code/TomatoSource_1_25/tomato/tools/brcm/hndtools-mipsel-uclibc-0.9.19/lib/ /home/julian/Code/TomatoSource_1_23/tomato/release/src/router/mipsel-uclibc/target/lib/
    install /home/julian/Code/TomatoSource_1_25/tomato/tools/brcm/hndtools-mipsel-uclibc-0.9.19/lib/ /home/julian/Code/TomatoSource_1_23/tomato/release/src/router/mipsel-uclibc/target/lib/
    install /home/julian/Code/TomatoSource_1_25/tomato/tools/brcm/hndtools-mipsel-uclibc-0.9.19/lib/ /home/julian/Code/TomatoSource_1_23/tomato/release/src/router/mipsel-uclibc/target/lib/
    install /home/julian/Code/TomatoSource_1_25/tomato/tools/brcm/hndtools-mipsel-uclibc-0.9.19/lib/ /home/julian/Code/TomatoSource_1_23/tomato/release/src/router/mipsel-uclibc/target/lib/
    busybox/examples/ -k /home/julian/Code/TomatoSource_1_23/tomato/release/src/linux/linux/vmlinux -b /home/julian/Code/TomatoSource_1_23/tomato/release/src/router/mipsel-uclibc/target/lib/modules/2.4.20/
    Finished loading files.                              
     WARNING: Library is not used by anything.
     Attempted to remove 0/0 symbols. 445.81K - 1.85K = 443.96K not found, skipping...
     WARNING: Library is not used by anything.
    /opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-ld: no input files
    *** ERROR: ld returned 256
    make[1]: *** [install] Fehler 1
    make[1]: Verlasse Verzeichnis '/home/julian/Code/TomatoSource_1_23/tomato/release/src/router'
    make: *** [all] Fehler 2
    it just stops doing anything until i hit enter at both
    Code: WARNING: Library is not used by anything.
    Code: WARNING: Library is not used by anything.
    after the latter, it just errors out.

    it appears that the error stems from release/src/btools/ - line 345, but i can't figure out why.

    has anyone ever stumbled over this, or got any idea on how to rectify this?

    e: well, it seems like this is a bug of ubuntu, or at least my installation of ubuntu. i tinkered around A LOT with this script - it links dynamic dlls and creates xref symbols - until it worked through the thing, however didn't link anything. i can't really figure out why this happened, but it did on both of the laptop's ubuntu 9.04 and the virtual machine's ubuntu 9.04, so i'm guessing the issue lies there.
    i just set up a debian 5.0, conducted the previously mentioned preparations for the compilation process and started it - and it went through without a hitch. maybe this can serve others as an educational advice. ;)
  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