DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

#1 2008-10-29 03:08:12

puterboy
Member
Registered: 2008-09-18
Posts: 306

setup.sh script (and documenntation) to run ffp and mount root on USB

Here is the heavily commented script that I use to run ffp off of my USB drive (actually stick) and to also reload my kernel to run off a (second) root partition on the USB drive.

Here is the documentation extracted from the head of my script:

### setup.sh - Custom initialization script - Jeff Kosowsky
### Loads usb-storage.ko module to allow usb filesystems if not already
###     in kernel (either integrated or already loaded as a module)
### Mount the USB partition ($USBFFPPART) on $USBFFPMOUNT
###    - Optionally run ffp off of a USB (flash) partition ($USBMOUNTPART)
###      mounted on $USBFFPMOUNT
###      Option invoked if file $USBFFPMOUNT/.usb-ffp exist
###    - Optionally reboots kernel with new root filesystem on a usb partition
###      ($USBROOTPART) mounted on / (and also on $USBROOTMOUNT)
###       Option invoked if above option invoked and $USBFFPMOUNT/.usb-root exis
###
### NOTE: If $USBFFPMOUNT/.usb-ffp not present and/or the usb partition is not
###       available (e.g., if you remove the disk), then it boots as normal.
###
###       In fact, one of the key reasons that I use the usb drive and the
###       presence/absence of the files .usb-ffp and .usb-root to determine
###       whether to run ffp and reload the kernel on the USB drive is that
###       it gives me an easy way to abort mistakes and return to the default
###       configuration by just unplugging the relevant usb drive.
###
### NOTE: If this script itself gets corrupted and you want to take the script
###       out of the loop but you can't ssh/telnet in to remove the script,
###       then all you need to do is create a R/W samba share for Volume_1
###       and remove the script Volume_1:/.bootstrap/setup.sh
###
### REQUIRES:
###    - ffp-reloaded
###    - usb-storage.ko module ($USBMODULE)
###    - Kernel with integral usb-storage option built-in (i.e. not a module)
###      (Needed only if reloading kernel)
###    - Two ext 2/3 USB partitions:
###        $USBFFPPART: containing the /ffp fun_plug installation at its root
###             (Needed for running ffp off a USB partition)
###        $USBROOTPART: containing root filesystem
###             (Needed only if doing kernel reloading from USB partition)
###    - If you want the default dns-323 software (and web interface) to run,
###      then you need to obtain the initrd and copy it over to $USBROOTPART.
###      i.e. convert the firmware initrd into your root filesystem.
###         dd if=/dev/mtdblock3 of=initrd.gz bs=64 skip 1
###           (note skip the first block since it is a "u-boot/PPCBoot image")
###         gunzip initrd.gz
###         mkdir temp
###         mount -o loop initrd temp
###         mount $USBROOTPART $USBROOTMOUNT
###         cp -a temp/* $USBROOTMOUNT/
###         umount temp
###         umount $USBROOTMOUNT
###
### NOTE: rebooting off a usb root filesystem has the following advantages:
###    - Preserves all of the original dns-323 functionality, including
###      the full web interface functionality
###    - Allows using new kernels (plus associate modules) and (optionally)
###      modifying the initrd without risk of trashing the firmware.
###      In particular, this allows you to boot a new kernel to get things
###      like nfsd working.
###    - Allows any non-overwritten root file (including log files) to
###      survive a reboot since root is no longer on a volatile ramdisk
###    - Frees up more system memory since no longer using 16MB out of
###      64MB for a ramdisk
###    - Still allows disks to spin down since both root and ffp libs
###      are now mounted on the usb disk
###
### NOTE: if $USBFFPMOUNT/.usb-ffp not present and/or the usb partition is not
###       available (e.g., if you remove the disk), then it boots as normal.
### NOTE: We also optionally change the location of the boot log file if
###       the variable BOOTLOG is set.


Attachments:
Attachment Icon setup.sh, Size: 8,901 bytes, Downloads: 3,388

Offline

 

#2 2008-10-29 04:26:53

WildSioux
Member
Registered: 2007-03-05
Posts: 71

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Thanks, I will look at this tomorrow.  Right now I have ffp installed on HD.  Do I need to delete that first or is it required to work?  If I get ffp installed on the USB drive and working, can I delete the one off the HD then?

Thanks

Offline

 

#3 2008-10-29 05:51:27

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

