can any1 please teach howto upload ledconf to minixpartition

All about firmwares for routers. Support for RouterTech firmwares is here too.
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

can any1 please teach howto upload ledconf to minixpartition

Post by amir_s_m » Thu Jul 24, 2008 8:25 pm

I'd be very appreciate if once and for all some one teach me howto :
The led.conf file can now be loaded from a minix partition if a full path name is supplied - and as long as the minix partition is mounted via an "RT_init_x" command
* e.g., setenv led_conf /nvram/led_blahblah.conf
thanx to you guys(developers)it's a great feature added in the last release.
I found howto making a minix partition and mount it as /nvram in accompanied documents but I dont know how to upload a file to that partition.so I wonder if any one can teach me how to do all this from the scratch with full codes.and please explain complete cons and pros and todo's and not todo's of this way.thanx in advance.
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Post by mstombs » Thu Jul 24, 2008 8:32 pm

Do you use Windoze? The easiest way is to use winscp which logs in via ssh and you can then drag and drop. There are some preferences in winscp that make connection easier such as not checking for timestamps and group permissions I forget exactly what I had to select some time ago. (select Transfer mode binary for everything).

You also need to learn (and remember!) to use wordpad, notepad2 or my preference notepad++ to edit files and save them with UNIX file endings.

You should also "umount /nvram" to make sure the files are saved before rebooting.
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

Post by amir_s_m » Thu Jul 24, 2008 10:58 pm

thanx for your respond.I do use window$ xp pro/visat & Ubuntu 8.10.please make your responds complete(from the scratch as for a noobe) ;)
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Thu Jul 24, 2008 10:59 pm

WinSCP works in Linux as well (under WINE).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

Post by amir_s_m » Fri Jul 25, 2008 10:34 am

any one who could give a full answer from begining?????I want to use the new future but I don't know how??!!!
User avatar
SyBorg
Ex RouterTech Team
Ex RouterTech Team
Posts: 1621
Joined: Mon Apr 17, 2006 4:09 pm
Location: Berkshire
Contact:

Post by SyBorg » Fri Jul 25, 2008 12:11 pm

What a lot of question and exclamation marks.... :?

You have the instructions in the firmware documentation for creating the nvram partition. The documentation also includes the syntax needed to be added to the environment for the conf file to be used. So the bit in the middle is about using WinSCP. Less than a minute using Google will show you a selection of information on the net including the link to the WinSCP FAQ http://winscp.net/eng/docs/faq

Why not try reading this and having a go yourself? If this is not to your liking then perhaps this type of activity is an area you should stay away from.
We learn something every day, and lots of times it’s that what we learned the day before was wrong.
—Bill Vaughan
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

Post by amir_s_m » Fri Jul 25, 2008 1:27 pm

all ok but this part:
mstombs wrote:. 1.There are some preferences in winscp that make connection easier such as not checking for timestamps and group permissions I forget exactly what I had to select some time ago. (select Transfer mode binary for everything).
in general, and this part:
mstombs wrote:2.You also need to learn (and remember!) to use wordpad, notepad2 or my preference notepad++ to edit files and save them with UNIX file endings.
3.You should also "umount /nvram" to make sure the files are saved before rebooting.
in particular.so if you explain this 3 ,I'll do the rest by myself.thank you all guys.
User avatar
SyBorg
Ex RouterTech Team
Ex RouterTech Team
Posts: 1621
Joined: Mon Apr 17, 2006 4:09 pm
Location: Berkshire
Contact:

Post by SyBorg » Fri Jul 25, 2008 3:27 pm

amir_s_m wrote:all ok but this part:
mstombs wrote:. 1.There are some preferences in winscp that make connection easier such as not checking for timestamps and group permissions I forget exactly what I had to select some time ago. (select Transfer mode binary for everything).
try it with the settings out of the box but look for an option to set transfers to binary (read the documentation for WinSCP).
amir_s_m wrote: in general, and this part:
mstombs wrote:2.You also need to learn (and remember!) to use wordpad, notepad2 or my preference notepad++ to edit files and save them with UNIX file endings.
Windows and Unix have different ways of indicating in a file that you have reached the end of a line. The file is going to be used in a UNIX environment, so make sure that you use a text editor that can specify Unix line endings. Like mstombs I like notepad++, a quick google will find it
amir_s_m wrote:
mstombs wrote: 3.You should also "umount /nvram" to make sure the files are saved before rebooting.
in particular.so if you explain this 3 ,I'll do the rest by myself.thank you all guys.
if the router is rebooted while the nvram partition is mounted then any 'unsaved' data can be lost. Cleanly unmounting the partition will help the data to 'stick'.

I hope that this is clear enough for you.
We learn something every day, and lots of times it’s that what we learned the day before was wrong.
—Bill Vaughan
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

Post by amir_s_m » Fri Jul 25, 2008 4:12 pm

I did all :
For wireless routers and non-wireless routers with 4mb flash and 16mb RAM: Minix (read/write) filesystem support. This allows you to create read/write Minix partitions on the router.
There is a ready-made mountpoint "/nvram" that can be used for mounting.
The steps to using the minix filesystem support are:
A. create a new mtd partition - in multiples of 1024 (e.g., "makemtd.sh mtd5 131072")
B. reboot the router
C. convert it to minix (e.g., "mkfs.minix /dev/mtdblock/5")
D. mount it (e.g., "mount -t minix /dev/mtdblock/5 /nvram")
After this, you can write/read from/to "/nvram"
but when I try to copy the file winscp say's:
scp: /nvram/led.6388.conf: Read-only file system
strange!!!
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

Post by amir_s_m » Fri Jul 25, 2008 4:38 pm

