Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 09-17-2010, 04:13 PM   #1
choff
Member
choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.
 
Posts: 12
Karma: 152738
Join Date: Jul 2010
Device: Kindle DXG
Installing a "normal" Debian ARMEL Linux on the Kindle

Hey guys,

recently I got a regular Debian Linux to run on the Kindle. In this article I will describe how I got it up and running.

Prerequisites:
  • Time and patience :-). The whole thing took me about 4 full days to set up. I hope that this post will make things easier for you, but you'd better have some spare time left before you get started.
  • A serial connection to your Kindle for bootloader access. If your Kindle is still working, you can also chroot into your filesystem image, but I started from scratch by compiling my own Kernel and initramfs.
    The serial connection is not all that hard to get working once the gray bezel is removed. I suggest you use the pins of the J9 connector and use a FTDI TTL-232R converter cable (3.3 or 5V). No soldering required. See http://www.youtube.com/watch?v=vRigHZSvcyc. The video's a bit goofy, but it should be enough to get you started

Overview

Here is a small overview of what we are going to do.
First of all, we'll install Debian Armel on a QEMU virtual machine. Then we'll copy the ARMEL filesystem image over to the Kindle's USB-accessible FAT partition.
After that we are going to create an initramfs(a small initial root filesystem loaded by the Kernel) which will start our newly created Debian Linux. Then we'll build the Kernel for the Kindle with our initramfs statically linked into it.
Finally, we will transfer the Kernel and start it via the U-Boot bootloader.

Part 1: Create a Debian Linux for ARM
I won't go into this in detail as there is already some information on the internet. A good tutorial can be found here: http://blog.troyastle.com/2010/07/bu...n-vm-with.html
Also, make sure you don't create a root filesystem with eight GB as described in this article :-). 1.3 GB should be enough for a basic Linux and a tiny X server.
You'll notice that the VM is awfully slow, so it's always good to have a book at hand to busy yourself in the idle time during the install and fetching of additional packages.

Part 2: Transfer Linux filesystem image on the Kindle's USB-Partition
If your Kindle is still alive, just copy the image over via
Code:
dd bs=32256 skip=1 < image > /media/kindle/ubuntu
. Otherwise, you can still enter recovery mode by
  • Disconnecting your Kindle from USB(make sure that it has got a little battery power left)
  • Pressing the power button for a minute
  • After releasing the power button, press the Home button immediatly for about 15-40 seconds until the screen flashes and your Kindle tries to reboot. If your root filesystem is busted(such as mine), you will have to type "reset" on the keyboard when prompted and you will be in recovery mode. Connect to your Kindle via USB and copy the image over with the above dd command. Do not press "1"(not sure if it will do any harm, though).
  • Unmount the Kindle on the host PC

Part 3: Creating the initramfs
For this part, we'll need
  • the busybox sources(the binary in Debian's nice busybox-static package won't do the trick as it is lacking switch_root support)
  • CodeSourcery's G++ Lite Edition for ARM(target OS GNU/Linux) from http://www.codesourcery.com/sgpp/lit...@template=lite
  • Amazon's sources

First you'll need to create a directory to hold your initramfs. Compile a busybox binary by running
Code:
make ARCH=arm menuconfig
and do the following modifications to your busybox configuration:
  • select the path to the initramfs as installation prefix
  • set the cross compiler prefix to the prefix of your ARM cross compiler (e.g. "[...]/CodeSourceryARMCrossLinux/bin/arm-none-linux-gnueabi-")
  • disable some unnecessary features in order to save space. This is really important since the data transfer of the kernel via serial line will take some time. Additionally, the size of the partition containing the 2 kernel images(normal and recovery) is only 8Mb.
Finally, run "make install" which will copy busybox to your initramfs and create all the necessary symlinks for you.