The ffp installation on the usb partition does not conflict at all with the usb installation on HD_a2.
However, I would keep it on HD_a2.
In fact, the script is written so that if the USB partition is missing (and/or the corresponding 'touched' files are removed) then it defaults to booting ffp on the HD. I find that useful since it allows me to play around on my usb stick but then if anything goes wrong, I just reboot, pull the usb stick, and let it reboot from the know, working configuration on my hard-drive. Then I can replace the usb stick, mount it, and troubleshoot what went wrong.

Otherwise, if something went wrong, I would have to reinstall fun_plug which is no fun or I would have to pull the usb stick and edit it on some other machine which an also be a pita.

Offline

 

#4 2008-10-29 06:10:39

bomaroast
Member
Registered: 2008-05-30
Posts: 11

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

What is the advantage of running ffp off a usb disk?  Same question but with the root file system?

I have my watch directory for rtorrent running on a usb disk so that my disk will spin down.  I like to think the little bit of work saves me a few pennies every month.

But the root file system never has to access the disk.  And how often does ffp need to access the hard drive after boot?  Not often, I think.

edit: der..  I can read.  Frees up ram.  Not bad...  I might have to do this.  The usb stick I'm using is really crappy.  Will my dns suffer from the lack of good read/write speeds?

Last edited by bomaroast (2008-10-29 06:16:02)

Offline

 

#5 2008-10-29 07:14:31

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Well a lot of the libraries  and commands are in ffp.
Try working on the box when the disk is spun down and you will literally be twiddling your thumbs waiting for it to spin up.
But if you like things the way they are, then great....

Offline

 

#6 2008-10-29 08:37:28

rap
Member
From: Reading - UK
Registered: 2008-02-28
Posts: 119

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Hi - I was thinking of trying to move to using FFP with a hub and a USB flashdrive and my printer but have found it a bit daunting as there's so many bits and pieces of info it's difficult to know what's the newest/best.

Any chance you could document how to do this from start to finish for ffp 0.5 users as, looking at your recent posts, you seem to have done this quite recently?

RAP

Offline

 

#7 2008-10-29 15:51:00

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Why don't you read the documentation in this setup file -- I think it is pretty complete when it says what the requirements are -- and I spent several hours tidying it up.
If you just want to set up a USB flashdrive and printer without using the additional kernel reload and run ffp from usb functionality, then there is already a good howto on the web.
If you have specific questions, I would be happy to answer them.

Offline

 

#8 2008-12-07 19:00:19

3rdparty
Member
Registered: 2008-04-19
Posts: 20

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

I'm in the same boat as @rap - running ffp off HDD, and I'd like to move to a USB key.  Not really sure where to start sad

Offline

 

#9 2008-12-31 01:38:00

toolbox
Member
Registered: 2008-12-18
Posts: 83

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

puterboy, using your script and other info on the net, I have been able to run ffp (and optware) to run off my USB stick. Now, I want to reload the kernel off the USB drive. Couple of newbie questions. How big of a partition do I need for the kernel partition? Will I be able to put both partition on a 2GB USB drive? From df, about 1GB of my ffp partition is being use.
TIA.

Offline

 

#10 2008-12-31 02:14:15

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Well since the original kernel runs in 64MB of RAM including the ramdisk, you should have way enough space...

Offline

 

#11 2009-01-20 07:37:54

Fry
Member
Registered: 2009-01-15
Posts: 6

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

3rdparty wrote:

I'm in the same boat as @rap - running ffp off HDD, and I'd like to move to a USB key.  Not really sure where to start sad

I would like this info too.

Offline

 

#12 2010-01-04 22:49:34

impaire
Member
Registered: 2010-01-03
Posts: 7

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

I'm not sure of what I'm doing now. Why /ffp directory where I got a /linux directory? An adequate kernel module is now in my unit, my stick is inserted and just formated, and I'm now wgetting again debnas-0.5.tar.bz2...

Offline

 

#13 2010-01-05 00:07:26

Opperpanter
Member
From: Eindhoven, Netherlands.
Registered: 2008-08-11
Posts: 89

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Without trying it yet, for me this part is a little unclear:

Code:

- If you want the default dns-323 software (and web interface) to run,
###      then you need to obtain the initrd and copy it over to $USBROOTPART.
###      i.e. convert the firmware initrd into your root filesystem.
###         dd if=/dev/mtdblock3 of=initrd.gz bs=64 skip 1
###           (note skip the first block since it is a "u-boot/PPCBoot image")
###         gunzip initrd.gz
###         mkdir temp
###         mount -o loop initrd temp
###         mount $USBROOTPART $USBROOTMOUNT
###         cp -a temp/* $USBROOTMOUNT/
###         umount temp
###         umount $USBROOTMOUNT
###

