Kindle4: 编译并运行官方linux kernel – v2.6.31

在Kindle4的源码包中,也包含kernel的代码:

4.0, 4.0.1版本kernel代码一样,4.1.0版本独立的一个版本,而4.1.1, 4.1.2,4.1.3版本kernel也是一样的,所以在release的代码中包含3个版本的代码。

从文件名可知kindle4使用的linux kernel版本号为2.6.31,而当前upstream的kenrel版本号已经到了4.4, 今天就试试看能不能在kindle4上运行4.4版本的kernel。

  • 官方代码的编译与运行

kernel的代码选用的是4.1.3版本,这个版本的kernel缺少下面这几个文件,可以从kindle touch源码包中提取:

1. include/battery_id.h

2. include/boardid.h

3. include/linux/einkfb.h

4. include/linux/kindle_version.h

5. include/llog.h

当然,你可以从这里下载: linux_2.6.31_kindle4.patch.gz

相关的编译工具:

1. toolchain – 可选用这个版本的gcc: brillo-m10-dev/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin

2. mkimage – 编译完u-boot之后,在u-boot-2009.08/tools下会生成这个可执行文件

配置kernel:

$ ARCH=arm CROSS_COMPILE=arm-linux-androideabi- make imx50_tequila_defconfig

由于代码中没有initramfs-tequila.list文件,所以需要编辑一下生成的.config文件:将CONFIG_INITRAMFS_SOURCE设为空:

CONFIG_INITRAMFS_SOURCE=""

编译u-boot能够识别的uImage:

$ ARCH=arm CROSS_COMPILE=arm-linux-androideabi- make uImage
Image Name:   Linux-2.6.31-rt11-lab126
Created:      Thu Mar 17 08:47:50 2016
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3881688 Bytes = 3790.71 kB = 3.70 MB
Load Address: 70008000
Entry Point:  70008000
  Image arch/arm/boot/uImage is ready

通过fastboot将生成的arch/arm/boot/uImage写入到kernel分区:在u-boot – bist交互界面输入fastboot使u-boot进行fastboot模式。同时执行fastboot命令,写入uImage:

$ fastboot flash kernel ~/kindle4/4.1.3/gplrelease/linux-2.6.31/arch/arm/boot/uImage

之后执行fastboot reboot重启,kindle就会重启,运行u-boot加载并运行kernel:

Hit any key to stop autoboot:  0 
## Booting kernel from Legacy Image at 70800000 ...
   Image Name:   Linux-2.6.31-rt11-lab126
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3881688 Bytes =  3.7 MB
   Load Address: 70008000
   Entry Point:  70008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK
Starting kernel ...
Linux version 2.6.31-rt11-lab126 (hzak@B85RPI) (gcc version 4.9 20150123 (prerelease) (GCC) ) #1 Thu Mar 17 08:40:56 EDT 2016
CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: Amazon.com MX50 YOSHI Board
Board ID and Serial Number driver for Lab126 boards version 1.0
MX50 Board id - 0031501114259ZUJ
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat c03883dc, node_mem_map c03e7000
  DMA zone: 192 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 24384 pages, LIFO batch:3
  Normal zone: 320 pages used for memmap
  Normal zone: 40640 pages, LIFO batch:7
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: consoleblank=0 rootwait ro ip=off root=/dev/mmcblk0p1 debug eink=fslepdc video=mxcepdcfb:E60,bpp=8 console=ttymxc0,115200
PID hash table entries: 1024 (order: 10, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256MB = 256MB total
Memory: 255744KB available (3408K code, 416K data, 124K init, 0K highmem)
NR_IRQS:368
...

这里可以看kernel的加载地址为0x70008000。

评论

Be the First to Comment!

提醒我
avatar

wpDiscuz