Now we'll need to create some device nodes inside our initramfs. If your Kindle is still running, you can simply "ls -l" in the Kindle's /dev directory and you'll see the major and minor device numbers which you can pass to mknod, otherwise here's a listing of all device nodes that could be important:
Code:
crw------- 1 root root   5,   1 2010-08-19 14:26 console
brw-rw---- 1 root root   7,   0 2010-08-19 14:26 loop0
brw-rw---- 1 root root   7,   1 2010-08-19 14:26 loop1
brw-rw---- 1 root root   7,   2 2010-08-19 14:26 loop2
crw-rw---- 1 root root   1,   1 2010-08-19 14:26 mem
brw-rw---- 1 root root 179,   0 2010-08-19 14:26 mmcblk0
brw-rw---- 1 root root 179,   1 2010-08-19 14:26 mmcblk0p1
brw-rw---- 1 root root 179,   2 2010-08-19 14:26 mmcblk0p2
brw-rw---- 1 root root 179,   3 2010-08-19 14:26 mmcblk0p3
brw-rw---- 1 root root 179,   4 2010-08-19 14:26 mmcblk0p4
crw-rw-rw- 1 root root   1,   3 2010-08-19 14:26 null
crw-rw---- 1 root root 250,   0 2010-08-19 14:26 pmic
crw-rw---- 1 root root   1,   8 2010-08-19 14:26 random
crw-rw---- 1 root root   5,   0 2010-08-19 14:26 tty
crw-rw---- 1 root root 207,  16 2010-08-19 14:26 ttymxc0
crw-rw---- 1 root root 189,   0 2010-08-19 14:26 usb1
crw-rw---- 1 root root  10, 130 2010-08-19 14:26 watchdog
crw-rw---- 1 root root   1,   5 2010-08-19 14:26 zero
But the most important part is still missing: The init script which is executed by the kernel and is supposed to mount our new root, which would be the file system image we copied earlier.

I have attached my script. You will notice that it first creates a loop device for /dev/mmcblk0p4 with an offset of 1024(the start of the FAT partition) and then mounts the file system image(again by creating a loop device).

We are almost done! But we still need to compress the initramfs:
Code:
sudo find . | cpio -H newc -o > ../initramfs.cpio
Part 4: Build Kindle kernel
Simply follow the instructions from http://www.mobileread.com/forums/showthread.php?t=91862, but set CONFIG_INITRAMFS_SOURCE to the path of your initramfs.cpio.

Part 5: Transfer image to device & boot
Enter the U-Boot bootloader and type "run uboot_serial", which will wait for an YModem-G file transfer from your host. Use Minicom and send the file via ZModem(the YModem option won't work!). Do not try to send files via Kermit! U-Boot Kermit supports seems to be broken and didn't work with Kermit, Minicom and HyperTerminal.
Now just run
Code:
setenv bootargs "init=/bin/sh"
bootm 0x84000000
and pray that everything works :-).

You can get the normal System V init sequence to work by removing all lines containing "getty" from /etc/inittab. Remount the root of your filesystem and reset your kindle and start your linux again, this time without bootargs. If you're lucky, you should see a login prompt on the screen.

Limitations
Reboot and shutdown just freeze the Kindle until the battery is removed. Even reset does not work. I'll look into this.
However, I was able to get a KDrive X server to run.
Attached Files
File Type: gz init.tar.gz (913 Bytes, 246 views)

Last edited by choff; 09-18-2010 at 06:04 AM.
choff is offline   Reply With Quote
Old 09-19-2010, 10:48 PM   #2
troyme
Enthusiast
troyme began at the beginning.
 
Posts: 40
Karma: 34
Join Date: Aug 2010
Device: kindle dx US
Interesting!!!! plan to run gui program on framebuffer????
troyme is offline   Reply With Quote
 
Enthusiast
Old 09-20-2010, 12:53 PM   #3
choff
Member
choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.
 
Posts: 12
Karma: 152738
Join Date: Jul 2010
Device: Kindle DXG
Quote:
Originally Posted by troyme View Post
Interesting!!!! plan to run gui program on framebuffer????
Yeah, I'm working on 2 things at the moment:
  • Running X11-programs on the Kindle
    I already got a KDrive X server with xdaliclock and xterm to run, but the display does not auto-refresh. Maybe I can tweak the Kindle's framebuffer driver to refresh automatically if the framebuffer contents are changing.
  • Using the Kindle as my secondary monitor(for coding etc.)
    This was my primary reason for buying the Kindle.
    I plan to write a simple "framebuffer server" running on the Kindle which listens for network connections. If a packet with display contents is received, the data will be written into the Kindle's framebuffer.
    The client will be a framebuffer Linux Kernel module which simulates a framebuffer of the same size as the Kindle's display and forwards the display contents to the Kindle's IP via UDP.
    The server on the Kindle side is already working and I can already modprobe the module at the client side, but X11 does not seem to detect the Kernel module. But I hope I'll sort this issue out next weekend :-)
choff is offline   Reply With Quote
Old 01-02-2011, 02:05 PM   #4
cm0nster
Junior Member
cm0nster began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Dec 2010
Device: Kindle 3 - 3G
Can i install debian if my kindle's original OS is totally scrwed up- i cannot even turn i t on.
cm0nster is offline   Reply With Quote
Old 01-02-2011, 08:18 PM   #5
kranu
I <3 my Kindle
kranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensions
 