May be you/someone could provide us with a dirlisting to show how the endresult should look like?

Offline

 

#14 2010-02-24 23:12:55

caust1c
Member
Registered: 2010-01-03
Posts: 35

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Opperpanter wrote:

Without trying it yet, for me this part is a little unclear:

Code:

- If you want the default dns-323 software (and web interface) to run,
###      then you need to obtain the initrd and copy it over to $USBROOTPART.
###      i.e. convert the firmware initrd into your root filesystem.
###         dd if=/dev/mtdblock3 of=initrd.gz bs=64 skip 1
###           (note skip the first block since it is a "u-boot/PPCBoot image")
###         gunzip initrd.gz
###         mkdir temp
###         mount -o loop initrd temp
###         mount $USBROOTPART $USBROOTMOUNT
###         cp -a temp/* $USBROOTMOUNT/
###         umount temp
###         umount $USBROOTMOUNT
###

May be you/someone could provide us with a dirlisting to show how the endresult should look like?

I could not figure this out as well, I did get as far as 2 partitions on my USB drive, actually got FFP running off it and was able to umount the HDD's after disabling samba...

I attempted to look at the FFP-reloaded but it didn't seem to make the above part more understandable.

This script however does seem to have allowed me to load and run off USB.  I also managed to get a 1.5TB Seagate USB drive automatically mounting and sharing with this setup!

I don't understand what functions would be missing, the web interface seems to work although the samba shares don't get listed properly.  The status page looks fine.  I don't see the need for following the steps in the above quote and utilizing the second partition of the USB boot drive.

Anyone care to enlighten a newbie?

Last edited by caust1c (2010-02-24 23:13:32)

Offline

 

#15 2010-04-14 06:24:58

RobertFontaine
Member
Registered: 2010-04-01
Posts: 24

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

I'm a little late to the party but YES, I too am confused as to how to get the second partition configured and mounted.
Getting the USF ffp partition up and running is pretty intuitive.
- Establishing a working root file system on the second partition and getting it running with the firmware is a lot less so.

Can someone who has been successful put together a step by step for the wiki?   I'm struggling with this one.

Offline

 

#16 2011-01-10 15:13:14

mfpockets
Member
Registered: 2011-01-10
Posts: 44

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Hi guys,

Digging up an old thread here, because I just bought a 323.  Will this work as easy as it sounds?

http://zyxel.nas-central.org/wiki/FFP-stick

After I install to a usb stick, how do I know if it will run off my HDD install (already setup) or if it will run the USB one?

Any thoughts?

Offline

 

#17 2011-01-10 20:57:56

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

That will work as easy as it sounds, but only on a ZyXEL NAS.

Offline

 

#18 2011-01-10 23:35:15

mfpockets
Member
Registered: 2011-01-10
Posts: 44

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Mijzelf wrote:

That will work as easy as it sounds, but only on a ZyXEL NAS.

WOW brain fart on that one,  that's what happens when your browsing the net 5 mins after you wake up. 

Is there a newer, easy way to run this for the dns 323?  The script in the OP is all commented, and I am really a newb with linux and im not sure how to implement it. 

Been looking for a straightforward method to run ffp off usb, and maybe allocate some ram for the unit to use as well.

Planning on using a 4gb stick that I dont use for much else. 


suggestions?  links would be much appreciated.  Ive tried searching but I am way behind on the learning curve with this machine and things like reloaded and other stuff keeps getting mentioned leading to me searching other threads to see what I need. 

Just asking to be steered in the right direction with what is newest/easiest way to do this

Offline

 

#19 2014-05-08 19:30:51

mika123
Member
Registered: 2011-04-20
Posts: 11

Re: setup.sh script (and documenntation) to run ffp and mount root on USB

Hey, everything worked great until I decided to add a line to setup.sh and made a typo, which causes the script execution to fail.
Of course, the file and the .bootstrap folder are owned by root, so I can't edit them via smb or ftp and ffp just won't load.
Does anyone have an idea on how I can edit and save setup.sh and boot properly again?

Feelling *pretty* dumb right now... :-(

Update: Panic over... I ended up taking out disk 1, setting up fun_plug on disk 2, rebooting, editing the faulty script on disk 1 via telnet and then swapping the disks again. Still feeling dumb though :-)

Last edited by mika123 (2014-05-08 20:37:44)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB