Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,742,912 Members 39,806 Now Online
XDA Developers Android and Mobile Development Forum

Calibre in Nook Touch

Tip us?
 
aruangra
Old
(Last edited by aruangra; 13th November 2011 at 01:21 AM.)
#1  
Member - OP
Thanks Meter 28
Posts: 66
Join Date: Dec 2010
Default Calibre in Nook Touch

I installed Calibre on my Nook Touch to fetch news and serve contents to reader programs in my Nook Touch. The method can be used with other Android devices. In short, Calibre is installed in Debian 6.0.0 chroot environment in Android 2.1. The steps are as follows:

1. Prepare a Debian 6.0.0 package for an ARM-based CPU using this command in a PC with Debian 6.0.0:

Code:
Select Code
debootstrap --arch armel --foreign squeeze debian --verbose http://ftp.debian.org/debian
Instead of making the package by yourself, you can download my package from http://www.4shared.com/file/RRuFfjRf/debiantar.html
and uncompress it to the folder “debian”

2. Make an EXT2 partition on an SD card. The partition size should be larger than 1 GB. On a Windows PC, you can use MiniTool Partition Wizard Home Edition. Then use a Debian Live CD or Linux in a virtual machine to copy the folder (in Step 1) to the new partition.

3. Connect to the device

Code:
Select Code
adb connect 192.168.XXX.XXX
adb shell
4. Mount partition of the SD card to a directory. In my case, I use /data/local/mnt as a mounting point. Note that my partition is at /dev/block/vold/179:21. You may need to find your partition by trial-and-error.
Code:
Select Code
cd /data/local/
mkdir mnt
mount -t ext2 -o noatime /dev/block/vold/179:21 /data/local/mnt
5. Setup the chroot environment. Read References at the end of this post for details.

Code:
Select Code
cd /data/local/mnt
chroot debian /bin/bash
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
/debootstrap/debootstrap --second-stage
echo 'nameserver 8.8.8.8' > /etc/resolv.conf
echo 'deb http://ftp.debian.org/debian squeeze main' > /etc/apt/sources.list
apt-get update
6. Install calibre 0.7.7 (larger than 400 MB). The program is installed to /usr/share/calibre/
Code:
Select Code
apt-get install calibre 
apt-get install python-routes
7. Set environment variables in .bashrc
7.1 Copy .bashrc to the local PC.

Code:
Select Code
adb pull /data/local/mnt/debian/root/.bashrc
7.2 Add the following commands to .bashrc

Code:
Select Code
export LANG=en_US.UTF-8
export TZ=Asia/Bangkok
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
7.3 Send .bashrc to the device

Code:
Select Code
adb push .bashrc /data/local/mnt/debian/root/
8. To use Calibre, enter the chroot environment:

Code:
Select Code
chroot /data/local/mnt/debian /bin/bash
Try the following commands: (My epup files are in /usr/share/calibre/serve/)

Code:
Select Code
ebook-convert /usr/share/calibre/recipes/cnn.recipe /usr/share/calibre/serve/cnn.epub
calibredb add --duplicates --with-library /var/www/ /usr/share/calibre/serve/cnn.epub
calibre-server --with-library /var/www/ --daemonize
9. There are several ways to access epub files to use in CoolReader, Aldiko, or other readers for Android
- calibre server
- lighttpd webserver
- mounting the directory in the chroot to the SD card

I prefer the third option because I don't need to run the server all the time.To mount the directory in chroot to a mounting point in the SD card, do this:

Code:
Select Code
mount -o bind /data/local/mnt/debian/usr/share/calibre/serve/ /sdcard/eBooks/Calibre
In Coolreader/Aldiko, epub files can be accessed from /sdcard/eBooks/Calibre.

10. SUMMARY

10.1 When rebooting your device, you will need to input the following commands to mount the partition and directory, and setup chroot. You can use "Terminal Emulator" to do it on your Nook Touch.

Code:
Select Code
mount -t ext2 -o noatime /dev/block/vold/179:21 /data/local/mnt
mount -o bind /data/local/mnt/debian/usr/share/calibre/serve/ /sdcard/eBooks/Calibre
chroot /data/local/mnt/debian /bin/bash -c "/bin/mount -t devpts devpts /dev/pts"
chroot /data/local/mnt/debian /bin/bash -c "/bin/mount -t proc proc /proc"
chroot /data/local/mnt/debian /bin/bash -c "/bin/mount -t sysfs sysfs /sys"
10.2 Every morning you can fetch news by running Terminal Emulator and enter the following command. When opening CoolReader, the morning news is there

Code:
Select Code
su
chroot /data/local/mnt/debian /bin/bash
ebook-convert /usr/share/calibre/cnn.recipe /usr/share/calibre/serve/cnn.epub
If you have a cleaner solution for this step (10.2), please share

References
http://kristof.vanhertum.be/?p=132
http://www.nslu2-linux.org/wiki/DS101/Debian
http://evilzone.org/android/debian-on-android/
http://www.saurik.com/id/10
http://packages.python.org/APScheduler/
http://www.read.in.th/node/1164
The Following 5 Users Say Thank You to aruangra For This Useful Post: [ Click to Expand ]
 
kodovoimeji
Old
(Last edited by kodovoimeji; 29th August 2012 at 12:00 PM.)
#2  
Junior Member
Thanks Meter 0
Posts: 25
Join Date: Aug 2006
Hello, I cannot go on after the last line:
Quote:
cd /data/local/mnt
chroot debian /bin/bash
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
When I try to:
Quote:
mount -t devpts devpts /dev/pts
I receive: mount: only root can do that (effective UID is 1000)
If I type "mount" I receive: warning: can't open /etc/mtab: no such file or directory
If I try to skip mount devpts, proc and sysfs and start debootstrap second stage I receive:
W: Failure trying to run: mount -t proc proc /proc

Update:
I used debian.tar.gz. Then I decided to prepare a debian package by myself.
I skip mount devpts, proc and sysfs and start debootstrap second stage:
Code:
Select Code
/debootstrap/debootstrap --second-stage
The out put is:
I: Installing core packages...
W: Failure trying to run: dpkg --force-depends --install /var/cache/apt/archives/base-files_6.0squeeze5_armel.deb /var/cache/apt/archives/base-passwd_3.5.22_armel.deb

Update2:
Finaly I run: export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
and second stage started.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes