↑↑ Home ↑ Hardware  

The Ben Nanonote

System upgrade -- Multi-user Nanonote -- Videos

Introduction

The Ben Nanonote is a sub-notebook running Linux that is entirely open-source hardware. It features highlights unavailable on other smart devices, sich as vi, bash, bc and other stuff for hackers. (Don't be afraid, it has a GUI too.)

Upgrading the system

As the device ships with an outdated version of the system and software, the first thing to do is to install the current version to the flash memory. As the information necessary to perform that process is distributed on several Wiki pages that not directly interlinked, here is a complete guide:

First, get the MIPS cross-compilation toolchain

You need this even if you just want to install a packaged system, to compile the tools that transfer it to the Nanonote and write it to flash memory, because they also contain a component that runs on the Nanonote.

Next, compile xburst-tools

These are a set of utilities that can download the new system to the Nanonote and write it to the flash memory. So we are getting one step closer to the action ;).

Finally, reflash the Nanonote

Now, finally the real deal, after all that preparation.

Aaaand, you're done.

Disclaimer: This procedure worked in late 2012, when I did the upgrade for my device. As the Nanonote system and the reflash script are continually being updated, this may change over time. Keep your wits about you at all times.

Turning the Nanonote into a multi-user system

The default system installation of the Nanonote has no user other than root, and all applications are run with administrator rights. The text consoles (reached with Ctrl-Alt-F1 to F4 as on a normal Linux system) start a root shell when any key is pressed. Users familiar with real operating systems and unwilling to give anyone picking up their gadget administrator access may want to change that.

This requires recompiling busybox, the multi-purpose binary containing most standard UNIX tools. In addition to those compiled into the version on the Nanonote, we need getty (to prompt for a user name on the consoles), login (to prompt for a password) and su (to change the user, such as become root). You may want to choose some other additional features; but be aware that some of the programs busybox can provide are present on the Nanonote as separate executables.

First, download the busybox sources from its home page. Before compiling, it has to be configured, which works similarly as for the Linux kernel. A file .config file contains a large number of constants describing which features should be built, and various make targets exist to automatically or manually choose a configuration, as described here. But in our case, we want to recreate the original configuration from the Nanonote but for specific additions. This is part of the configuration of the Nanonote OpenWrt build:

http://downloads.qi-hardware.com/software/images/NanoNote/Ben/2012-10-24/config

Copy all entries starting with CONFIG_BUSYBOX_ to a new file (including those that are commented out), and remove that prefix. This gives you the configuration for the busybox build. (You can browse around the download directories if you want the configuration for a different system version; 2012-10-24 is the latest.) Then copy the busybox configuration to .config in the unpacked busybox source directory and run:

make oldconfig

Answer the questions about new features as you think best. Usually the default will do; if in doubt, choose not to include a feature as that will make the executable smaller. The result is a .config updated for the version of busybox you downloaded. Before proceeding, add the directory with the crosscompiling toolchain to your path. The following assumes that TOOLCHAINDIR contains the path to the toolchain directory in the Nanonote openwrt-xburst distribution (see above).

export PATH=$TOOLCHAINDIR/bin:$PATH
export LIBRARY_PATH=$TOOLCHAINDIR/lib
export CPATH=$TOOLCHAINDIR/include
export STAGING_DIR=/tmp

As before, the cross-compiler seems unable to live without a valid STAGING_DIR. Then run:

make menuconfig

First go to the section "Busybox Settings -> Build Options" and set "Cross Compiler prefix" to mipsel-openwrt-linux-. You may be able to do without setting the LIBRARY_PATH and CPATH environment variables if you add the corresponding -L option to "Additional LDFLAGS" and -I option to "Additional CFLAGS", but I have not tried it.

To add login, getty and su, got to the section "Login/Password Management Utilities". You could also add adduser and deluser if you do not like editing passwd manually. After exiting the top-level menu, you should not see an error message from gcc-version.sh; if you do, something is wrong with your paths to the cross-compiling tools. If everything is OK, you can build busybox with make.

When the busybox executable has been successfully built, all that remains to be done is to install ist properly on the Nanonote. This is potentially dangerous, because busybox also contains init, the first process started by the kernel at system start-up. If the new executable were broken, installing it would brick the Nanonote. So, to be safe, use the file command to check that you have indeed cross-compiled for the Nanonote:

$ file busybox
busybox: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), stripped

Then transfer it to the Nanonote (via SSH or Micro-SD card), and run busybox --list with the new executable to check it works. As a further precaution, you can create symlinks like login to the new busybox and try if they work. Then move the new busybox over the old /bin/busybox and reboot. If the system comes back up, you are good, otherwise you will have to reflash the Nanonote as described above.

A few small things remain to be done. You have to create symlinks for the new utilities, and make the busybox executable SUID root to make su work.

chmod u+s /bin/busybox
ln -s busybox /bin/su
ln -s busybox /bin/login
ln -sf ../bin/busybox /sbin/getty

To generate login prompts on the text consoles and the serial port console, you have to replace the original lines in /etc/inittab by something like the following:

tty2::respawn:/sbin/getty 0 /dev/tty2
ttyS0::respawn:/sbin/getty 57600 /dev/ttyS0

The middle argument of getty is the baud rate, which is ignored for the text terminals. (For the serial interface, it is 57600 baud according to this page.) respawn instead of askfirst prints a login prompt right away rather than waiting for a keypress. You still have to decide what to do with the following inittab line:

tty1::respawn:/usr/bin/login.nn

It runs the GUI gmenu2x via /usr/bin/login.nn (a shell script). As it is run as root, anybody can still obtain a root terminal by starting it from the GUI. You could delete the line (or repace it with another getty), but some graphical programs seem unable to run when started from a console. Or you could remove the most dangerous programs by editing the entries in /usr/share/gmenu2x/sections/, which define the applications gmenu2x can start.

Conversion of videos for playing on the Nanonote

The Nanonote comes with a video player, mplayer. But (probably for reasons of disk space) it fails to support many common codecs. Ogg/Theora is one of the formats working. I convert videos I want to play on the Nanonote as follows:

mencoder -vf scale=320:240 -o reduced.vid -ovc x264 orig.vid
ffmpeg2theora reduced.vid

The first command reduces the resolution to that of the Nanonote display (anything more is a waste of space). The second command converts the result to Ogg/Theora.


Licensed under the Creative Commons Attribution-Share Alike 4.0 Germany License

TOS / Impressum