Booting Einstein on the 770
After a fews days of experimentation, I have a workable recipe for using Einstein with the 770. There is work that remains to be done to Einstein, but it does run, just slowly and it is buggy. This is not ready to be a production Newton yet.
First there are some things I'm assuming you have already done:
- have root enabled
- have either SSH over wifi, BT or USBnet
- have a Newton ROM
- have the Einstein package for 770
First, move the einstein package and the ROM over to your 770. You need to run it from the built-in memory, unless you have your flash card partitioned and mounted as a ext2- if so, it will run fine from there.
You don't have to have any swap enabled, it runs the same with or without it.
You will be ssh'ing into the 770 then running the script below which kills OSS/Maemo/Hildon to free up ram, then finally run Einstein.
The script was provided by Simon Budig (Nomis on #Maemo) who was kind enough to share it with me. I was first killing processes by hand, using the kill command- but in order to do this you must enable the --set-rd-flags=no-lifeguard-reset with the flasher to avoid having the 770 reboot as you kill 'critical' processes. Using the script below, and stopping them via the init scripts is the proper way to do this.
Once Einstein is running you type 'power' to power it on. It should take about three minutes to start up the first time. After awhile it gets flakey and may disappear from the screen- use the power command once to power it back on.
Note: Run einstein as root!
Nomis' Script- for USB networking
(this will kill any wifi session- see my modification below if you are using ssh over wifi)
#!/bin/sh export PATH="$PATH:/sbin:/usr/sbin" /etc/init.d/ttyusb0 stop /etc/init.d/lessertunjo0 stop /etc/init.d/osso-ias stop /etc/init.d/af-base-apps stop /etc/init.d/btname stop /etc/init.d/af-startup stop /etc/init.d/maemo-launcher stop /etc/init.d/osso-ic stop /etc/init.d/wlancond stop /etc/init.d/btcond stop /etc/init.d/osso-systemui stop /etc/init.d/esd stop /etc/init.d/osso-hss stop /etc/init.d/bme-dbus-proxy stop /etc/init.d/bluez-utils stop /etc/init.d/dsp-init stop /etc/init.d/kdbusd stop /etc/init.d/btpin stop /etc/init.d/af-services stop /etc/init.d/x-server.sh stop /etc/init.d/mce stop /etc/init.d/dbus-1 stop /etc/init.d/dnsmasq stop /etc/init.d/ppp stop /etc/init.d/x-server.sh start export DISPLAY=":0.0" /einstein --machine=737041 .
My slightly modified script for SSH via wifi:
#!/bin/sh export PATH="$PATH:/sbin:/usr/sbin" /etc/init.d/ttyusb0 stop /etc/init.d/lessertunjo0 stop /etc/init.d/osso-ias stop /etc/init.d/af-base-apps stop /etc/init.d/btname stop /etc/init.d/af-startup stop /etc/init.d/maemo-launcher stop #/etc/init.d/osso-ic stop #/etc/init.d/wlancond stop /etc/init.d/btcond stop /etc/init.d/osso-systemui stop /etc/init.d/esd stop /etc/init.d/osso-hss stop /etc/init.d/bme-dbus-proxy stop /etc/init.d/bluez-utils stop /etc/init.d/dsp-init stop /etc/init.d/kdbusd stop /etc/init.d/btpin stop /etc/init.d/af-services stop /etc/init.d/x-server.sh stop /etc/init.d/mce stop /etc/init.d/dbus-1 stop /etc/init.d/dnsmasq stop /etc/init.d/ppp stop /etc/init.d/x-server.sh start export DISPLAY=":0.0" echo 'done'
I like to start mine by hand. So after the script is run i type:
Nokia770-51:/home/user/newton# ./einstein --machine=737041 . Welcome to Einstein console. This is Einstein Platform Preview 1. This program will expire on July, 14, 2006. Checksum-0: 4AFD2193 Checksum-1: 18710BD6 Checksum-2: 68481A07 Checksum-3: BBB55D42 Checksum-4: 25B60EB7 Checksum-5: 41061AF3 Checksum-6: FFFFFFFF Checksum-7: FFFFFFFF Checksum-8: FFFFFFFF Checksum-9: FFFFFFFF Booting... Type help for help on available commands. einstein> power
and after a few minutes you should see the Newton booting on the screen.
A new Era Dawns
NewtOS/Einstein works on the 770!
This is developing, but it works at this point, once you disable the kernel-watchdog and kill Matchbox to free up enough RAM for Einstein to launch. I'll post a more detailed receipe of what I did later today, when I get some free time.
Screenshots:
Photos of Newton Booting on Nokia 770
Paul has put up the Einstein Platform 2006 ( for Nokia 770) on his site.
Don't forget that you'll need a Newton ROM to make this work. Paul has a Newton Emulator for the Mac (on that same page) that has a special application that will dump a Newton ROM over the network to your Macintosh. Using a MP2100 ROM is the best idea.
Will the 770 be the next Newton?
This past week, at the 2006 World Wide Newton Conference mastermind Paul Guyot introduced to the world the next step in his Newton emulation environment, Einstein + Relativity. Paul has had the Newton running (emulated) on the Mac for a couple of years. Now he has built it for ARM based Linux devices. Mmmmm.... I wonder what else is a cool ARM-based Linux device?
While Einstein doesn't work now on the 770, myself and a few others have been emailing Paul and he has been incredibly responsive to us. He has built a few test binaries and he thinks he has a proper toolchain setup to target the 770. The first showstopper with his Zaurus build was that his Zaurus has libstdc++6, while the 770 has libstdc++5.
Hopefully he will whip up something interesting in the next day or so… stay tuned. I’ll update by blog as soon as there is anything Newtish that will run on the 770.
This will be incredible when it works.
Cold Reset HP JetDirect
I've had a HP 2300 laser printer for a while, and it's been the best printer I've ever had. The duplexing unit works perfectly. However, I didn't spring for the networking option, as I had an external JetDirect, which I've been using. But then I saw the internal JD card on ebay for $20 (it was a $100 option new) so I grabbed it. Of course it came setup for wherever it was snagged from- in this case some military IP address range. So resetting it was impossible till I tracked down the page that shows how to cold reset this little bugger.
This is the page you need to read.
Here is what you do, btw for the 2300:
Turn off the printer. Turn it on and hold the green checkmark button until all three lights are on. When the lights are on, stop pressing the checkmark. When Select Language appears, press the Up Arrow button to select Cold Reset and press the green checkmark button again.
770 Previous Post Redux
Some important updates on my past 770 posts.
- If you are using .51 firmware and want to use swap, use 24 megs or less.
- I had problems using 128, then 64, then 32 megs. Finally Andy Flegg was able to tip me off that there is an issue with using anything over 32 megs. I re-partitioned my MMC card down to a 24 meg swap partition and it's been working very well. I really recommend you add some swap to help the memory on the 770. I ran a bunch of apps, games and opened four browser windows the 770 was super responsive.
- I posted some simple scripts for user and root to quickly install some basic packages and setup the environments for the default user and the root user. The installer commands should be run as the user 'install' and not as root. I've posted the updated script below. If you install them as root, you'll have to uninstall them as root- you can't use the GUI (which runs as user and uses a sudo for the install user to add and remove packages with the proper permissions).
- This script will setup sshd to be launched at each boot, and it will be run as root, which is normal for most unix boxes-- but just beware that sshd will always be running.
- This version also incorporates Andy Flegg's suggestion to make it one script and let it figure out who is running it. So you run it twice- once as user to setup user and again as root to setup things for root.
- Recall that you have to have R&D mode enabled via the flasher utility to become root.
-
----------------CUT_HERE--------------------------------------------------------------------- #!/bin/sh if [ `id -u` == “0″ ]; then echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/install/usr/lib' >> /root/.profile echo 'export PATH=$PATH:/var/lib/install/usr/bin:/var/lib/install/usr/sbin' >> /root/.profile echo 'export EDITOR=/var/lib/install/usr/bin/vim' >> /root/.profile echo 'set nocompatible' >> /root/.vimrc sudo -u install app-installer-tool install /media/mmc1/Installers/load-plugin_0.2.4-1_arm.deb sudo -u install app-installer-tool install /media/mmc1/Installers/dropbear-client_0.46-2_arm.deb sudo -u install app-installer-tool install /media/mmc1/Installers/dropbear-key_0.46-2_arm.deb sudo -u install app-installer-tool install /media/mmc1/Installers/dropbear-server_0.46-2_arm.deb sudo -u install app-installer-tool install /media/mmc1/Installers/vim-tiny_5.6.070-1.1_all.deb sudo -u install app-installer-tool install /media/mmc1/Installers/fbreader-maemo_0.7.1b-1_arm.deb ln -s /var/lib/install/etc/init.d/dropbear-server /etc/rc2.d/S20dropbear-server fi if [ `id -u` == “29999″ ]; then echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/install/usr/lib' >> /home/user/.profile echo 'export PATH=$PATH:/var/lib/install/usr/bin:/var/lib/install/usr/sbin' >> /home/user/.profile echo 'export EDITOR=/var/lib/install/usr/bin/vim' >> /home/user/.profile echo 'set nocompatible' >> /home/user/.vimrc mkdir /home/user/.ssh cat /media/mmc1/keys/id_rsa_mac >> /home/user/.ssh/authorized_keys cat /media/mmc1/keys/id_rsa_XP >> /home/user/.ssh/authorized_keys chmod 400 /home/user/.ssh/authorized_keys chmod 700 /home/user/.ssh fi ----------------CUT_HERE---------------------------------------------------------------------
- You can export to HTML and import right into the bookmark manager!
- After all the time and energy that I spend exporting bookmarks from Firefox in XBEL format and modifying them for the OSSO Bookmark application, you can import right from inside the Bookmarks app itself. That's a lot easier. Look under the Tools menu in the Bookmarks Application - not in the Browser.
- Below is an example of some output from the 770's export bookmarks function.
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This file was automatically generated by Sputnik
It will be read and overwritten.
Do Not Edit! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1><DL><p>
<DT><A HREF="http://www.accuweather.com" ADD_DATE="1118841481" LAST_VISIT="1137019750">AccuWeather.com</A>
</DL><p>
- Export your bookmarks from Firefox and then scp the resulting html file over to the 770. Put it into the MyDocs folder or your MMC card. Then use the Tools/Import to open the file.
- To scp from Mac to 770:
dillera$ scp bookmarks.html user@192.168.251.53:MyDocs
- It might be wise to pare down your bookmarks if you have a lot. I imported about 1000 of mine, and it does take the Bookmarks application a little bit of time to parse them.
Wow. I can't believe I have swap and the Apple BT keyboard working. There isn't much else I really want for my 770 at this point. I guess its time to just enjoy using it.
Theming for the Syncing Apple
I've settled on Blix for now. I really like how it has its CSS layout- the first layout that actually made sense to me. I've modified it a bit to better fit into the SyncingApple style, and I'll make further tweaks as time permits. I really love how it handles the code by wrapping long code into the extra area- saves that ugly overtyping from happening.
While Blix was designed a while ago for WP 1.5 it seems to be doing pretty well in 2.0. Too bad the author has abandoned it.
Apple BT Keyboard
I don't quite know how to explain what I did (if anything- just investigating), but I have the Apple Bluetooth Keyboard working on my 770 (with the .51 firmware)- and it was insanely simple.
I've been looking over the Linux - Bluez How-Tos for a few days, and trying this and that (including compiling the older tool bthid, which was my first real use of scratchbox ARM.) Nothing was working. Of course the btkeyboard plugin also didn't work.
I could see the Apple keyboard (see output below) but it wouldn't connect. What worked was so simple- I just looked at what the btkeyboard plugin was running- a command called hidd.
Nokia770-51:/home/user# hcitool scan
Scanning ...
00:0A:95:38:AF:7A Apple Wireless Keyboard
00:02:72:00:E0:96 blued[192.168.251.11]
00:0A:95:D2:97:76 blinky
So after the plugin failed, I just ran hidd -n --search and boom it connected. I could type in the xterm and in notepad. The only annoying this is that the Return key opens and closes the virtual keyboard in the xterm.
The full command and output was:
Nokia770-51:~# hidd -n --search
Searching ...
Connecting to device 00:0A:95:38:AF:7A
My /etc/bluetooth/pin file contains just "1234" (no quotes). That was all I did. I didn't type the pin on the keyboard- it just started working.
To be sure I wasn't using something btkeyboardplugin installed, I removed that, rebooted and was able to re-connect my Apple keyboard right away. I hope others can use this- there is no need for any soldering if you have the lovely Apple BT Keyboard sitting around. I actually don't use it with my Mac anymore, I have the tactilepro.
p.s. I'm sure its just a small change that has to be make to the btkeyboardplugin to make it work......
MarsEdit 1.1 is released
Don't forget to grab 1.1 - it was just released yesterday and it is a welcome improvement.
Updated to WP2
So I felt bad about all the people who maybe were going to use IE no matter what, so I just upgraded to the new WordPress 2.0, and the new K2 theme from BinaryBonsai.
So things are going to be in flux as I begin to mess with and screw up the CSS for this new theme. Enjoy.
This Site on IE
I just realized that this site looks ghastly in IE. If you are using that browser please come back here using Firefox. It looks much nicer.
Busybox on the 770
Busybox is your gateway to exploring the 770. It's called "The Swiss Army Knife of Embedded Linux" for good reason. When you login to the 770 and use the CLI (or shell) what you are using is Busybox. Traditional Unix machines uses many small programs (most often the GNU toolset) for most common tasks. Almost all small handheld devices with limited resources (RAM) use this one application which emulates all those small programs. Using Busybox is much smaller in terms of a memory footprint that all those other apps. Busybox on the 770 is only 272k.
To learn more about Busybox, visit its home page. They have a wonderful page with every command that is possible with a full build of Busybox. The Busybox in the 770 doesn't implement all of these commands however. The full list of what you have available to you on the 770 is available by executing Busybox by itself:
Nokia770-51:~# busybox
BusyBox v1.00 (Debian 2:20041102-11) multi-call binary
Usage: busybox [function] [arguments]...
or: [function] [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use, and BusyBox
will act like whatever it was invoked as.
Currently defined functions:
[, ash, basename, busybox, cat, chgrp, chmod, chown, chroot, chvt,
clear, cmp, cp, cut, date, dd, df, dirname, dmesg, du, echo, egrep,
env, expr, false, fgrep, find, free, getty, grep, gunzip, gzip, head,
hostname, id, ifconfig, ifdown, ifup, insmod, kill, killall, ln, logger,
login, ls, lsmod, mkdir, mkfifo, mknod, mkswap, mktemp, modprobe,
more, mount, mv, netstat, nslookup, pivot_root, printf, ps, pwd, realpath,
renice, reset, rm, rmdir, rmmod, route, run-parts, sed, seq, sh, sleep,
sort, stty, su, swapoff, swapon, sync, tail, tar, tee, test, time,
top, touch, tr, true, tty, umount, uname, uniq, uptime, wc, which,
who, whoami, xargs, yes, zcat
To see how much Busybox does take a look at /bin and /usr/bin. Almost all the programs in /bin are just links to the Busybox binary.
Pesky Swap
One thing I'm doing is investigating using swap with the .51 firmware. I still get out of memory errors when I swapon my little 32M swap partition on the MMC card. Once I've activated swap I can't load any applications-- and if I have something running (say the browser) the device will reboot.
I'm tracking what is happening by running this small script:
# while true; do > cat /proc/meminfo > echo '----------------' > sleep 2 > done
Which spits out stats similar to these:
MemTotal: 61828 kB MemFree: 5916 kB Buffers: 112 kB Cached: 27556 kB SwapCached: 0 kB Active: 24296 kB Inactive: 16624 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 61828 kB LowFree: 5916 kB SwapTotal: 32728 kB SwapFree: 32728 kB Dirty: 0 kB Writeback: 0 kB Mapped: 25936 kB Slab: 6692 kB CommitLimit: 63640 kB Committed_AS: 36728 kB PageTables: 1140 kB VmallocTotal: 188416 kB VmallocUsed: 640 kB VmallocChunk: 187776 kB
And by watching the output I see that my swap is never used by the 770! So while I'm not sure what is going on with this, I'm continuing to poke around the 770.
Recovering from a Firmware Flash
So with new firmware images coming from Nokia (which is a good thing) you have to start to deal with picking up the pieces after a flash. The built in control panel 'Backup' does a questionable job - while it does seem to work, it also seems to have made my 770 totally wonky, and I've been better off not using it after re-flashing 51.
So what to do?
One solution is again the ever-maturing Synchronisation and backup using rsync & make by Andrew Flegg at Bleb- be sure and read his solution which is clearly outlined at his site.
Meanwhile, I've put together some very simple scripts which can help bootstrap your 770 right after a firmware flash.
I'm assuming that you have a MMC card, and you'll keep these scripts on the card along with your 3rd party packages- so that they are available right after a flash.
You'll have to install xterm using the 770 GUI and then run these scripts just one time. One for user and one for root.
As you can see, I keep the public RSA keys from my main desktop computers also on the MMC card, so that I can ssh right in after running these scripts. These scripts are very simple but hopefully they can save you some time after your next flash.
User script:
#!/bin/sh echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/install/usr/lib' >> /home/user/.profile echo 'export PATH=$PATH:/var/lib/install/usr/bin:/var/lib/install/usr/sbin' >> /home/user/.profile echo 'set nocompatible' >> /home/user/.vimrc mkdir /home/user/.ssh cat /media/mmc1/keys/id_rsa_mac >> /home/user/.ssh/authorized_keys cat /media/mmc1/keys/id_rsa_XP >> /home/user/.ssh/authorized_keys chmod 400 /home/user/.ssh/authorized_keys chmod 700 /home/user/.ssh
Root script:
#!/bin/sh echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/install/usr/lib' >> /root/.profile echo 'export PATH=$PATH:/var/lib/install/usr/bin:/var/lib/install/usr/sbin' >> /root/.profile echo 'set nocompatible' >> /root/.vimrc app-installer-tool install /media/mmc1/Installers/load-plugin_0.2.4-1_arm.deb app-installer-tool install /media/mmc1/Installers/dropbear-client_0.46-2_arm.deb app-installer-tool install /media/mmc1/Installers/dropbear-key_0.46-2_arm.deb app-installer-tool install /media/mmc1/Installers/dropbear-server_0.46-2_arm.deb app-installer-tool install /media/mmc1/Installers/vim-tiny_5.6.070-1.1_all.deb app-installer-tool install /media/mmc1/Installers/fbreader-maemo_0.7.1b-1_arm.deb ln -s /var/lib/install/etc/init.d/dropbear-server /etc/rc2.d/S20dropbear-server
Note: this does not address backing up any data... see Andrew's solution for that. At this point I really don't keep anything on the 770 that I can't reload after a flash from my Macintosh. But if you are keeping data on it, make sure to take some action and back it up before you flash.
What Happened in .51?
Issues with 51
Ok, since I've flashed 51 onto my 770, all hell has broken loose. So far I've had these issues:
- News Reader won't load (and it constantly refreshes)
- Sporadic reboots
- Out of Memory errors (I never had them before)
- Using swapon causes immediate out of memory and or reboot
I had to finally re-flash '51 again, and this time I didn't restore by data (which I had backed-up using the built in control utility) back onto the 770. It seems more stable now, except for the issues using swap. I don't mind resetting up my stuff by hand- my backup data must have corrupted something.
People I've talked with talk about initial reboots, but then 'things calm down over time' which seems impossible to me- how can things calm down? They should stay the same at least.
Does anyone have any solid information on what has changed in this release?
Gainroot and Root
Meanwhile, I've been banging my head with gainroot, and why it wouldn't read the .profile of the root user in /root... nothing was working, till I finally realized that perhaps this wasn't some new shell I was in.. and sure enough, invoking su - while in 'gainroot' put me into a proper root shell with a working environment. See below for the difference in environments...
~ $ sudo gainroot Root shell enabled BusyBox v1.00 (Debian 2:20041102-11) Built-in shell (ash) Enter 'help' for a list of built-in commands. /home/user # env SUDO_GID=29999 USER=root HOME=/home/user SUDO_UID=29999 LOGNAME=root MALLOC_MMAP_THRESHOLD_=32768 TERM=xterm-color PATH=/bin:/usr/bin:/sbin:/usr/sbin SUDO_COMMAND=/usr/sbin/gainroot SHELL=/bin/sh SUDO_USER=user MALLOC_TRIM_THRESHOLD_=4096 PWD=/home/user
Now with a proper root shell:
/home/user # su - BusyBox v1.00 (Debian 2:20041102-11) Built-in shell (ash) Enter 'help' for a list of built-in commands. Nokia770-51:~# env USER=root LD_LIBRARY_PATH=:/var/lib/install/usr/lib:/var/lib/install/usr/lib HOME=/root PS1=\h:\w\$ LOGNAME=root MALLOC_MMAP_THRESHOLD_=32768 TERM=xterm-color PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin: /sbin:/bin:/usr/bin/X11:/var/lib/install/usr/bin: /var/lib/install/usr/sbin SHELL=/bin/sh MALLOC_TRIM_THRESHOLD_=4096 PWD=/root Nokia770-51:~#
That's one small consolation.