FHS

OpenWrt is a Linux distribution, and as such it obeys the current Filesystem Hierarchy Standard v2.3 from 2004-01-29.
A much better explanation than in the wikipedia can be found at TLDP (The Linux Documentation Project) here.
The german reader might like this http://de.linwiki.org/wiki/Linuxfibel_-_System-Administration_-_Dateisysteme for information on file systems.
Just in case I'll drop the link regarding Linux file systems under Windows here: http://wiki.ubuntuusers.de/Linux-Partitionen_unter_Windows (German, if you find en english site, please replace it)

Because in Linux we try to treat everything as like it was a file, understanding the file system is crucial.

Tuning

This may be disappointing, but despite the ton of stuff you can do with /proc alone, you can hardly tune OpenWrt.
Why?
Because, as any Linux distribution, OpenWrt already configures the packages it contains. Especially the Linux kernel. There should not be a need for you to do it in addition. Especially as a beginner, you most probably will not find better settings then those already in place.
In case you do not believe me, → generic.debrick should help you get back to normal. Enjoy your embedded Linux distribution!

Further explanations

/etc see → notuci.config for further explanations of some of the files here
/var is merely a symlink to var → /tmp
/tmp is the mountpoint for a tmpfs-partition. This means anything contained in the directories /var and /tmp is not stored on the flash but is stored in RAM and is thus volatile (it won't survive reboot). And since the RAM is mostly quadruple the flash size, it also means that we can store more data in the files system. This is helpful in case you want to download a file to the device, which has the same size as the entire flash memory, e.g. a firmware image file.
/rom see → flash.layout for further explanations
/overlay see → flash.layout for further explanations

Amongst /sys, /proc and /dev the most interesting one is proc. Feel free to snoop around in it, and have a look at the virtual files: cat /proc/cpuinfo, cat /proc/meminfo, etc.

Notes

The kernel sources (obtainable at http://kernel.org/) contain some documentation. They chiefly address developers but sometimes contain information valuable for end users as well. These docs are written by the developers themselves! They can also be viewed at online, e.g.:

proc

cat /proc/net/softnet_stat

00b5501e 000007bf 00000017 00000000 00000000 00000000 00000000 00000000 00000000 00000000

In the kernel sources. ./Documentation/filesystems/proc.txt contains some information on /proc/net goodies. But for offroad stuff like softnet_stat though, your best friend is grepping the kernel sources:

grep softnet_stat * -R

… core/dev.c: if (!proc_net_fops_create("softnet_stat", S_IRUGO, &softnet_seq_fops)) core/dev.c: proc_net_remove("softnet_stat"); ./net/core/dev.c static int softnet_seq_show(struct seq_file *seq, void *v) { struct netif_rx_stats *s = v; seq_printf(seq, "%08x %08x %08x %08x %08x %08x %08x %08x %08x\n", s→total, s→dropped, s→time_squeeze, 0, 0, 0, 0, 0, s→cpu_collision ); return 0; } $ grep "struct netif_rx_stats" include/* -R include/linux/netdevice.h:struct netif_rx_stats include/linux/netdevice.h:DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat); struct netif_rx_stats { unsigned total; unsigned dropped; unsigned time_squeeze; unsigned cpu_collision; };
Much of this is only well-documented in the code. Here's an attempt at interpreting softnet_stat [no guarantee that it is correct; read the code!]: % softnet_stat.sh cpu total dropped squeezed collision 0 1794619684 0 346 0 1 36399632 0 74 2 % softnet_stat.sh -h usage: softnet_stat.sh [ -h ] Output column definitions: cpu # of the cpu total # of packets (not including netpoll) received by the interrupt handler There might be some double counting going on: net/core/dev.c:1643: get_cpu_var(netdev_rx_stat).total++; net/core/dev.c:1836: get_cpu_var(netdev_rx_stat).total++; I think the intention was that these were originally on separate receive paths … dropped # of packets that were dropped because netdev_max_backlog was exceeded squeezed # of times ksoftirq ran out of netdev_budget or time slice with work remaining collision # of times that two cpus collided trying to get the device queue lock. The script is attached.

Back to top

doc/howto/user.beginner.fhs.txt · Last modified: 2011/08/24 13:50 by orca