Showing posts with label mcb. Show all posts
Showing posts with label mcb. Show all posts

Saturday, February 4, 2012

Starting Over, Again.

In my previous blog entry I mentioned a bunch of goodies and ideas provided by dronz just as I was going to press with the blog post.  It took a lot longer than I expected, but I think I've finally got most of it incorporated into a new jffs base.  Originally I expected to break it into a bunch of additions, but as I rummaged through the goodies I realized much of it really belonged in the base jffs package.  So it had to be small.  The first thing I noticed was a proliferation of upxed executables from the original IZ2S and EZ2S systems that simply access a GPIO line to the zipit LEDs and buttons and such.  I figured these presented a perfect opportunity to roll them all into a single multi-call binary (mbc) executable and really save some space.  I was even hoping to toss in the IZ2S power button and screenblanker demons since they access the same GPIOs.

It actually turned out to make the most sense to create 2 mcb executables and leave the demons alone.  The static linked demons were the most efficient with memory at runtime, and don't take up all that much disk space.  Especially considering all the other savings I was getting from the two mcbs.   You can see the two static linked daemons in this htop screenshot, using a mere 16K of resident (RES) memory each while running.
The shared versions use significantly more RES memory, although there is the possibility that some of that will be recovered by sharing (SHR) with more programs running.  Here you can see the shared version of the screenblanker on the blue line with the two original static daemons on the two lines below.
I'm also starting to rethink upx.  It imposes a 4k runtime memory penalty, which is not so bad, but it also starts it's disk compression 4k or so behind the builtin (gzip?) compression on the jffs.  Now upx seemed to win somewhat in my minimal testing on the fairly large busybox and rockbox executables, but it's really hard to be sure when working on a live jffs because you never know when the jffs garbage collection will kick in and throw off all the numbers.  I really prefer to just make the executables tiny and let the jffs compress them.  Here's a shot of the original IZ2S daemons using 4k more memory after being upxed.
To make matters more difficult for me, the original IZ2S daemons were built in an earlier scratchbox environment that's a bit more frugal than the one I'm using.  I've experimented with dietlibc and musl libc to see if I could duplicate some of that frugality with the mcb executables, but the gcc wrapper used by my scratchbox environment conflicts with the gcc wrappers used by dietlibc and musl, to that's gonna take some serious work to get any sort of results.  Oh well.

Anyhow, the new additions from dronz also included some upxed helper utilities such as tee, clear, and date to pull in more functionality such as timezone, and hex passphrase management from the EZ2S network setup scripts.  I set about recompiling tiny shared lib versions of those, as well as replacing the large static sed, grep, and ntpdate programs from IZ2S with dynamic builds of minised, ugrep, and ntpclient for a rather large savings of several hundred K on the jffs.  I also threw in a new setup-tz.sh script to help get a /etc/TZ file generated after a fresh jffs install.

Now if you're off the wifi grid with your zipit, you can still set the time and date either interactively or on the command line with the new date utility.  Simply type date MMDDhhmmYYYY with the appropriate Month, Day, hours, minutes, and Year on the command line, or run /mnt/ffs/bin/date -i to do it interactively.

Also amongst the new goodies were some additions for better sound out of rockbox, however since I'd already ditched the massive alsactl utility in favor of the smaller amixer program these required some changes to the rockbox script to make them work.  I modified things to use amixer and it seems ok now, saving and restoring sound settings in the rockbox script.  I also renamed the original  /mnt/ffs/share/rockbox/eqs/Default.cfg file to Rockbox.cfg and switched to the dronz "hifi" Default.cfg file.  This apparently gets you better sound than the original default eq settings.  However I'm not positive how to activate the eq settings.  If I had to guess, I'd say go into the Settings/Sound/Equalizer menu and select Enable, then Browse to pick the Default config file.

By the way, dronz points out that you can save gobs of space on the jffs by deleting codecs you don't use from the /mnt/ffs/lib/rockbox/codecs directory.  He's got better ears than I, so he deletes the MP3 codec file mpa.codec.  I'd probably go the other way and delete most of the others...

Since I was now committed to remaking the base system I decided to throw in some more font support for the Western European characters.  The /mnt/ffs/share/fonts/erusfont.psf console font has slightly larger glyphs and is thus a bit more legible than the default font.  It may also have more unicode glyphs than the default font.  Feel free to edit the font loading line of the Zcovery script to suit your preference.   You can also load the /mnt/ffs/etc/eurokeymap.kmap instead of the default keymap.kmap.  This keymap provided by dronz allows you to use special key combos to type uincode text with the zipit keyboard.  I had trouble with this in the bash shell on IZ2S (maybe I'm missing some language setting environment variables) but it works pretty well in the busybox sh shell on the jffs.  I also couldn't get the eurokeymap to work in the e3 editor.  However the nano editor handle the unicode typing so I'm providing a separate package for that with a slightly smaller build than the statically linked IZ2S nano executable.

If you wish, you can add more fonts.  I recommend installing non .gz versions of the fonts on the jffs because the base system won't load .gz fonts and the jffs uses gzip compression anyhow, so the file size is effectively the same.

Finally, there's also a set of replacement kernel modules from dronz that you can use to enable auto-repeating keys, so you don't wear out your thumbs quite as fast.

Whew!  That's a big post.  Here's the goods, starting with the new base.  Follow the instructions from the earlier post to install it.
iz2jffs-base-v2.tar.bz2
Oops.  Apparently the new timezone script leaves you at a blank screen.  Here's the fix: tz-iz2s.zip.

The mini Rockbox is now a separate install after the base.
rockbox-391-jffs.tar.bz2
Dronz says:  You can save some space by replacing the default cabview theme with this 4k theme and the 14-Terminus-Bold.fnt font from the rockbox font pack (or this slimmer version of the font Lat15-TerminusBold14.zip).

Here's the typematic keyboard goodies from dronz. 

And the smaller (shared lib) nano editor.

This loadkeys program can be used in IZ2S to convert keymaps to the binary .kmap format used on by the jffs base.

Oh yeah, here's the updated naim IM client that uses the still functioning OSCAR protocol.  I still couldn't tell if it works though...

The handy IZ2S busybox update is still available in here.

And I still need to wrap up the final version of the source code for the IZ2S mcbs...
Here's the nearly final version of iz2s-pwr-src.tgz just in case i lose track of this...