Posts: 528
Karma: 51332
Join Date: Nov 2010
Location: United States
Device: Kindle 3G + WiFi
Quote:
Originally Posted by choff View Post
Yeah, I'm working on 2 things at the moment:
  • Running X11-programs on the Kindle
    I already got a KDrive X server with xdaliclock and xterm to run, but the display does not auto-refresh. Maybe I can tweak the Kindle's framebuffer driver to refresh automatically if the framebuffer contents are changing.
  • Using the Kindle as my secondary monitor(for coding etc.)
    This was my primary reason for buying the Kindle.
    I plan to write a simple "framebuffer server" running on the Kindle which listens for network connections. If a packet with display contents is received, the data will be written into the Kindle's framebuffer.
    The client will be a framebuffer Linux Kernel module which simulates a framebuffer of the same size as the Kindle's display and forwards the display contents to the Kindle's IP via UDP.
    The server on the Kindle side is already working and I can already modprobe the module at the client side, but X11 does not seem to detect the Kernel module. But I hope I'll sort this issue out next weekend :-)
Wow using the Kindle as a second monitor would be like a dream for me D=

If you ever get it working, I would want it.
kranu is offline   Reply With Quote
Old 01-02-2011, 10:24 PM   #6
kindle3zeng
Enthusiast
kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.kindle3zeng once ate a cherry pie in a record 7 seconds.
 
Posts: 35
Karma: 1566
Join Date: Nov 2010
Device: kindle 3wifi
Quote:
Originally Posted by choff View Post
Yeah, I'm working on 2 things at the moment:
  • Running X11-programs on the Kindle
    I already got a KDrive X server with xdaliclock and xterm to run, but the display does not auto-refresh. Maybe I can tweak the Kindle's framebuffer driver to refresh automatically if the framebuffer contents are changing.
  • Using the Kindle as my secondary monitor(for coding etc.)
    This was my primary reason for buying the Kindle.
    I plan to write a simple "framebuffer server" running on the Kindle which listens for network connections. If a packet with display contents is received, the data will be written into the Kindle's framebuffer.
    The client will be a framebuffer Linux Kernel module which simulates a framebuffer of the same size as the Kindle's display and forwards the display contents to the Kindle's IP via UDP.
    The server on the Kindle side is already working and I can already modprobe the module at the client side, but X11 does not seem to detect the Kernel module. But I hope I'll sort this issue out next weekend :-)
Second this!
kindle3zeng is offline   Reply With Quote
Old 04-21-2011, 07:47 PM   #7
bdaddy
Junior Member
bdaddy began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Apr 2011
Device: Kindle 3 wifi
choff,

I'm planning to get a kindle 3 wifi soon. This looks like an awesome outdoor Linux console platform. One of the things I've been most concerned with is effective system image backup in case I mess something up while playing with it.

Based on your deep experience with the kindle hardware, I've got a couple of questions that I haven't seemed to find a definitive answer for yet. Sorry if this is to far off the subject of this thread:

(1) What would you say is the simplest, easiest procedure for performing a full system image backup of a kindle?

(2) Do you think it is possible to do such a thing without having to build a serial adapter?

For example, wouldn't it be awesome if it where possible to hold a certain key during startup that would put the machine into a mode that where by it exports the entire flash disk via UMASS. That way you could take an easy full image backup, and restore if something goes wrong.

Thanks
bdaddy is offline   Reply With Quote
Old 04-23-2011, 10:05 AM   #8
choff
Member
choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.
 
Posts: 12
Karma: 152738
Join Date: Jul 2010
Device: Kindle DXG
Hey bdaddy,
Quote:
Originally Posted by bdaddy View Post
choff,
(1) What would you say is the simplest, easiest procedure for performing a full system image backup of a kindle?

(2) Do you think it is possible to do such a thing without having to build a serial adapter?
Backup is always a good idea. As you know, the Kindle has an SSD divided into a "home" partition(/mnt/us) and the actual operating system partition (/), which is about 200Mb, I think.

You are sure going to need ssh. I think the Kindle 3 have already figured out a way to make usbnetwork via the g_ether module work as they did with the DX.

Then you should be able to just compress the whole root(/) as a .tar.gz. That part should be easy.
Quote:
For example, wouldn't it be awesome if it where possible to hold a certain key during startup that would put the machine into a mode that where by it exports the entire flash disk via UMASS. That way you could take an easy full image backup, and restore if something goes wrong.
Sure, but that's only realistic and fun if you have serial console access. On the Kindle 3, no soldering is required any more.

