View Single Post
Old 11-10-2017, 07:45 PM   #61
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
The amazon 5.9.22 instruction on how to build the cross compiler did not work on my Windows 10 Bash install. I think the toolsets have problems with 'PATH' variabl that contains parentheses.

So I used the same cmpiler from 5.8.1 that I used on my PW3

** This will be a work in progress until it is finished.

I may try to use the one amazon recommends again, now that I know about theis PATH issue, 'bit-bake / yocto?'

UNTAR THE FILES WITH LINUX, not windows, there are files with the same name, with case sensitive issues

  1. Download the Paperwhite 5.8.1 source from amazon
  2. grab the tar.gz build_linaro-gcc_4.8.3.tar.gz
  3. Download the Paperwhite 5.89.2 source from amazon
  4. grab the tar.gz linux-4.1.15.tar.gz
  5. Extract those to your computer
  6. 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'
    • I also edited the Makefile to have a hardcoded PATH, insted of
      Code:
      export PATH=$(BUILD_SYSROOT)$(SYSROOT)/../bin:$(PATH); \
    • In the howto, the last step you need to follow for this part is 'Install the Kernel Headers'
      1. apt install bison curl flex tar libgmp-dev libmpfr-dev libmpc-dev bc build-essentials etc, etc
      2. make
        • This takes a very long time
      3. mkdir -p $HOME/kindle/opt
      4. tar -C $HOME/kindle/opt -xzf 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
  7. The 5.9.2 linux 4.1.15 does not have a build howto, so I just had to figure it out
    • make ARCH=arm CROSS_COMPILE=$HOME/kindle/opt/cross-gcc-linaro/bin/arm-linux-gnueabi- imx_v7_zelda_defconfig
      • This is fast
    • make ARCH=arm CROSS_COMPILE=$HOME/kindle/opt/cross-gcc-linaro/bin/arm-linux-gnueabi-
      • This takes a very long time

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



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-4.1.15

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)

Notes:

there is a missing include statment somewhere. the file exists but the compiler wont find it - while compiling the kernel:
** Woops, I forgot that linux was case sensitive, thats why it wasnt working.


net/ipv4/netfilter/ipt_ECN.c:20:42: fatal error: linux/netfilter_ipv4/ipt_ECN.h: No such file or directory
Code:
#include <linux/netfilter_ipv4/ipt_ECN.h>
I changed it to :
Code:
#include <ipt_ecn.h>

Last edited by coplate; 11-10-2017 at 09:00 PM.
coplate is offline   Reply With Quote