Using Entware\Optware on stock firmware

Discussion in 'ASUS Wireless' started by ryzhov_al, Nov 24, 2012.

  1. ryzhov_al

    ryzhov_al Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    470
    Location:
    Smolensk, Russia
    It's related to any modern ASUS router with USB port: RT-N10U, RT-N13U, RT-N15U, RT-N16, RT-N56U, RT-N65U, RT-N66U, RT-AC66U. All those routers uses a stock firmware partially based on TomatoUSB code, so we may use a custom start/stop scripts to ignite external services from USB drive!

    1. Start/Stop scripts.
    There is a two script, which can be saved right into NVRAM:
    • one will be executed right after mounting every partition on boot,
    • another will be executed right before dismounting partition before reboot.
    Take a look:
    If you'll run it once a two scripts will be saved: one — to start Entware/Optware services form USB HDD partition labeled MYPART, second — to shutdown it gracefully. Both scripts may survive reboot. All you have to do is to choose a partition to store Entware/Optware content and format it with MYPART label, for example:
    Please note: a stock firmware limits execution time for this script up to 3 seconds. If you need more time, I can show how to do it later.

    2. Post-firewall rules.
    Some services like a torrent client or SSH server needs an open port, so we need a script that will be executed after every applying of current firewall rules (e.g. in case of internet reconnection). A stock firmware got some limitation here but there is a way to open a port range:
    It will be equal to following firewall rules:
    6881 UPD port will be opened in any case along with desired port range.

    3. USB hotplug script.
    When firmware can't recognize an attached USB device, it may run a custom script to handle a new device. This my be useful to those who attaches a USB printer. I did not test this feature, but it looks good. Just save your usbplug-script to script_usbhotplug NVRAM variable, just like in #1.
     
    Last edited: Nov 25, 2012
  2. leonid.b

    leonid.b New Around Here

    Joined:
    Dec 8, 2012
    Messages:
    1
    Location:
    St. Peterburg
    Problems with RT-N10U B1

    I have RT-N10U B1, with latest firmware based on asuswrt - 3.0.0.4.260
    Its not executed for every partition, only for usb. Also, I was unable to turn on jffs:
    nvram set jffs2_on=1
    nvram set jffs2_format=1
    nvram commit
    Rebooted it several times and still no jffs in /etc/mtab
    Also, there are no /etc/init.d scripts :(

    How its possible to make startup/shutdown scripts for boot, mount everything(but not usb), wan up, wan down, lan up?
     
  3. RMerlin

    RMerlin Part of the Furniture

    Joined:
    Apr 14, 2012
    Messages:
    12,745
    Location:
    Canada
    There is no JFFS support in the original Asus firmware.
     
  4. darius456

    darius456 Occasional Visitor

    Joined:
    Oct 16, 2012
    Messages:
    11
    Ok Merlin I understand this, but is there any way to turn on JFFS on Asus firmware :confused:. Right now I have 2 router, first is RT-N66U and second is DSL-N55U. On 66u everything works just fine @ 3.0.0.4.246.20 but right now I have to use some scripts on DSL so i'm desperately looking for a method to turn on JFFS.
    Ps. On DLS optware wors great (transmission + nano).
    Right now looking for JFFS and cron for DLS... please help. :)

    PSPS.
    Works great... thx.
     
  5. ryzhov_al

    ryzhov_al Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    470
    Location:
    Smolensk, Russia
    darius456, leonid.b, JFFS support is switched off at compile time. There is nothing we can do with stock firmware.

    AFAIK, crond is enabled by default in any 3.0.x.x firmware, take a look at
    /usr/sbin/crond. Please note, it's not a Vixie's cron, remove username field from crontab file.

    Thanks.
     
  6. RMerlin

    RMerlin Part of the Furniture

    Joined:
    Apr 14, 2012
    Messages:
    12,745
    Location:
    Canada
    Crond is compiled in Asus's firmware, but it doesn't get launched at boot time (unless they changed that at some point).
     
  7. darius456

    darius456 Occasional Visitor

    Joined:
    Oct 16, 2012
    Messages:
    11
    Should I put my cron tasks in /var/spool/cron/crontabs/ like in RT-N66U??
    If so, what will happen if i reboot router... all my cron task will disappear. Where i can put some script to add cron jobs after reboot?

    Ooo, so how can I turn it on? Simply crond on telnet or something more sophisticated?
     
  8. ryzhov_al

    ryzhov_al Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    470
    Location:
    Smolensk, Russia
    If you are using Optware, why don't you run crond with /opt/etc/init.d start script?

    You may place custom crontab file to /var/spool/cron/crontabs/ in start script.
     
  9. darius456

    darius456 Occasional Visitor

    Joined:
    Oct 16, 2012
    Messages:
    11
    I'm quite newbie on optware/entware and all that stuff. So could you explain. If i put any script on init.d it will be executed on reboot? Any name of sh file or like in rt-n66u jffs/script i should use some specific file name?
     
  10. ryzhov_al

    ryzhov_al Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    470
    Location:
    Smolensk, Russia
    While you are using Optware or Entware, /opt/etc/init.d is a place for start/stop scripts. This folder is not related to firmware directly, but it's a common place to ignite any external service.

    A start/stop scripts named as S10samba, S15vsftpd, S50downloadmaster and so on. A two digits number after "S" determines the start/stop order. In example:
    • start sequence: S10samba, S15vsftpd, S50downloadmaster,
    • stop sequence: S50downloadmaster, S15vsftpd, S10samba.
     
    Last edited: Dec 12, 2012
  11. AndreaS

    AndreaS Regular Contributor

    Joined:
    Feb 15, 2012
    Messages:
    95
    Before trying entware, i would like to have a look at the contents of the repository, but I haven't been able to find that link. Can you please provide it?

    A second question, would the entware work after a firmware upgrade as downloadmaster does (ok, with mixed results...)?

    Thanks

    AndreaS
     
  12. RMerlin

    RMerlin Part of the Furniture

    Joined:
    Apr 14, 2012
    Messages:
    12,745
    Location:
    Canada
  13. AndreaS

    AndreaS Regular Contributor

    Joined:
    Feb 15, 2012
    Messages:
    95
  14. ryzhov_al

    ryzhov_al Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    470
    Location:
    Smolensk, Russia
    Here is.

    Yes, as long as a start scripts are the part of other settings.
     
  15. thE_29

    thE_29 Occasional Visitor

    Joined:
    Mar 20, 2012
    Messages:
    22
    Is it possible to add a buildroot/gcc package to entware (also automake, autoconf, etc)?

    Because with optware you have that and i compile small things on the router itself (is faster than crosscompiling and trasnferring everytime)!
     
  16. ryzhov_al

    ryzhov_al Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    470
    Location:
    Smolensk, Russia
    In fact, Entware is OpenWRT, so no native compilation is provided. Not for now, not in future.

    A modern gcc eats too much memory for running on embedded devices. We may port it without any optimisations (-O2, -O3, -Os), but it will be useless.
     
  17. thE_29

    thE_29 Occasional Visitor

    Joined:
    Mar 20, 2012
    Messages:
    22
    Well that really sucks for me, because i was compiling oscam package (ipk) for the WL500gP Router on itself and with the normale optware from merlin-asuswrt, it is possible to compile it (as it has buildroot).

    But merlin said, that you cannot have entware and optware at the same time or?
    Or is it possible to have both at same time (with some tweaks and tricks - I have more than basic skills in linux and I am a software developer ;))?
     
  18. AndreaS

    AndreaS Regular Contributor

    Joined:
    Feb 15, 2012
    Messages:
    95
    Two more questions:
    - needed dependencies are automatically installed?
    - is it available a document describing the path of the installed files?

    Thanks for the answers to my previous post.

    AndreaS
     
  19. RMerlin

    RMerlin Part of the Furniture

    Joined:
    Apr 14, 2012
    Messages:
    12,745
    Location:
    Canada
    You would probably need to install Optware in a separate directory, and have a script at boot time that takes care of mounting either the Entware repo or the Optware repo on top of /opt.
     
  20. thE_29

    thE_29 Occasional Visitor

    Joined:
    Mar 20, 2012
    Messages:
    22
    That could work, but i would also like to run php-5.4 for OwnCloud and that is just at entware available (as optware has just php 5.2 and 5.3 is needed for OwnCloud).
    So my main problem is that i have to compile php >5.3 for optware...

    So either i make a /optEntware and /optOptware and decide on boot, which i mount over /opt or i get >php5.3 on optware (shouldnt be to hard, as i can store a little key-value pair in the nvram for that).

    Or: Is there anywhere a cross-compile HowTO for the asuswrt image? As i have some experiences with cross compiling, i know that i need a toolchain for the router, but dunno which one is supported for optware/merlin-asuswrt.
     

Share This Page