views:

714

answers:

2

I'm trying to develop some custom apps to run on top of DD-WRT. I'm using the Linksys WRT54GL as my dev platform, but the flash space is limited. I think I'm almost out of room, but I can't figure out how to show the used / free flash space.

Linux command "df" only shows the ramdisk. DD-WRT command "nvram" accesses the configuration, but I can't see a way there to show free space.

+1  A: 

Your question seems like it doesn't have to do with programming -- only by the way it's read. Although I see you have some comments about it not being about programming, I'll try and answer this for you anyway.

Due to the fact that the dd-wrt platform is using squashfs you can't do this just by executing one command or by calling a simple ioctl on the mtd device.

You'll have to read /proc/mtd -- find out the size of the 'partition' that the squashfs image in on and then find out the size of the squashfs image, then subtracting the 2 to get your result. There may be an ioctl you can issue to the squashfs subsystem from userspace to get the size of the image, but you can also see it in the 'dmesg' output if you're dealing with a shell script.

Steve Lazaridis
A: 

nvram show? (shows the nvram full and free space in the last line)

Jan Slupski