May 15, 2011

Nook: update busybox version & use Putty to connect to Nook (ADB)

Disclaimer: this post is addressed to advanced users, that have experience with Linux command line interface, and that are confortable connecting to Nook using ADB (or telnet/ssh).

The busybox version included in Nook is quite old. Updating it to a new one could be useful, for  having access to both new commands and features.

The procedure to update busybox is really simple:
  1. download and unizp busybox (or directly from busybox site);
  2. (optional) to be on safe side, make a backup of current busybox binary, placed into /system/bin;
  3. using adb, copy new busybox executable to nook, folder /system/bin, renaming it busybox;
  4. change owner and permissions of new busybox file:
    chmod 744 /system/bin/busybox
    chown system.system /system/bin/busybox
In my case (maybe using other configuration this could be different), using the updated busybox results in a easier usage of ADB enhanced Putty client to connect to Nook: infact, both autocomplete by tab key and command history (up key) work correctly.

Tip: if you add in file /init.rc the following row (about at the start of the file, where also others env variables are set):
export ENV /ash_startup_script ash
you can then create the file /ash_startup_script. In this file you can add whatever you want, that will be executed at session shell creation. In my case, for instance, i put the alias for ll, so that i don't have to define it manually each time i start a shell session:
alias ll=ls -l"


    Nook: install Nano text editor

    Disclaimer: this post is addressed to advanced users, that have experience with Linux command line interface, and that are confortable connecting to Nook using ADB (or telnet/ssh). The text editor Nano is not accessible by Nook (android) user interface.

    The linux version installed on Nook firmware lacks any kind of text editor (nano, vi, emacs, and so on), normally present on linux distributions.
    Having a text editor is really useful for advanced users, in order to quickly show and edit configuration files. Just to make some example: wifi configuration (wpa_supplicant.conf); startup configuration (init.rc).
    Nano is a really simple to use editor, and it's easily installable on Nook. Of course, a rooted Nook is necessary; but if you don't have a rooted Nook, you probably will not need any linux CLI text editor.

    Installation procedure:
    1. download and unzip nano;
    2. download terminfo;
    3. copy both files to your Nook, using adb;
    4. move nano to folder /system/bin;
    5. set appropriate owner and permission to nano executable:
      chown system.system /system/bin/nano
      chmod 755 /system/bin/nano
    6. unzip terminfo and set correct permission:
      busybox tar -xzvf terminfo.tar.gz -C /
      chmod -R 0755 /system/etc/terminfo
      chmod -R 0644 /system/etc/terminfo/?/*
    7. set the following env variables:
      export TERM=xterm
      export TERMINFO=/system/etc/terminfo
    8. now you should be able to launch nano from your shell:
      nano <filename>
    9. (optional) you need to set the env variable of step 7) each time you launch a shell; therefore, it could be convenient to set them automatically during initialization of Nook, adding the following two lines to file /init.rc (about at the start of the file itself, where a lot of env variables are set):
      export TERM xterm
      export TERMINFO /system/etc/terminfo
    That's it!