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)

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:

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).

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.

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 :-)

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=

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 :-)

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.

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.

(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?

(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.