If you have serial console access, you could create your own initramfs for the Kindle(as I described in this thread). The init script in the initramfs could then load the g_ether or g_file_storage module after it has mounted the file system root in /dev/mmcblk0p1(I think, run mount to figure the devide out).

g_ether would give you ssh access, allowing you to copy files via secure copy. g_file_storage will make the kindle behave like a mass storage medium, as you suggested.

Then boot this image via U-Boot and here you go!
choff is offline   Reply With Quote
Old 04-29-2011, 01:52 AM   #9
bdaddy
Junior Member
bdaddy began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Apr 2011
Device: Kindle 3 wifi
Choff,

Thanks for the response. A couple follow up questions:

(1) With the kindle 3 (wifi or 3g+wifi) why is still necessary to do the networking via usb? Why not just have a simple update payload that copies over a static ssh or telnet daemon, and starts it up. Then connect from a workstation via wifi. Or does the kindle cripple the networking over wifi? And if so, why not add some extra code in the update payload to uncripple it?

(2) "On the Kindle 3, no soldering is required any more." Really? That sounds awesome. How does that work? Does a standard usb-rs232 cable work or something like that?

Thanks again!
bdaddy is offline   Reply With Quote
Old 05-12-2011, 04:53 PM   #10
Xqtftqx
Enthusiast
Xqtftqx doesn't litterXqtftqx doesn't litter
 
Posts: 31
Karma: 104
Join Date: Mar 2011
Device: Kindle 3G
Can you tell us how you got tinyx to work? Im interested

Also as a quick solution for your screen update problem, the guy that made savory wrote this:
http://savory.googlecode.com/svn/tru..._update_daemon

Last edited by Xqtftqx; 05-13-2011 at 10:03 PM.
Xqtftqx is offline   Reply With Quote
Old 03-23-2013, 10:53 AM   #11
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,552
Karma: 6021142
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Thanks once again Choff for your excellent work. you are missed. I will dig through this again hopefully soon.

Thanks for all your great tips and insight
twobob is offline   Reply With Quote
Old 03-23-2013, 03:01 PM   #12
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,382
Karma: 5840126
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by bdaddy View Post
Choff,

Thanks for the response. A couple follow up questions:

(1) With the kindle 3 (wifi or 3g+wifi) why is still necessary to do the networking via usb? Why not just have a simple update payload that copies over a static ssh or telnet daemon, and starts it up. Then connect from a workstation via wifi. Or does the kindle cripple the networking over wifi? And if so, why not add some extra code in the update payload to uncripple it?

(2) "On the Kindle 3, no soldering is required any more." Really? That sounds awesome. How does that work? Does a standard usb-rs232 cable work or something like that?

Thanks again!
Update the firewall to allow incoming connections to port 22 over Wifi.

Actually there already is posted what you need;
The KUAL launcher and the KUAL Firewall.

On this forum you will find the details of where one person put the "allow" rule (it goes in as Rule #1 of the chain for the interface you want to use).

Sorry - we do not support the Amazon firewall here, only our own, KUAL Firewall.
knc1 is offline   Reply With Quote
Old 03-25-2013, 11:33 PM   #13
brianinmaine
Addict
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 377
Karma: 1277063
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
These posts are from 2 years ago... some good info, but I wouldn't spend much time trying to help
brianinmaine is offline   Reply With Quote
Old 03-26-2013, 09:00 AM   #14
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,382
Karma: 5840126
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by brianinmaine View Post
These posts are from 2 years ago... some good info, but I wouldn't spend much time trying to help
But a long over-due thank you should not be considered out of place, even two years late.
knc1 is offline   Reply With Quote
Old 03-26-2013, 10:46 AM   #15
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,552
Karma: 6021142
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
And they are still relevant today. Who knew?

twobob is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Are frequent resets "normal" taspool Bookeen 20 04-08-2009 07:08 PM
Normal to see an Adobe logo "watermark" while charging? rahulm Sony Reader 3 03-16-2009 04:24 AM
Does Calibre embed "normal" font? radius Calibre 8 08-30-2008 05:04 PM
"Error 1316" When Installing Ebook Library Upgrade dsuden Sony Reader 1 08-01-2008 06:15 AM
Installing "Send to Palm" plug-in in Adobe Reader 6? daught Reading and Management 8 06-02-2003 06:15 PM


All times are GMT -4. The time now is 04:33 PM.


MobileRead.com is a privately owned, operated and funded community.