Tuesday, July 06, 2010

Seagate Dockstar notes...

(or: Chad writes a practical post for once!)

The Seagate Dockstar's a variation of the Pogoplug, in turn Sheevaplug. woot.com recently had them for $20+5/ea ($65 for 3!) and buy.com has them for $25+0.

The Dockstar has reduced specs (128mb ram, 256mb flash, no RTC) from the original Sheevaplug, but multiple USB ports. Combined with a Gigabit Ethernet port it's a far more powerful version of the once-famous Linksys NSLU2 (aka Slug)

The first challenge is getting the conventional firmware out of the way so we can do truly useful things with it. It turns out that the default firmware only uses 32MB flash, leaving a nice 224MB jffs2 partition for a better Linux distro! there's a build of Debian Lenny here

My steps (largely cribbed from http://ahsoftware.de/dockstar/)

- Log in via ssh (root pw: sgxadmin)

- mount / -o remount,rw

- disable hbmgr in /etc/init.d/rcS. edit: this is very important, the dockstar firmware may auto-update and cut off ssh!

- mkdir /tmp/mnt

- mount /dev/mtdblock3 /tmp/mnt

Now I can extract the Lenny tarball - I put it on another machine and used netcat (nc -l -p5000 | tar -xvjf -) to put it into /tmp/mnt

After this there are two paths:

- run debian in a chroot with a ssh server on an alternate port. This means keeping the init from the original system running, but it's not too bad.

- Put a pivot_root/exec debian's /sbin/init and have the Debian system totally take over.

Debian Lenny notes:

- /var/cache/apt[/archives][/partial] must be a tmpfs since jffs2 is not mmap-able.

- debian/usr/sbin/chroot is static, so you don't need a chroot binary in the main system.

- By changing the sshd port to 2222 in /etc/ssh/sshd_config, you can ssh directly into debian

- you need these mounts:

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /tmp type tmpfs (rw)
none on /dev/shm type tmpfs (rw)
none on /dev/pts type devpts (rw)
none on /lib/init/rw type tmpfs (rw)
none on /var/cache/apt type tmpfs (rw)

- run "export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"" if chrooting in.

- After removing /var/cache/apt there's still 40MB (+ compression gain) in the large filesystem. Not bad.

update: here's an autostart script that gets the debian chroot+sshd up and running (assuming you change the ssh server port)


#!/bin/sh
mount /dev/mtdblock3 /debian
mount none -t proc /debian/proc
mount none -t tmpfs /debian/tmp
mount none -t tmpfs /debian/dev/shm
mount none -t tmpfs /debian/var/cache/apt
mkdir /debian/var/cache/apt/archives
mkdir /debian/var/cache/apt/archives/partial
mount none -t sysfs /debian/sys
mount /dev /debian/dev -o bind
mount none -t devpts /debian/dev/pts
/debian/usr/sbin/chroot /debian /usr/sbin/sshd


The Debian chroot will start sometime after the stock distro's sshd, since mounting the jffs2 partition takes a while. There's plenty of free memory afterwards:

Pogoplug:~# free
total used free shared buffers cached
Mem: 126064 27040 99024 0 0 10792
-/+ buffers/cache: 16248 109816
Swap: 0 0 0

Enjoy!

Saturday, July 03, 2010

A poor/slow man's FPGA? It might be closer than you think.

Got a paperback copy of "Designing Logic Systems Using State Machines" today off Amazon... the bit about ROM-based logic (a precursor to CPLD's?) got me thinking that one could translate a logic circuit design into assembly code for a microcontroller. It could use a mixture of ROM and direct assembly operations, tuning it according to the target CPU in question.

Such a program would be slow by logic standards (at least if you wanted more than the simplest functions!) but with non-pin-related interrupts off and non-branching code, the timing could be completely predictable.

Friday, July 02, 2010

Another idea...

(yes, I'm very ADD this week!)

A CUPS-based virtual print server for rooted nook wi-fi. Turn it on, print *anything* to it (hopefully even via Windows...?) and take it with you. That should be pretty awesome for printing out web pages, eh?

(or alternatively, netcat listening on port 9100 wired up to ghostscript in a PDF conversion mode... that might only work with Linux tho.)

MSP430 Launchpad first impressions

Just plugged in my MSP430 Launchpad. Not able to actually do much with it yet, but you actually get four microcontrollers... on the programming side there's:

- A TUSB3410 USB/8051 UART microcontroller

- And a MSP430F1612 - with considerably more RAM+ROM than the parts you're meant to develop for. (Why hasn't the code for this been rolled into the 3410 yet?)

There's a "modem" UART interface to the serial port on the target chip, and a HCI-based Debug interface. Oddly the 'modem' interface appears to be the one used for target programming.

To properly load the 5310 driver, you must modify the USB driver for the 5310 to add device 0x451:0xf432. Sadly I don't actually have a build tree on this laptop so I'll have to get back to this one in a while. *sigh*

State Machine Language notes (WIP)

The HP 9100A desktop calculator was an incredible piece of engineering. It basically implemented a VLIW processor without any digital IC logic - it had a 4K ROM carved into a 12-layer circuit board (needless to say the yields sucked!) It used a CRT as a 3-line 8-segment display!

Tom Osbourne's initial work on ASM sounds quite interesting, although I haven't found all the details yet. http://www.hp9825.com/html/osborne_s_story.html - I'd figure a lot of this got into current design, hopefully!

Doing some more reading - Woz used these techniques on Apple Integer Basic and the Disk II. (Makes sense, since he *did* work for HP)

---

programming ideas:

- *actually* passing a variable/object along, so it only has one "owner" at a time.

- making a state machine language that gets 'compiled' into straight C. already thinking of doing this for register definitions etc...

Jay notes (WIP)

Jay (to go along with finch and pidgeon) will be a web-server-based libpurple client, allowing users to set up a small server and use their web browsers to chat. While other web chat clients exist, some power users might appreciate *not* having to use someone else's cloud-based services.

(proposed logo: a simplified Jay bird in front of a cloud)

Jay contains three separate programs:

- libpurple<->JSON connector (jayd)

- JSON CGI program, handling authentication and sending updates as needed to the web client.

- Javascript/JSON web client.

If things go particularly well the JSON setup I'm using might become a standard.

Thursday, July 01, 2010

Unstuck in time...

Got a week off coming up - and about a year's worth of projects to fill it. ;)

- Creating "jay" - a libpurple web services server/client. Three pieces - libpurple client, json http connector, and finally a client. The latter two pieces might be extensible to work with other things... at the same time.

( ^ - that's probably the most practical project...)

- Getting back into the electronics thing... hopefully figuring out how to solder surface-mount components in truly ghetto fashion... on tape*! Search on "elm-chan uew" for my inspiration there.

- Tinkering with a bunch of old random stuff. Like a Pentium MMX toshiba... if I can find a caddy for it.

- Extending from Jay - a simple Linux web-browser-based UI system, ala ChromeOS but hopefully lighter weight. I was helping out a friend shopping for a computer - there's so much *crap* in a consumer Windows system that's utterly distracting for noobs.

(side-note: how long until Apple replaces the MacBook non-pro with an iOS-Book...? Or will iPad gain better mouse+keyboard support and become the new... iBook?)

- Looking at state machine languages (and way back to HP's ASM work) and figuring out an acceptably simple language (i.e. no characters that aren't on a standard keyboard!)

- Retrocomputing hacking (or: fun with expansion ports, buffers, and modern chips...) For instance on the Atari 8-bit front - SIO2PC, SIO2USB, etc are amazingly overpriced, considering it's just a 5V serial system that a simple microcontroller could deal with.

So basically I'm just unstuck in time... past, present, future... it's all good. I just need to do something meaningful.

(* - 3M 5419 Polymide - per 3M it can go up to 500F safely...)