ipkg update fails with
"mkdir: Cannot create directory `//jffs/usr/': Read-only file system"
Please help HEEELP!
Don’t worry, just kidding. However such massages confirms the demand of running OpenWrt in 2 MB flash devices. I know that wireless freedom is VERY VERY limited is this case.
I’d like to create eventually a "2 MB flash howto". So please send your comments. (And be sure that I know how
to generate system with writeable jffs – I just want to make it affordable for others and make such system usable)
Where we are:
2048 kB whole flash
-256 kB bootloader PMON or CFE
-1408 kB lzma loader, kernel, squashfs
(equals to 1372 kB of whiterussian/rc4/micro/openwrt-wap54g-squashfs.trx rounded up to nearest 64 kB eraseblock)
-64 kB NVRAM variables
320 kB … 5 eraseblocks (64 kB each) for read/write filesystem.
Minimal count of free eraseblocks in jffs2 is 5. It means that jffs2 fits there, but is absolutely useless, as it do not allow write until it has more than 5 free eraseblocks. Moreover jffs2 in linux 2.4 seems not collecting garbage with fs size 6 eraseblocks.
I believe authors of jffs2 that minimal count of free eraseblocks is limited at 5 for good reason when fs size >> 5.
pre RC5 (people/nbd/whiterussian/micro/openwrt-brcm-2.4-squashfs.trx) is only 1260kB so it leaves 128kB free in jffs2. Cool!
What we can do:
1) Save more on kernel. Hmm, hardly.
2) Save more on squashfs.
Somebody can live without IPv6 support in busybox (and ping6).
Some more busybox applets can be left out (httpd, tee, bzip2, uniq, vi features, cron, telnet, uptime).
Where appropriate (WAP54G, Asus WL500g) you can throw away vlan stuff (vconfig and kernel support)
Using ImageBuilder or build root you can resign on installing packages and save ipkg.
Having generated keys one can put dropbear on the diet and use server only.
If you are really brave unselect telnetd (give dropbear keys and root passwd to squashfs)
But wait – I want to add my favorite applications…
3) Modify jffs2
Look at linux/fs/jffs2/nodelist.h
#define JFFS2_RESERVED_BLOCKS_BASE 3 /* Number of free blocks there must be before we... */ #define JFFS2_RESERVED_BLOCKS_WRITE (JFFS2_RESERVED_BLOCKS_BASE + 2) /* ... allow a normal filesystem write */ #define JFFS2_RESERVED_BLOCKS_DELETION (JFFS2_RESERVED_BLOCKS_BASE + 1) /* ... allow a normal filesystem deletion */ #define JFFS2_RESERVED_BLOCKS_GCTRIGGER (JFFS2_RESERVED_BLOCKS_BASE + 3) /* ... wake up the GC thread */ #define JFFS2_RESERVED_BLOCKS_GCBAD (JFFS2_RESERVED_BLOCKS_BASE + 1) /* ... pick a block from the bad_list to GC */ #define JFFS2_RESERVED_BLOCKS_GCMERGE (JFFS2_RESERVED_BLOCKS_BASE) /* ... merge pages when garbage collecting */
I’m afraid that it is not as easy as lowering those number. It is matter of jffs2 design. Well, let’s say that we could save 2 blocks here – not so bad – with the risk of filesystem crash.
Slightly better is jffs2 in kernel 2.6 - it needs 5 eraseblocks for mount (can be safely lowered to 4) and at least 3 free eraseblocks to allow writes (easily can be lowered to 2 with some risk of fs crash). Unfortunatelly kernel and open source bcm43xx wifi driver is longer (and wifi do not work on my device yet).
4) Use jffs (jffs1) instead of jffs2. I tried. jffs has no compression and minimal eraseblock count 4. It also save 26 kB on packed kernel image (and some RAM as well). jffs can surprisingly work below 4 blocks – but without garbage collecting, so as it gets full, you have to erase whole fs.
5) Any other flash fs?
6) Use tmpfs as a root, populate it by gunzip (bzip2) tar, like Oleg did in the old hacked Asus WL500g firmware. Of course, keep root small, just for config. No ipkg installs. And do not forget manually sync before powerdown. Stop laughing. I personally like this approach: we save 36 kB of packed kernel image and 320 kB of free erase blocks. Multiply this by sqashfs compression ratio – lot of room. (for mbm: coordinate the work with https://dev.openwrt.org/ticket/85, Reduce time from reflash to fully booted system.)
7) Buy a better device. The easiest way – nothing for us, of course.
Please somebody who is familiar with: is freifunk 2 MB image just carefully configured or is there something revolutionary?
What do you think?
(Last edited by samot on 6 Feb 2006, 15:23)