[Kindle Fire Android Development] seishuku:
---

DISCLAIMER: THIS IS A REALLY GOOD WAY TO EFF UP YOUR KINDLE IF YOU DON'T KNOW WHAT YOU ARE DOING!!!

IF YOU DON'T KNOW WHAT ADB, PARTED, OR WHAT LINUX IS, YOU MIGHT WANT TO JUST CLICK THE BACK BUTTON! ;)

---

Most that know Android, knows that it's just fancy UI and API on top of Linux, but it's still not quite Linux... But what if you want to run real Linux on your tablet?

Well, it's actually not that hard to do, but certainly not for n00bs...

Need to know: Linux, fastboot, adb, parted, etc.

You will also need the mkbootimg program, fastboot, working ADB, etc.

And a USB OTG adapter and working USB keyboard.

(this is assuming you already have modded your kindle with the usual FFF+TWRP 2.1+CM9)

The first step is to do a little repartitioning, so boot the Kindle into recovery, and run an 'adb shell'.

Then run 'parted'.

The idea here is to basically maintain the stock layout, while making room for linux...

Which can be done a few ways, the easy way would to just delete 'media', then recreate it much smaller (I did 1GB).

Then make one more new partition, using the remaining flash memory (should be a little over 4GB).

Making sure to reassign the name 'media' to partition 12, you can also name the new linux partition 'linux' or whatever, if you like.

After that, quit parted, and create the new FS on the new linux partition (mke2fs -Text4 /dev/block/mmcblk0p13, but you should know that already ;)).

Then reboot the tablet, get back into Android, it may or may not complain about the 'SDCARD' needing to be formatted, which should be done anyway, since it changed in size.

Do another 'adb shell', mount the new linux partition to a useful place, you can just mount over '/mnt' if you like, it won't hurt anything. Exit out of the shell.

Download this pre-built Debian rootfs I found:

http://rcn-ee.net/deb/rootfs/wheezy/

Unpack that file on your host machine, then use 'adb push' to copy the armel-rootfs tar to the Kindle's '/mnt'.

'adb shell' back into the kindle, and change to '/mnt' and untar the armel rootfs tar file... Maybe go to the bathroom, get a drink, get some fresh air or something, it'll take a little time to do it's thing.

After that's done, download my rc.local and 'adb push' that to '/mnt/etc' and make sure to ungzip it, and chmod is 0777 (or is it 0766, either should work lol).

http://www.mediafire.com/?gx46xxb4813n5ob

Then you can delete the rootfs tar file if you like, get out of '/mnt', and unmount it.

Linux is now installed, easy eh?

Now, download my kernel (acutally it's Hashcode's kernel, but with needed changes):

http://www.mediafire.com/?2lqex9j5bgws0b1 (Updated 6/11/2012)

Using mkbootimg:

'mkbootimg --kernel zImage --ramdisk /dev/zero --cmdline "root=179:XX" --base 0x80000000 -o boot.img'

Where XX is the partition that you put linux on (if following this exactly, should be 13), you should now be able to use /dev/mmcblk0pXX as well, if that doesn't work just use 179:XX.

Then using fastboot, boot the kernel package:

'fastboot boot boot.img'

While it says 'waiting for device...", reboot the Kindle and wait for it to download and boot the package.

Then wait for the linux login!

Plug in your favorite USB keyboard, a USB 1.1 one works best I've found.

The root password for that rootfs package is just 'root'.

-------------

Now, the fun part: Internet access, the hard way.

I'm still working out getting the WIFI modules working, so you'll have to use it tethered via USB... Which means no keyboard, but you can still log in by SSH.

In my kernel, instead of being an 'android' USB devices, it's a multifunction USB gadget with ethernet, serial port, and mass storage.

Mass storage works, but a little buggy sometimes.

Serial port seems broken for some reason.

Ethernet is what we're after.

Now the rc.local I made, in addition to enabling the video overlay (so there's a framebuffer console on the LCD), it also sets up the ethernet USB gadget.

I set the IP address to 192.168.5.1, which really should be out of the common IP range that most people use, but if it conflicts, then you can edit rc.local before you push it over above.

On your Linux host, with the Kindle plugged in, bring up the USB ethernet interface:

'ifconfig usb0 192.168.5.2 netmask 255.255.255.0'

After that, maybe try pinging the kindle (192.168.5.1), to make sure everything is working... If it is, you should have no problems connecting with SSH and logging in.

Once you can connect/login by SSH, you'll need to add your host machine as the default gateway ('route add default gw 192.168.5.2'), then edit '/etc/resolve.conf' and add a DNS server (add your ISP's DNS, or use 4.2.2.1).

After that, you should have internet access on the kindle side via SSH, and should be able to download/install your favorite Debian packages.

Oh, did I mention that you'll need a IP forwarding/NAT service running on your linux host too? I'll have to refer to linux manuals on how to do that, but if you can do all this, you should have no problems doing that.

I should also say that this CAN technically be done in windows as well, since all the needed programs are available in WIN32 bins, but you won't be able to get tethered network access working, because Microsoft doesn't support CDC ethernet devices.

Have fun!

OH! And X works fairly well with the omap3 video driver, just so long as you DON'T touch the screen, the touch screen driver currently crashes X on input.

So fair warning, make sure you know how to navigate X with just a keyboard, unless you have a OTG working hub and can use a keyboard and mouse, or have a wireless keyboard/mouse combo of some kind. :D

Update 6/11/2012:

Uploaded new kernel (link above), touch screen is now working, though no multitouch.

I have a boot loader with multiple boot options, http://www.mediafire.com/?l6aaqgsdkiksfw0

To use it, make a partition named "linuxboot", and flash your linux's boot.img created with the above instructions.

Still working on wifi.

Update 6/11/2012:

Ok, WIFI is working... Not sure why it wasn't before.

Here are the modules: http://www.mediafire.com/?139hold2a2l9vbl

Don't forget to run depmod.

You'll also have to copy the firmware from android system partition in /etc/firmware and copy it to Linux /lib/firmware