View Single Post
Old 08-12-2016, 08:55 PM   #4
coplate
Guru
coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.
 
Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
Method #2 - using the how to inside 5.8.1 source

UPDATE 2017-07-07

Here are my new instructions I actually follow
  1. Download the Paperwhite 5.8.1 source from amazon
  2. grab the tar.gz build_linaro-gcc_4.8.3.tar.gz
  3. grab the tar.gz linux-3.0.35.tar.gz
  4. Extract those to your computer
  5. Build the linaro compiler using the 'BUILD_HOW-TO.txt' in the package
    • The howto will explain a lot of dependencies you need to install
    • I change the PREFIX in the makefile to '$(HOME)/kindle/opt/cross-gcc-linaro'
    • In the howto, the last step you need to follow for this part is 'Install the Kernel Headers'
      1. apt install < the list of dependencies>
      2. make
      3. mkdir -p $HOME/kindle/opt
      4. tar -C $HOME/kindle/opt -xjf cross-arm-linux-gnueabi-gcc-linaro-4.8-2014.04.tar.gz
      5. tar -C $HOME/kindle/opt/cross-gcc-linaro/arm-linux-gnueabi -xzf khdrs.tar.gz
  6. Build the linux kernel using the 'BUILD_HOW-TO.txt'
    • make ARCH=arm CROSS_COMPILE=$HOME/kindle/opt/cross-gcc-linaro/bin/arm-linux-gnueabi- imx60_wario_defconfig
    • make ARCH=arm CROSS_COMPILE=$HOME/kindle/opt/cross-gcc-linaro/bin/arm-linux-gnueabi-

Amazon source download page: https://www.amazon.com/gp/help/custo...deId=200203720


I used the 5.8.1 source, just because I was trying to get an older one that would work on any version of my kindle. I had originally tried the 5.7.4 source, but the instructions didn't seem to work right, or there were some missing files, so I moved up 1 step.

Making the linux kernel is only necessary for the kernel modules, the programs can be built just by installing that linaro cross compiler.

This is my makefile for Kernel modules
Code:
export ARCH:=arm
export CROSS_COMPILE:=/home/osboxes/kindle/opt/cross-gcc-linaro/bin/arm-linux-gnueabi-

#obj-m := hello-2.o
#obj-m := evdev_mouse.o
#obj-m := ev_mdc.o
obj-m := tkbd.o

KDIR := /home/osboxes/kindle/gplrelease/linux-3.0.35

PWD := $(shell pwd)


EXTRA_CFLAGS := -I$(src)/drivers/


default:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean




This is my makefile for programs
Code:
# i used amazon's own toolchain, from kindle fw sources
CROSS_COMPILE = /home/osboxes/kindle/opt/cross-gcc-linaro/bin/arm-linux-gnueabi-
CFLAGS = 
LDFLAGS =
SRC = tpoint.c
OUT = tpoint.lix

# -print-search-dirs

kindle: $(SRC)
	$(CROSS_COMPILE)gcc -DBUILD_KINDLE $(SRC) -o $(OUT) $(CFLAGS) $(LDFLAGS)

host: $(SRC)
	gcc -DBUILD_KINDLE $(SRC) -o $(OUT) $(CFLAGS) $(LDFLAGS)

clean:
	rm $(OUT)
Old copy of method 2 ( twobobs pre-set qemu image ) is included below, but that file is no longer on the internet.
Spoiler:

Method #2 - twobobs pre-set qemu image
Starting with this image twobob linked:
https://www.mobileread.com/forums/sh...46&postcount=6

  1. mkdir /chroots/armel-twobob
  2. wget https://dl.dropboxusercontent.com/u/...b.5gb.ext3.zip
  3. unzip deb.5gb.ext3.zip
  4. FILENAME=/mnt/base-us/deb.5gb.ext3
  5. dd if=/dev/zero of=$FILENAME bs=1M count=1500 oflag=append conv=notrunc
  6. e2fsck -f $FILENAME
  7. resize2fs $FILENAME

This sets up that build, but it doesn't have apt-get installed when I ran it with qemu
I haven't finished doing it yet, but the instruction here indicate that this was used in chroot, and to compile you set them up from inside the chroot, using apt-get from outside it, but its at this point I stopped.

These instructions are also from a thread for getting an updated debian onto the kindle itself, so I'm not 100% sure I'm on the right path with this.


https://www.mobileread.com/forums/sh...34#post2633334

  1. mount -o loop deb.5gb.ext3 /chroots/armel-twobob/
  2. chroot /chroots/armel-twobob/


Quote:
Originally Posted by twobob View Post

deb.5gb.ext3 is a general purpose image that WILL need the additional steps outlined above doing to make it a "build system", when you are bored of it or you screw it up just replace it again. (EDIT: I did this just last night)

Enjoy


The script to mount this partition is available on the DEBIAN ON A PAPERWHITE thread (and ill post it again below)


Quote:
Originally Posted by twobob View Post
root@kindle:/# apt-get install libtool build-essential ccache automake
I would guess that this would, with the debian grip guts, weigh in around 320 MB)

(then inside debian)
root@kindle:/# mkdir -p /mnt/us/extensions
(on my system that becomes /mnt/us/debian/mnt/us/extensions)

build stuff like:
root@kindle:/# ./configure --prefix=/mnt/us/extensions/{thing}/usr <other options>

root@kindle:/# make clean; PATH=/usr/lib/ccache:$PATH make ; make install

then MOVE(/COPY) the /mnt/us/debian/mnt/us/extensions stuff to /mnt/us/extensions from outside the chroot.

Last edited by coplate; 07-07-2017 at 09:51 PM. Reason: Revoking method 2, and re-writing
coplate is offline   Reply With Quote