thakn u very much but I still have 2 questions:
1.
SyBorg wrote:The file is going to be used in a UNIX environment, so make sure that you use a text editor that can specify Unix line endings
in the Notpad++ I used "Format>Convert to UNIX Format".so I think that would do the Unix line ending thing!
2.
SyBorg wrote: if the router is rebooted while the nvram partition is mounted then any 'unsaved' data can be lost. Cleanly unmounting the partition will help the data to 'stick'.
"unsaved data" is some how unclear,e.g if I transfer a file to /nvram from computer,what's gonna happen if I reboot whit out unmounting /nvram?do I need to transfer the file every time or just once?and do I need to unmount /nvram, before each restart(what about upgrade).another question is,do I need to reset mtd blocks and other ENV settings to their default before upgrade?(is there any other situation or conditions relevant to this?)thanks for your co-operation and help.
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Post by mstombs » Fri Jul 25, 2008 4:52 pm

amir_s_m wrote: but when I try to copy the file winscp say's:
scp: /nvram/led.6388.conf: Read-only file system
strange!!!
This suggests the nvram not mounted. Mounting (step D) has to happen every time the router boots, use one of the RT_init_x variables. The make (STEP A) and format command (STEP C) are only needed once.

You must umount /nvram before an upgrade or the web upgrade will not happen (been there many times!).

mtd5 /nvram survive firmware upgrades as long as the size of mtd4 is still big enough for the new firmware, if not then yes you need to change the mtd5 /nvram and lose any data on it.

The Linux OS caches writes to the flash blocks, umounting ensures any cache is flushed. The "sync" command is supposed to do this but in the past has not always worked. I'm not sure of the caching algorithm, maybe after a time data is written, but if you make a change, and want to reboot to test quickly this step is essential.

Note all flash memory has a finite life something in the order of 400,000 cycles. Do not create a task that writes to flash every second (you can do the maths!). This is probably why the OS protects the flash by caching as above.
Last edited by mstombs on Fri Jul 25, 2008 5:08 pm, edited 3 times in total.
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

Post by amir_s_m » Fri Jul 25, 2008 4:55 pm

mstombs wrote:
amir_s_m wrote: but when I try to copy the file winscp say's:
scp: /nvram/led.6388.conf: Read-only file system
strange!!!
This suggests the nvram not mounted. Mounting has to happen every time the router boots, use one of the RT_init_x variables. (the make and format commands are once off).

You must unmount /nvram before an upgrade or the web upgrade will not happen (been there many times!).

mtd5 /nvram survive firmware upgrades as long as the size of mtd4 is still big enough for the new firmware, if not then yes you need to change the mtd5 /nvram and loe any data on it.

The Linux OS caches's writes to the flash blocks, unmounting ensures any cache is flushed. The "sync" command is supposed to do this but in the past has not always worked.

Note all flash memory has a finite life something in the order of 400,000 cycles. Do not create a task that writes to flash every second (you can do the maths!).

Code: Select all

/var # fsck.minix /dev/mtdblock/5
fsck.minix: bad magic number in super-block
Last edited by amir_s_m on Fri Jul 25, 2008 5:07 pm, edited 1 time in total.
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

Post by amir_s_m » Fri Jul 25, 2008 5:02 pm

mstombs wrote:This suggests the nvram not mounted. Mounting has to happen every time the router boots, use one of the RT_init_x variables. (the make and format commands are once off).

You must unmount /nvram before an upgrade or the web upgrade will not happen (been there many times!).

mtd5 /nvram survive firmware upgrades as long as the size of mtd4 is still big enough for the new firmware, if not then yes you need to change the mtd5 /nvram and lose any data on it.

The Linux OS caches's writes to the flash blocks, unmounting ensures any cache is flushed. The "sync" command is supposed to do this but in the past has not always worked. I'm not sure of the caching algorithm, maybe after a time data is written, but if you make a change, and want to reboot to test quickly this step is essential.

Note all flash memory has a finite life something in the order of 400,000 cycles. Do not create a task that writes to flash every second (you can do the maths!). This is probably why the OS protects the flash by caching as above.
thanks for the answer.although red parts are kind of unclear.
Do not create a task that writes to flash every second
like what?
amir_s_m
Regular
Regular
Posts: 55
Joined: Thu Dec 13, 2007 1:07 pm

Post by amir_s_m » Fri Jul 25, 2008 5:06 pm

Code: Select all

/var # fsck.minix /dev/mtdblock/5
fsck.minix: bad magic number in super-block
I'm thinking of removing mtd5 ang remaking it whit new size,right now the size is 10240,for removing I've to copy remove_mtd5.sh to /var and make it executable and run it,am I right?
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Post by mstombs » Fri Jul 25, 2008 7:05 pm

Ahah,

It looks like the instructions are not quite correct, mtd5 should be multiples of 64K (65536), not 1024, it just happens the examples tested at the time satisfied both. It is not possible to work with smaller flash mtd, this is determined by the 'erase size', the minimum size that gets written on any change.

I do not know what your remove_mtd5.sh contains, it should unsetenv mtd5 and put mtd0 and mtd4 back to their previous values if generated/saved correctly. You can also use use the mtdcalc tool to calculate sensible values for the specific firmware, flash size and bootloader, for various mtd5 /nvram choices.

By the way - you can safely experiment with winscp to the router ram drive /var, various temp config files are held in /var/tmp. Anything written to /var is lost when router rebooted.

I can't give you an example of a task that will wear out your flash, but I wouldn't write a script that automatically writes anything to /nvram - only manually put things there yourself! Same philosophy as web gui settings, you have to make a conscious decision to "save settings". I did not like some Airties firmware I looked at that was regularly saving usage data to a minix partition on mtd5 (mounting, writing data, then unmounting every time)!
Post Reply