Long time listener, first time caller:
Since I couldn't find much specific info concerning the PaperWhite here (yes I know its a K5... kinda), I decided to share my current progress on building the kernel and modules. The end goal is to have OTG host mode, bluetooth, audio, and thumb drive support. That should keep me happy. Once I make some headway with this I will be posting an end to end walkthrough for the PW1. It will be from demo/brick/serial to jailbreak to kindlets to kual to root to optware to OTG to bt/sound/thumb. What I need from you people now is some guidance.
Notes:
- OS in use is Slackware64 14.1. If you use another OS (Ubuntu/Debian) it should still work fine.
- Build root is '~/' (home). To do this process from another directory, copy this post into an editor, the search and replace '~/' with whatever.
- Using a different toolchain should be as simple as replacing CROSS_COMPILE
Here we go:
- Download and extract the Kindle source files
- Select and Configure a Toolchain
Use the packaged build_linaro-gcc:
Quote:
#make and move into our toolchain root
mkdir ~/gplrelease/build; cd ~/gplrelease/build
#extract toolchain sources to our location
tar xf ~/gplrelease/build_linaro-gcc_4.5.4.tar.gz
#make and package the toolchain
make PREFIX=~/cross-linaro-gcc
#go to your home directory
cd ~
#extract the configured toolchain to our location
tar xf ~/gplrelease/build/cross-arm-linux-gnueabi-gcc-linaro-4.5-2011.05-0.tar.bz2
#SUBSTITUTE THIS FOR CROSS_COMPILE IN SUBSEQUENT STEPS
CROSS_COMPILE=~/cross-linaro-gcc/bin/arm-linux-gnueabi-
|
...or use a prebuilt toolchain
- Build uBoot's mkimage
Quote:
#make and move into our uBoot build root
mkdir ~/gplrelease/uboot; cd ~/gplrelease/uboot
#extract uBoot sources to our location
tar xf ~/gplrelease/uboot_2009.08.tar.gz
#set up our uBoot for our board
make imx50_yoshi_config
#make the tools (we only need mkimage)
make CROSS_COMPILE=~/cross-linaro-gcc/bin/arm-linux-gnueabi- tools
|
- Set up the Linux build
Quote:
#make and move into our Linux build root
mkdir ~/gplrelease/linux; cd ~/gplrelease/linux
#extract the linux sources to our location
tar xf ~/gplrelease/linux-2.6.31.tar.gz
#set up the kernel for our board (YOSHIME is PW1 WiFi, YOSHIME3 is PW1 3G)
make ARCH=arm imx50_yoshime3_defconfig
#configure the kernel options (I like menuconfig, but config, etc, also work)
make ARCH=arm menuconfig
|
- Kernel Configuration Notes (full .config attached 'yoshime3.config.tar')
Quote:
#Here are my working changes:
CONFIG_KEXEC=y
CONFIG_ATAGS_PROC=y
CONFIG_NET_IPIP=m
CONFIG_NET_IPGRE=m
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IPV6=m
CONFIG_IRDA=m
CONFIG_USB_IRDA=m
CONFIG_BT=m
CONFIG_BT_L2CAP=m
CONFIG_BT_RFCOMM=m
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_HIDP=m
CONFIG_BT_HCIBTUSB=m
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_H4=y
CONFIG_TUN=m
CONFIG_USB_USBNET=m
CONFIG_SOUND=m
CONFIG_SND=m
CONFIG_SND_SEQUENCER=m
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_DUMMY=m
CONFIG_SND_USB_AUDIO=m
CONFIG_HID_SUPPORT=y
CONFIG_USB_DEBUG=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
CONFIG_USB_GADGET_DEBUG_FILES=y
CONFIG_USB_GADGET_DEBUG_FS=y
CONFIG_USB_OTG=y
CONFIG_USB_AUDIO=m
CONFIG_USB_GADGETFS=m
CONFIG_USB_G_SERIAL=m
CONFIG_USB_MIDI_GADGET=m
CONFIG_USB_GPIO_VBUS=m
CONFIG_NOP_USB_XCEIV=m
CONFIG_EXT4_FS=m
CONFIG_EXT4DEV_COMPAT=y
CONFIG_NTFS_FS=m
CONFIG_NTFS_DEBUG=y
CONFIG_NTFS_RW=y
CONFIG_AUFS_FS=m
|
- Fix the broken config includes
Quote:
#add Kexec support to the Kernel
echo -e 'CONFIG_KEXEC=y\nCONFIG_ATAGS_PROC=y'>>~/gplrelease/linux/.config
#add the yoshime[3] front light include (copy from uboot/include/linux/frontlight.h)
cp ~/gplrelease/uboot/include/linux/frontlight.h ~/gplrelease/linux/include/linux/
#fix yoshime[3] hall sensor include (copy yoshime_hall.h to lab126_hall.h and tweak it)
sed 's/YOSHIME/LAB126/;s/struct yoshime_/#define HALL_MISC_DEV_NAME "hall"\n#define PATH_DEV_HALL "\/dev\/"HALL_MISC_DEV_NAME\nstruct /' ~/gplrelease/linux/include/linux/yoshime_hall.h >~/gplrelease/linux/include/linux/lab126_hall.h
#fix yoshime3 mxc fb by disabling the useless NEON extensions
chmod u+w ~/gplrelease/linux/include/linux/mxcfb.h
cat << EOP >>~/gplrelease/linux/include/linux/mxcfb.h
#define WAVEFORM_MODE_REAGL 0x8
#define WAVEFORM_MODE_REAGLD 0x9
#define TEMP_USE_AUTO 0x1001
#define MXCFB_GET_WAVEFORM_TYPE _IOR('F', 0x39, __u32)
#define WAVEFORM_TYPE_4BIT 0x1
EOP
chmod u-w ~/gplrelease/linux/include/linux/mxcfb.h
sed -i 's/int mode_du4;/int mode_du4;int mode_reagl;int mode_reagld;/' ~/gplrelease/linux/include/linux/mxcfb.h
sed -i 's/#ifdef __ARM_NEON__/#undef __ARM_NEON__\n#ifdef __ARM_NEON__/' ~/gplrelease/linux/drivers/video/mxc/mxc_epdc_fb.c
|
- Compile the kernel and modules
Quote:
#make the uImage kernel
make ARCH=arm CROSS_COMPILE=~/cross-linaro-gcc/bin/arm-linux-gnueabi- PATH=${PATH}:~/gplrelease/uboot/tools uImage
#make the modules
make ARCH=arm CROSS_COMPILE=~/cross-linaro-gcc/bin/arm-linux-gnueabi- tar-pkg
|
- Update paths in modules.dep and finalize the tar
Quote:
#set the correct module path in modules.dep
sed -i 's/kernel\//\/lib\/modules\/2.6.31-rt11-lab126\/kernel\//g' ~/gplrelease/linux/tar-install/lib/modules/2.6.31-rt11-lab126/modules.dep
#merge the updated modules.dep into the final tar
cd ~/gplrelease/linux/tar-install
tar -uf ~/gplrelease/linux/linux-2.6.31-rt11-lab126.tar ./lib/modules/2.6.31-rt11-lab126/modules.dep
cd ~/gplrelease/linux
gzip ~/gplrelease/linux/linux-2.6.31-rt11-lab126.tar
|
- BACK UP YOUR .config (full .config attached 'yoshime3.config.tar')
Quote:
#just copy your kernel config to outside the build root
cp ~/gplrelease/linux/.config ~/gplrelease/yoshime3.config
|
- You now have a file named ~/gplrelease/linux/linux-2.6.31-rt11-lab126.tar.gz containing the kernel and modules (mine is attached 'linux-2.6.31-rt11-lab126.tar.gz', don't blame me if you use it). I will edit to add how to load this onto your kernel shortly, but if you are doing this process you really should know how already.
- ???
- Brick or Profit
My questions now are:
- Does the PaperWhite 1 (i.MX508?) support OTG host mode?
- How do I sense/manually trigger OTG host mode?
- Is there a preferred way to load the kernel+modules on my Kindle so as to not brick it repeatedly?
Special thanks to MadMouse on HackThisSite IRC for the moral support, and shared coffees/cigarettes!
This post is updated and current to and including post #37