1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Announce] Jac3a Alternate Firmware for NAS200

Discussion in 'Cisco/Linksys Network Storage Devices' started by jac_goudsmit, Jul 28, 2009.

  1. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    This version is now obsolete.

    Please click here for the latest version

    ===Jac





    I don't have time right now to put a full write-up here, but I made Jac3a available.

    You can download it from http://www.nas200.net/jac3a/NAS200_V34R79jac3a.bin.

    This version adds a new feature that allows you to run a script from a USB stick or a config partition early on during the boot process, which you can use to switch your root filesystem to a different location! All other features from Jac3 are unchanged but I'm so excited about this important new feature that I can't wait to put it online.

    The way it's implemented is: I made a small change to the kernel so that it will run /init (if it exists) instead of /sbin/init, and /init in the ROM filesystem is a simple script that searches for a file called nas200.sh on a USB stick and on the config partitions of the hard disks. Wherever it finds it, it runs it. When it's done, it uses exec to run /sbin/init as usual.

    I still have my Gentoo root filesystem on my first hard disk's data partition, so I have a USB stick with a nas200.sh that reads:

    Code:
    /bin/mount -t xfs /dev/sda1 /tmp
    cd /tmp
    /sbin/pivot_root . ./rom <dev/console >dev/console 2>&1
    
    When I put that USB stick in my USB port and reboot the NAS200, it runs Gentoo, because after the script returns, the /init script continues and runs exec /sbin/init which now refers to the init program on the Gentoo partition.

    Of course it's still running kernel 2.6.19 but it may be possible to use kexec to replace that too. I remember trying kexec (a long time ago) and I couldn't get it to work.

    If your USB stick is FAT or FAT32 formatted, use the USB1 port (near the edge of the unit). You can also use an ext2 formatted USB stick on port USB2 (near the center).

    For those who want to replace their busybox or Twonky server in-place, I recommend logging in through Telnet or SSH during a normal startup, and mount /dev/mtdblock1 someplace, then copy everything from there to your new root device. You can replace whatever you want and then put a nas200.sh on a USB stick to enable booting to that new root directory (which doesn't necessarily have to be the same device!). When you're convinced that your setup works, you can copy the nas200.sh file to /harddisk/volume_1/conf to make it always start. The USB is always checked first so if you get stuck you can write a nas200.sh on your USB stick to remove the nas200.sh files from your config partitions.

    Notes:

    The nas200.sh script is started before everything else, so nothing is mounted yet, not even proc; the device where nas200.sh is stored is mounted at /mnt. Also the clock won't be set.

    nas200.sh must be a script (it doesn't need to start with #!/bin/sh or whatever) and it must be in Unix text format (LF line endings only), so use a good editor like Notepad++ to create it.

    If you use a standard distro such as Gentoo, Debian etc. you will probably need to adapt the configuration (especially /etc/inittab) so that it uses the serial port as console. You may also need to add a serial port to your NAS200. If you are simply running a modified copy of an existing NAS200 distro, you won't need to change the configuration.

    More information later!

    ===Jac
     
  2. DJ Soulfly

    DJ Soulfly Addicted to LI Member

    Great work for this new version :thumbup:

    The only thing i come up with is that the custom startup-scripts won't execute on boot. Maybe i did something wrong but i can figure out what it is.

    I have a scriptsdir.txt which point's to /harddisk/volume_3/data/rc.d and on that folder i have three rc.xxx file's 2 of them won't load rc.amule and rc.dctcs. The last script rc.shells is doing his job because i have as default shell busybox 1.13.3

    Contents of rc.dctcs :

    #!/bin/sh

    cd ctorrent
    ./run.dctcs

    Contents of rc.shells :

    #!/bin/sh

    cp /harddisk/volume_3/data/rc.d/shells/shells /etc

    Contents of rc.amule :

    #!/bin/sh

    cd amule
    ./amuled -f -c=/harddisk/volume_3/conf/root/.aMule/
    ./amuleweb -f=/harddisk/volume_3/conf/root/.aMule/remote.conf &

    Maybe someone knows how to fix this
     
  3. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    The file is actually called /etc/scriptdirs.txt. It is generated (or copied from /harddisk/volume_1/conf) in /etc/rc.d/rc.sysinit. The fact that you have at least one script that DOES work, tells me that your scriptdirs.txt is probably fine, otherwise none of your scripts would run.

    I do see that you used relative paths in the scripts that you say aren't working; those may be the cause of your problem. If I remember correctly, the current directory during execution of the scripts is /, not the directory where the scripts are. It's a good habit for scripts not to rely on what the current directory is...

    Try changing your scripts to use full paths. I assume this is what you had in mind:

    Code:
    #!/bin/sh
    #
    # rc.dctcs
    
    cd /harddisk/volume_3/data/rc.d/ctorrent
    ./run.dctcs
    Code:
    #!/bin/sh
    #
    # rc.amule
    
    cd /harddisk/volume_3/data/rc.d/amule
    ./amuled -f -c=/harddisk/volume_3/conf/root/.aMule/
    ./amuleweb -f=/harddisk/volume_3/conf/root/.aMule/remote.conf &
    
    Again, use a UNIX compatible editor so that line endings are stored as Line Feed only, not Carriage Return + Line Feed. If you don't, it won't work. Using vi in a Telnet or SSH session is an option, or you can use the built-in editor of WinSCP.

    Hope this helps!

    ===Jac
     
  4. DJ Soulfly

    DJ Soulfly Addicted to LI Member

    My mistake i have made a typo on my previous post it's indeed scriptsdirs.txt which is on /etc/

    I'll edited the files with vi and it works finally. I really didn't know that it was a full path problem that so stupid of me. Thank you :thumbup:

    ps. just curious are you planning on another jacxx firmware release on upgrading busybox to a new version or isn't this possible?
     
  5. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    It sure is possible to update any and all software that runs on the NAS200 but it's kinda messy because of the way the Sercomm engineers integrated Busybox and the other programs into their build system.

    There will probably be a few more JacX releases because I think it should be easier for users to replace their Busybox and Twonkyserver, and add software like amuled or rsync by simply installing it. But I doubt that I will update the Busybox on any future JacX update.

    I decided because I have limited time, I would concentrate on things that are easy to accomplish. Enable telnetd in busybox, add dropbear, add custom scripts, add a pre-init script, that sort of thing. This gives you the advantage of at least SOME flexibility in how you can use the box, while still retaining compatibility with the existing Linksys firmware. This is important, because that way it's still in "wife compatible mode" even while you're hacking.

    The new pre-init script feature gives you the option to make more changes (like installing an updated busybox, or even run Debian or Gentoo) which will still let you fall back to "wife mode" in an easy way: just unplug the USB drive.

    And that's kinda how I see my firmware: as a fall-back firmware that gives you just enough extra functionality to get creative and change the box the way you like, but also the stability of all the software that was originally present when you bought it. I think this benefits the largest number of people: not just the 1337 h4x0rz that want to run an LFS kernel on their NAS just because they can, but also the more casual user that doesn't want to bother with FTP and just likes to log in through SSH and download a file over the internet using SCP. In the end, I want JacX to be the last firmware you will ever flash, just like you don't often flash a new BIOS into your PC. The harddisks will let you run cool stuff and should let you install it and update it as many times as you want, just like you can reinstall Windows or Linux at any time and have a completely newly installed system without flashing the BIOS.

    ===Jac
     
  6. DJ Soulfly

    DJ Soulfly Addicted to LI Member

    Ok i got your point it's not so easy as it like to be to update the busybox in the firmware.

    The firmware is very usefull of yours i can finally run things i can't even imagine that it was possible on my nas. Even this new feature which allows running another distro of linux thats so freaky amazing and it boost my linux knowledge to a higher level.

    Just remember keep up the good work of this firmware :thumbup:
     
  7. Poulpi06

    Poulpi06 Addicted to LI Member

    great, i try it immediatly ;)
     
  8. spirit69

    spirit69 Addicted to LI Member

    Jac, just read an artikel on the linksys community forum, someone requesting functionality for a trashbin so you can control file deletion in a multi user environment.
    I read that Linksys is using samba 3.0.22, and since version 3.0 there is a plugin functionality in which you can load and configure a recylce.so.

    Should it be possible to recompile this for the nas, i think that is a valuable addon?

    Just an idea, maybe someone can pick it up? I do lack the skills eh knowledge to setup recompile environments etc but i might give it a go.

    Keep up the good work

    Spirit6x
     
  9. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Undoubtedly if Samba can do it, it can be implemented on the NAS200. If someone wants to build it, be my guest.

    Personally, I always turn all trashcan functionality off because I want files to be gone when I delete them. If I deleted them by accident (which happens only very rarely), I can restore them from a backup that doesn't take up space on my hard disks or on my screen.

    In short, yes it can probably be done but I'm sorry, this is something that I'm not personally interested in and that I don't have time for. Sorry...

    ===Jac
     
  10. DJ Soulfly

    DJ Soulfly Addicted to LI Member

    Maybe the wrong topic. But is there any change to get gcc working on the nas to compile new programs for the linksys or is there something else
     
  11. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Good question. Yes it's possible to run a gcc on the NAS but it's not a good idea... the system is so slow that you don't really want to make it compile its own software.

    Of course it's not a big deal because any gcc compiler that produces i386/i486 code can be used.

    ===Jacv
     
  12. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

Share This Page