Hello, my name is projectdp and I’m here to bring you Pi k3w, my version of the KindleBerry Pi.
I assume you have seen the “KindleBerry Pi” project by Damaru! It was my inspiration for this project, you can read about it here: http://www.ponnuki.net/2012/09/kindleberry-pi/.
If you are looking for a comprehensive guide to getting this to work for you, I hope this post serves as that guide. Let’s get started. As always, RTFM with anything that you’re installing, I am not the source of all knowledge, there are many other things you can do with the software packages.
- Kindle 3 Wireless edition (k3w).
- Raspberry Pi (rev. B).
- USB Keyboard (mechanical Noppoo Choc Mini if you’re curious).
- Cable (1/3): Kindle charger USB cable and power adapter.
- Cable (2/3): Motorola Droid Bionic USB cable (any ‘male micro USB’ to ‘male USB type A’ should work).
- Cable (3/3): Ethernet cable for providing internet to the Pi, you can use wireless if you want in lieu.
- Temporary monitor to configure the Pi and do testing (HDMI, or Composite out).
- Separate machine to configure Kindle
- Jailbreak Kindle
- Install USBNetwork
- Install Launchpad
- Install Terminal emulator (Myts)
1.0 Jailbreak: Get binary - k3w
Beware you could brick your kindle. You have been warned, take responsibility for what you do on your device.
A huge thanks to the Kindle community at MobileRead! You can download the Jailbreak build here: http://www.mobileread.com/forums/showthread.php?t=88004.
At the time of this writing the file is called: kindle-jailbreak-0.11.N.zip Download and unzip this file.
1.1 Jailbreak: Copy & Install on Kindle - k3w
Find the proper install binary for your device, see the README.txt for more information but I used: update_jailbreak_0.11.N_k3w_install.bin.
Plug in your Kindle to your desktop, transfer the aforementioned file to the root directory. After you have copied successfully, you may dismount the Kindle. Then navigate here on the Kindle to restart and install the jailbreak app: [HOME] -> [MENU] > Settings -> [MENU] > Restart. This should successfully install the jailbreak software. If it did not work, please thoroughly read the README.txt and if you still don’t get it, ask on the mobileread forum, I didn’t write the software! I will repeatedly refer to this process, it’s simple just remember that it comes up several times.
2.0 USBNetwork: Get binary - k3w
Go back to the link in section 1.0, download the file: kindle-usbnetwork-0.43.N.zip Download and unzip this file.
Find the proper install binary for your device, see the README.txt for more information but I used: update_usbnetwork_0.43.N_k3w_install.bin.
2.1 USBNetwork: Copy & Install on Kindle - k3w
Plug in your Kindle again, transfer the USBNetwork binary to the root directory. Copy your file successfully and then dismount the Kindle. Basically you will do the same thing as you did in 1.1 to restart and install that USBNetwork binary file.
Note: There is one tricky thing here. This utility will be disabled until you enable it. How do you enable it? You look for the file named: DISABLED_auto and rename that file to simply: auto. IMPORTANT: When you change this to auto, you will no longer be able to plug it into your Windows machine as a normal USB device. You can always reverse this process in a few ways:
- Myts: [Recommended] You can rename the file on the Kindle directly by navigating to the same folder /mnt/us/myts and issuing the command: mv auto DISABLED_auto
- SSH: You can ssh from your Pi to the Kindle: ssh email@example.com. Username:root Password:[empty password]. You then mount as rw (do this only if you are comfortable, mount it back as read only after you make the change). Navigate to the correct folder: cd /mnt/us/myts issue the command now: mv auto DISABLED_auto
- Kindle firmware: You can do a factory restore if you prefer. Follow the Kindle manual.
That wraps up USBNetwork, just remember you need to have this utility enabled in order to connect to it via ssh on the Pi.
3.0 Launchpad: Get binary - k3w
Follow this link: http://www.mobileread.com/forums/showthread.php?t=97636 to get the Launchpad software which is required to run the terminal emulator later. Download the file: lpad-pkg-001c.zip and unzip.
Find the correct install binary for your device. I used: update_launchpad_0.0.1c_k3w_install.bin
3.1 Launchpad: Copy & Install on Kindle - k3w
Plug in your Kindle yet again, transfer the binary to the root directory. Same steps as 1.1. Look for a successful install.
4.0 Myts terminal emulator: Get Binary - k3w
This one was a little tricky as the version (6) listed on Damaru’s site did not work for me. I had to use a newer version (8) which I found on this page: http://www.mobileread.com/forums/showthread.php?t=154500&page=5
I will list the download link here too:
http://my.svgalib.org/kindle/myts-8.zip Extract this zip file.
4.1 Myts terminal emulator: Copy & Install on Kindle - k3w
Plug in the kindle again. When you extract the file myts-8.zip you’ll be greeted by two folders: launchpad, and myts. Copy the myts folder to the root of your Kindle. Next you’re going to need to grab the extracted file in the launchpad folder called: myts.l.ini. You will put this file on the Kindle in the folder named launchpad. This will allow you to use Launchpad’s hotkeys on the Kindle to launch myts later. To make sure that this new ini configuration file is read, safely disconnect the Kindle and issue this hotkey sequence: [Shift] [Shift] [Space]. You should see a command ‘Success!’ notification on the Kindle when you issue this command. If it doesn’t work the first time do it slowly and deliberately.
To verify that the Myts emulator was installed, you should then be able to press: [Shift] T T. Again slow and deliberate. This should drop you into the Terminal. Success! You can hit the left back arrow (the Kindle’s page turning buttons) to exit temporarily. Or you can do [Shift] T A to kill sessions. Check the myts README file in the myts directory you extracted earlier. Also a good reference is: about.txt.
This concludes the Kindle software required.
Raspberry Pi Requirements:
- Terminal Multiplexer (tmux)
1.0 USBNetwork: Install script - Pi
This part is directly copied from Damaru, it works great. Use your favorite editor to edit the file /etc/network/interfaces on your Pi. Add the following lines:
iface usb0 inet static
up iptables -I INPUT 1 -s 192.168.2.1 -j ACCEPT
This means that your USB port on your Raspberry Pi, is turned into an ethernet addressed port. This way you can access the Pi from your Kindle.
1.1 USBNetwork: Test Pi to Kindle – Pi
Plug in your Kindle to your Pi. So you don’t have to restart or toggle your entire network service you can issue this simple command from the Pi to test: ifconfig usb0 192.168.2.1
Once you have done that you should be able to ping your Kindle: ping 192.168.2.2. Success! (?)
This should be all you really need to ensure USBNetwork is working properly. If it isn’t working, make sure to read the note in this section above: 2.1 USBNetwork: Copy & Install on Kindle - k3w.
2.0 Terminal Multiplexer: Install and Intro to tmux – Pi
Well this is where I differ from Damaru. I like tmux better than the popular screen program. I’ll show you how to get it set up nicely. Here we go! On your Pi, make sure you’re connected to the internet and issue the command:
apt-get install tmux
Let aptitude do its thing and install tmux for you. It’s a beautiful thing. Really there aren’t other steps to installing your multiplexer. Here are a few some simple things that will help to get you started: man tmux. You can start tmux by simply typing that command: tmux, you can tell the terminal changes slightly, now to detatch the session, press Ctrl+b then press d. Now that you’re back at a normal terminal window, you probably want to attach to that window again. Where is it though? Find it with tmux ls. You will likely see 0: 1 windows (created blah blah blah)… So actually the name is going to be “0″. To attach to that particular window again you can do this: tmux attach -t 0. Magic! Now get out of there: exit. I’ll show you later how to name your tmux sessions, it’s pretty basic. There’s a lot to learn here. Read the man pages. Note: C-b-d is the syntax for: Ctrl+b then press d. Got it? Cake!
- Test Kindle as the Pi display!
- Users and Passwords
1.0 Overview: – auto
This section is going to be pretty hefty. I’ll try to segment it as nicely for you as possible. I hope you’re doing alright so far. Leave a comment about your progress, or lack of progress so I can make fun of you.
In the Automation section we’re going to make the most out of this project. We’ll take a lot of the meaningless effort out of the loop. We’ll make it fast to connect and use. We’re going to make it a mainstay on the Pi for an easy portable screen in a pinch.
2.0 Test Kindle as the Pi display! ssh login – auto
Up to this point you have pretty much everything you need to now ssh from your Kindle to your Pi. Go ahead and do it, make sure your Kindle is still hooked up to your Pi. Grab your Kindle and get into myts: [Shift] T T. Steady. Now ssh to your Pi: ssh 192.168.2.1. Are you failing at entering the IP? Probably. Ok here’s where a specific file comes in handy. It’s called about.txt. I referenced it in Section 4.1. Read it. You can read it on your Kindle: cd myts then the command: cat about.txt. Basically you have to do some annoying stuff like this: ssh [Alt] q [Alt] o [Alt] w . [Alt] q… And so on. You’ll figure it out. I’m telling you, about.txt helps. Success? Good. I’ll continue while you remember your passwords and such.
2.1 Test Kindle as the Pi display! use tmux - auto
You should be logged into your Pi now from your Kindle. That’s called a milestone. Start tmux from your Kindle: tmux. Now with the Pi keyboard issue the command: tmux ls. Connect to the one your Kindle is on, it should just show 0: 1 windows (…etc.), by issuing the command: tmux attach -t 0. Now you should be able to type on your Pi keyboard, and it should appear on your Kindle. Sexy. You can pretend that you have everything working properly by turning off your monitor, but you have a long way to go if you want the Pi to boot automatically displaying the Pi on the Kindle! Let’s get to it!
3.0 Users and Passwords: Introduction – auto
Alright let’s get our notes straight on user access. So far you have some user account on your Pi, you’re probably doing it wrong and using username: root password: root, or some other silly defaults. You’re all set with the Pi, how about the Kindle? Same thing. username: root password: [empty]. You really don’t want this, especially on the Pi, I leave the defaults on the Kindle myself. Login as root and issue: passwd to change the password.
What I recommend is creating a separate user for the Kindle instance. I was not very creative and I made the user: kindle. Issue the command: adduser kindle. Temporarily make the password extremely easy to type for testing on the Kindle (I used the password: aaa). Oh right to change the Kindle username’s password: passwd kindle. Test it from your kindle: ssh firstname.lastname@example.org. Note: the @ symbol is [Back] w, if you didn’t read about.txt.If you’re too lazy to even type this, you can hold off testing until you automate your login, but I suggest making sure this is working first.
4.0 Kindle: fast ssh to Pi – auto
Let’s make a simple script to login to the Pi from the Kindle over ssh. On your Pi (because it has that nice keyboard that makes typing convenient — Smart!) make a file named something really easy to type. I used the filename: aa. To create the file issue: touch aa. Then use your favorite editor to edit the file and append:
Save it. Now you need to make sure that you can execute the script once it is on the Kindle. Issue: chmod +x aa. Good now the only thing remaining is getting it to your Kindle. This takes some ninja tricks but let’s go for it: scp aa email@example.com:/mnt/us/myts. Remember: You’ll be entering a blank password for root on the Kindle. Now try it out. On the Kindle type: ./aa. How do you do the slash? [Back] v. Later on in the article I’ll make it even easier, but let’s test with this for now. Enter your password: aaa. There you go, all set for faster logins.
5.0 Pi: Boot into your kindle user’s account on tty1 -auto
Edit your /etc/inittab on your Pi. Comment out (disable!) the following line, by putting a # symbol in front of it:
1:2345:respawn:/sbin/getty 38400 tty1
Now add the following command beneath the previous line:
1:2345:respawn:/sbin/agetty -a kindle -8 -s tty1 linux
Note: this assumes you are using the kindle user to automatically log in to tty1, your default terminal on the Pi. Alternatively, you can use this other command that is reported to work, but I could not get it to work this way myself: 1:2345:respawn:/bin/login -f kindle tty1</dev/tty1>/dev/tty1 2>&1
Save this file and let’s continue on. You will notice that performing a restart at this point should boot you into the kindle user account directly. Go ahead and test that functionality.
5.1 Pi: Configure .bashrc to handle joining scenarios – auto
Now as the kindle user, you’ll want to modify your .bashrc file. Navigate to your home directory: cd ~. Edit the file: .bashrc. Append the following script:
if [ -z "$TMUX" ]; then
(tmux attach -t pi || tmux new -s pi )
If you were having trouble with damaru’s script, try this out it works like a charm! If you’re using screen though, just make sure to translate the equivalent screen commands properly. If anyone is using screen and can put the proper environment variable and code in the comments I think people would appreciate it
Now your Pi should boot directly into a tmux session named pi. The cool part is, when your Kindle logs in to the Pi using the kindle username, you will automatically join the pi tmux session.
5.2 Pi: Configure ssh passwordless logins – auto
Here’s how you get to login without entering that aaa password from your Kindle, and using public keys instead. You will be utilizing the USBnetwork toolchain which includes the ssh client dropbear. To generate the proper keys you will need to use dropbearkey, the generator tool for dropbear ssh keys.
First, install the program with: sudo apt-get install dropbear. Now navigate to here: cd /home/kindle/.ssh/. Then issue the command: dropbearkey -t rsa -f id_rsa | grep ssh-rsa >> authorized_keys. You will then copy the public key to the Kindle with this command: scp id_rsa 192.168.2.2:/mnt/us/myts/id_rsa.
The very last step is to ssh into your Kindle and update that file we created earlier: aa to make the file look like this (I bolded the change for you below):
ssh firstname.lastname@example.org -i id_rsa
You are basically just specifying the key to join with. Now you can use your Kindle and try the ./aa command again. Are you winning yet? If so, celebrate and get on the Pi again and change your kindle user password.
6.0 Testing: Does it all work?
Now you should be all set. Let’s perform some checks:
Check 0: Try a Pi reboot with your monitor connected to watch the progress. Make sure the Pi logs in completely into the kindle account and begins the tmux session. You should be able to just wait and eventually be able to type on the tmux session command line without any other interaction.
Check 1: On the Kindle, open a myts terminal with [Shift] T T and issue the command ./aa (remember the forward slash is [Back] v). You should be logged in now with the Kindle to the Pi, attached to the same tmux session named pi.
Check 2: Unplug the monitor connected to the Pi’s HDMI or composite out. Reboot the system. Wait a few seconds, in the mean time, get ready on the Kindle to issue the ./aa command again (you should be able to hit up or left depending on your screen orientation to repeat the command). You can try several times blindly to connect, you’ll eventually be able to, and voila, you are ready to attach the Kindle to the Pi in a pinch!
6.1 Testing: Bugs
After performing Check 2, you might have noticed that tmux isn’t starting completely in full screen mode. The reason for this is because the terminal character dimensions was autoset by your monitor’s higher resolution. To combat this issue you can create the file: /boot/config.txt and append this to it:
Note: You can use any resolution you prefer, perhaps the resolution of the pi lapdock? but these were the dimensions of my test monitor.
If you notice any other bugs, please review the sections that are associated with those checks. If you still have problems drop some information in the comments and we’ll get it sorted.
That concludes the article! I hope you enjoyed this, I had a great time figuring all this out Leave a message with your project or anything relevant in the details!
Forums discussing the original project: