Porting Android kernel to the TS-72xx board (EP93xx)

Porting Attempt

From: Android base (2.6.25-android-r1.0), ARM11, on android phones (like G1)

To: TS-7200 SBC, ARM9, 2.6.24.4-ts… (Matt’s) kernel.

Upside: TS72xx learning, android learning, porting experience.

Downside: no full LED screen/touchpanel, moving to lower-powered processor, toolchain (asm) issues?

Resources:

http://www.nthcode.com/pubs/porting-android-to-a-new-device-p2.html

Verify TS-7200 board running off a 2.6 kernel (because it ships with 2.4.26)

So: downloaded kernel codebase of 2.6.21-ts from here:

tskernel-2.6.21-ts-src.tar.gz 56618 KB Thursday 15 November 2007 12:00:00 IST

$ wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7200-linux/sources/tskernel-2.6.21-ts-src.tar.gz

–18:27:16– ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7200-linux/sources/tskernel-2.6.21-ts-src.tar.gz

=> ‘tskernel-2.6.21-ts-src.tar.gz.1’

Resolving ftp.embeddedarm.com… 67.40.67.44

Connecting to ftp.embeddedarm.com|67.40.67.44|:21… connected.

Logging in as anonymous … Logged in!

==> SYST … done. ==> PWD … done.

==> TYPE I … done. ==> CWD /ts-arm-sbc/ts-7200-linux/sources … done.

==> PASV … done. ==> RETR tskernel-2.6.21-ts-src.tar.gz … done.

Length: 5,79,75,931 (55M) (unauthoritative)

2% [> ] 13,86,578 18.46K/s ETA 25:18

$

Use the correct configuration file.

$ make CROSS_COMPILE=arm-none-linux-gnueabi- ts72xx_defconfig

<< looks for the configuration file specified (as a parameter) within

arch/<arch>/configs/ and uses it. >>

HOSTLD scripts/kconfig/conf

drivers/crypto/cesa/Kconfig:16:warning: type of ‘MV_CESA_TEST’ redefined from ‘tristate’ to ‘boolean’

*

* Linux Kernel Configuration

*

*

* Code maturity level options

*

Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [Y/n/?] y

*

* General setup

*

Local version – append to kernel release (LOCALVERSION) []

Automatically append version information to the version string (LOCALVERSION_AUTO) [N/y/?] n

Support for paging of anonymous memory (swap) (SWAP) [Y/n/?] y

System V IPC (SYSVIPC) [Y/n/?] y

ARM system type

1. Agilent AAEC-2000 based (ARCH_AAEC2000)

2. ARM Ltd. Integrator family (ARCH_INTEGRATOR)

3. ARM Ltd. RealView family (ARCH_REALVIEW)

4. ARM Ltd. Versatile family (ARCH_VERSATILE)

5. Atmel AT91 (ARCH_AT91)

6. Cirrus CL-PS7500FE (ARCH_CLPS7500)

7. Cirrus Logic CLPS711x/EP721x-based (ARCH_CLPS711X)

8. Co-EBSA285 (ARCH_CO285)

9. EBSA-110 (ARCH_EBSA110)

> 10. EP93xx-based (ARCH_EP93XX)

11. FootBridge (ARCH_FOOTBRIDGE)

$

ARM ABI (EABI) support is built-in. See the ‘help’ section below as well.

$ grep -i EABI .config

CONFIG_AEABI=y

$ find . -name Kconfig 2>/dev/null|xargs grep -A5 AEABI

./arch/arm/Kconfig:config AEABI

./arch/arm/Kconfig- bool “Use the ARM EABI to compile the kernel”

./arch/arm/Kconfig- help

./arch/arm/Kconfig- This option allows for the kernel to be compiled using the latest

./arch/arm/Kconfig- ARM ABI (aka EABI). This is only useful if you are using a user

./arch/arm/Kconfig- space environment that is also compiled with EABI.

$

Q. Will the ts-kernel successfully build and work when built using the (latest) CodeSourcery GNU/Linux EABI ARM Lite toolchain?

A. From the above configuration (CONFIG_AEABI=y), hopefully, yes.

<< Er, actually no. Pl read on… 🙂 >>

$ time make CROSS_COMPILE=arm-none-linux-gnueabi-

CHK include/linux/version.h

make[1]: ‘include/asm-arm/mach-types.h’ is up to date.

CHK include/linux/utsrelease.h

CHK include/linux/compile.h

CC init/do_mounts.o

CC init/do_mounts_rd.o

CC init/do_mounts_initrd.o

LD init/mounts.o

CC init/initramfs.o

Kernel: arch/arm/boot/zImage is ready

Building modules, stage 2.

MODPOST 3 modules

CC crypto/pcbc.mod.o

LD [M] crypto/pcbc.ko

CC drivers/net/wireless/zd1211rw/zd1211rw.mod.o

LD [M] drivers/net/wireless/zd1211rw/zd1211rw.ko

CC drivers/serial/tsuart1.mod.o

LD [M] drivers/serial/tsuart1.ko

real 4m37.120s

user 4m12.284s

sys 0m19.921s

$

$ ls -l arch/arm/boot/zImage

-rwxr-xr-x 1 kaiwan users 1425576 2009-01-06 10:53 arch/arm/boot/zImage*

$

Install the kernel modules in a non-default location (default is /lib/modules/…); done by setting the environment variable INSTALL_MOD_PATH:

$ mkdir ../modules

$ make CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=../modules/ modules_install

INSTALL crypto/pcbc.ko

INSTALL drivers/net/wireless/zd1211rw/zd1211rw.ko

INSTALL drivers/serial/tsuart1.ko

if [ -r System.map -a -x /sbin/depmod ]; then /sbin/depmod -ae -F System.map -b ../modules/ -r 2.6.21-ts; fi

$

Copy the kernel image onto a (ext2 formatted) CF card; we’ll boot the TS7200 off it..

$ sudo cp arch/arm/boot/zImage /media/disk/images/zImage-2.6.21-6jan09

[sudo] password for kaiwan:

$

Run minicom; settings:

| A – Serial Device : /dev/ttyACM0 |

Port| B – Lockfile Location : /var/lock |

| C – Callin Program : |

| D – Callout Program : |

| E – Bps/Par/Bits : 115200 8N1 |

| F – Hardware Flow Control : No |

| G – Software Flow Control : No |

Note serial device is /dev/ttyACM0 and not the usual /dev/ttyS0 , because we’re using a USB-to-Serial converter to connect the SBC to the PC.

Power on the SBC:

>> TS-BOOTROM, Rev 1.05 – built 11:31:03, Mar 8 2005

>> Copyright (C) 2005, Technologic Systems

>> TS-7200: Rev E0 CPU, Rev C PLD, 32MB SDRAM, options ( MAX197-ADC RS485 )

+Ethernet eth0: MAC address 00:d0:69:40:15:3b

IP: 192.168.0.50/255.255.255.0, Gateway: 192.168.0.11

Default server: 192.168.0.11

RedBoot(tm) bootstrap and debug environment [ROMRAM]

Non-certified release, version current-TS_5 – built 15:41:04, Mar 8 2005

Platform: TS-7200 Board (ARM920T) Rev A

Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.

RAM: 0x00000000-0x02000000, [0x00044c28-0x01fdd000] available

FLASH: 0x60000000 – 0x60800000, 64 blocks of 0x00020000 bytes each.

== Executing boot script in 1.000 seconds – enter ^C to abort

^C

RedBoot> disks

hda1 Linux

RedBoot> load -r -b 0x218000 -m disk hda1:/images/zImage-2.6.21-6jan09

Raw file loaded 0x00218000-0x003740a7, assumed entry at 0x00218000

RedBoot> exec -c “console=ttyACM0,115200 root=/dev/hda1”

Using base address 0x00218000 and length 0x0015c0a8

Uncompressing Linux………………………………………………………………………………….. done, b.

<hangs>

Well. Looks like the kernel builds with the toolchain we used, but cannot execute correctly. Probably have to use the non-EABI version.

Attempt 2 – with the designated ARM EABI toolchain

 

Found on the Technologic System’s website this page “Linux 2.6 for TS-7200 Computers” which has a link to Linux cross-toolchain (cross-compiler for ARM EABI).

 

Download the cross-compiler and install it.

 

$ arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc –version

arm-none-linux-gnueabi-gcc (GCC) 3.4.4 (release) (CodeSourcery ARM 2005q3-2)

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

$

 

Did not work, same issue as before.

 

Attempt 3

Now downloaded and installed the old ABI ARM toolchain.

 

$ arm-linux-gcc –version

arm-linux-gcc (GCC) 3.3.4

Copyright (C) 2003 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

$

 

Had to turn EABI option off, else get errors on compiling.

 

$ grep EABI .config

# CONFIG_AEABI is not set

$ make …

CC mm/oom_kill.o

CC mm/fadvise.o

CC mm/page_alloc.o

mm/page_alloc.c:675: warning: `setup_nr_node_ids’ defined but not used

/tmp/ccX6lynC.s: Assembler messages:

/tmp/ccX6lynC.s:6365: Error: .err encountered

make[1]: *** [mm/page_alloc.o] Error 1

make: *** [mm] Error 2

$

 

Abandoning this.

Attempt 4

 

Saw on the http://tech.groups.yahoo.com/group/ts-7000/files/ , a patch for 2.6.24.4 linux kernel (for the TS7200).

linux-2.6.24.4-ts7200_matt-10.zip
Kernel 2.6.24.4 patch (against mainline Linux kernel) for TS-7200 [dt 15.Nov.2008].

 

Trying this…

 

$ head Makefile

VERSION = 2

PATCHLEVEL = 6

SUBLEVEL = 24

EXTRAVERSION = .4

 

Apply Matt’s TS7200 patch:

$ patch -p1 <../linux-2.6.24.4-ts7200_matt-10.patch

patching file arch/arm/configs/ts7200_defconfig

patching file arch/arm/Kconfig

patching file arch/arm/kernel/head.S

patching file arch/arm/kernel/setup.c

patching file arch/arm/mach-ep93xx/core.c

patching file include/asm-arm/memory.h

patching file include/linux/irq.h

patching file Makefile

$

 

Toolchain- using CodeSourcery GNU EABI toolchain.

 

$ export PATH=/media/xd2_160GB/android/toolchain/CodeSourcery_ARM_Lite/bin/:$PATH

$ arm-none-linux-gnueabi-gcc –version

arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2008q3-72) 4.3.2

Copyright (C) 2008 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

$

$ make CROSS_COMPILE=arm-none-linux-gnueabi- ts7200_defconfig

$ make CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

<save & exit>

$

 

CONFIG_EABI is off by default.

$ grep EABI .config

# CONFIG_AEABI is not set

$

 

Turned it on.

 

$ make CROSS_COMPILE=arm-none-linux-gnueabi-

LD .tmp_vmlinux1

kernel/built-in.o: In function `timekeeping_resume’:

utsname_sysctl.c:(.text+0x23a24): undefined reference to `__umoddi3′

utsname_sysctl.c:(.text+0x23a40): undefined reference to `__udivdi3′

kernel/built-in.o: In function `update_wall_time’:

utsname_sysctl.c:(.text+0x2407c): undefined reference to `__umoddi3′

utsname_sysctl.c:(.text+0x24098): undefined reference to `__udivdi3′

make: *** [.tmp_vmlinux1] Error 1

$

 

Turns out this issue has been faced; it’s due to gcc optimization (what else).

The solution is to prevent gcc-3.4 optimization by inserting an inline assembler statement in include/linux/time.h .

 

The “patch” is:

--------
Prevent gcc-4.3 form "optimizing" the while loop into a costly modulo operation.
Patch found at http://lkml.org/lkml/2008/2/22/464.

Reported-by: Sven Rebhan <odinshorse@googlemail.com>
Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
---
 include/linux/time.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index b04136d..3e8fd9e 100644

ns += a->tv_nsec;
while(unlikely(ns >= NSEC_PER_SEC)) {
/* The following asm() prevents the compiler from
* optimising this loop into a modulo operation.  */
asm(“” : “+r”(ns));
ns -= NSEC_PER_SEC;
a->tv_sec++;

}

See this link.

(Posted the same (above info) to the TS7200 mailing list).

Applied the patch, rebuilt.

Yes! It built.

 

Important Note:

  1. ARM EABI option on turns out to be a mistake. It hangs upon uncompressing (as usual :). Turn off the ARM EABI option, rebuild, reboot.

  2. Remembered that there was an issue with CPU type; perhaps that’s why it did not boot earlier…

<< Update:

This is (was) an old issue. Now solved inline with:

$ grep TS72XX_FORCE .config

CONFIG_MACH_TS72XX_FORCE_MACHINEID=y

$

 

So, that’s not a problem anymore.

>>

 

Actually works!!

 

RedBoot> exec -c “console=ttyAM0,115200 root=/dev/hda1”

Using base address 0x00218000 and length 0x001b1170

Uncompressing Linux…………………………………………………………………………………………..

Linux version 2.6.24.4-matt (kaiwan@kaiwan-1) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #5 PREEMPT Wed Jan 7 09:39

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=40007177

Machine: Technologic Systems TS-72xx SBC

Memory policy: ECC disabled, Data cache writeback

CPU0: D VIVT write-back cache

CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets

CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets

Built 4 zonelists in Zone order, mobility grouping on. Total pages: 8128

Kernel command line: console=ttyAM0,115200 root=/dev/hda1

PID hash table entries: 128 (order: 7, 512 bytes)

Console: colour dummy device 80×30

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory: 8MB 8MB 8MB 8MB = 32MB total

Memory: 28620KB available (3320K code, 387K data, 100K init)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

net_namespace: 64 bytes

NET: Registered protocol family 16

ep93xx: PLL1 running at 400 MHz, PLL2 at 192 MHz

ep93xx: FCLK 200 MHz, HCLK 100 MHz, PCLK 50 MHz

SCSI subsystem initialized

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

NetWinder Floating Point Emulator V0.97 (extended precision)

JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.

io scheduler noop registered

io scheduler anticipatory registered

io scheduler deadline registered

io scheduler cfq registered (default)

Serial: 8250/16550 driver $Revision: 1.90 $ 1 ports, IRQ sharing disabled

Serial: AMBA driver $Revision: 1.41 $

apb:uart1: ttyAM0 at MMIO 0x808c0000 (irq = 52) is a AMBA

console [ttyAM0] enabled

apb:uart2: ttyAM1 at MMIO 0x808d0000 (irq = 54) is a AMBA

apb:uart3: ttyAM2 at MMIO 0x808e0000 (irq = 55) is a AMBA

ep93xx-eth version 0.1 loading

ep93xx_mii_bus: probed

Generic PHY 0:01: PHY supports MII frame preamble suppression

net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1)

net eth0: ep93xx on-chip ethernet, IRQ 39, 00:d0:69:40:15:3b

Driver ‘sd’ needs updating – please use bus_type methods

ep93xx-ohci ep93xx-ohci: EP93xx OHCI

ep93xx-ohci ep93xx-ohci: new USB bus registered, assigned bus number 1

ep93xx-ohci ep93xx-ohci: irq 56, io mem 0x80020000

usb usb1: configuration #1 chosen from 1 choice

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 3 ports detected

usb usb1: Product: EP93xx OHCI

usb usb1: Manufacturer: Linux 2.6.24.4-matt ohci_hcd

usb usb1: SerialNumber: ep93xx

Initializing USB Mass Storage driver…

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

mice: PS/2 mouse device common for all mice

ep93xx-rtc ep93xx-rtc: rtc core: registered ep93xx as rtc0

rtc-m48t86 rtc-m48t86: rtc core: registered m48t86 as rtc1

rtc-m48t86 rtc-m48t86: battery exhausted

Registered led device: ep93xx:green

Registered led device: ep93xx:red

usbcore: registered new interface driver usbhid

drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver

TCP cubic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

rtc-m48t86 rtc-m48t86: hctosys: invalid date/time

Root-NFS: No NFS server available, giving up.

VFS: Unable to mount root fs via NFS, trying floppy.

VFS: Cannot open root device “hda1” or unknown-block(2,0)

Please append a correct “root=” boot option; here are the available partitions:

Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

 

Well, we’ll ignore the mounting of the RFS for now…just interested in getting the kernel to boot 2.6.24 successfully. (The RFS is not being mounted as it’s a 2.4-based RFS; in particular, it does not have udev support, necessary for a 2.6-based system, etc.).

<!– @page { size: 21cm 29.7cm; margin: 2cm } P { margin-bottom: 0.21cm } –>

S1. Audit changes made (from vanilla 2.6.24.4 to TS72xx 2.6.24.4).

 

See the diff (patch) between the two..

S2. First, port the TS72xx-2.6.24.4 kernel to vanilla 2.6.25.

Ensure it builds and runs.

 

$ patch -p1 <../linux-2.6.24.4-ts7200_matt-10.patch >patching-24.4-to-25.out.txt

$ cat patching-24.4-to-25.out.txt

patching file arch/arm/configs/ts7200_defconfig

patching file arch/arm/Kconfig

Hunk #1 succeeded at 269 with fuzz 2 (offset 52 lines).

Hunk #2 succeeded at 777 (offset 74 lines).

Hunk #3 FAILED at 943.

Hunk #4 succeeded at 993 with fuzz 2 (offset 88 lines).

Hunk #5 FAILED at 1109.

2 out of 5 hunks FAILED — saving rejects to file arch/arm/Kconfig.rej

patching file arch/arm/kernel/head.S

patching file include/asm-arm/memory.h

patching file include/linux/irq.h

patching file Makefile

Hunk #1 FAILED at 190.

1 out of 1 hunk FAILED — saving rejects to file Makefile.rej

$

 

Study the above; apply patches selectively / manually as required (wherever it failed automatically).

 

What we do is edit this file to make it more readable (basically just inserted newlines wherever we have a successful but “offset-ed” hunk, or of course a FAILED hunk).

 

Procedure-

 

Follow the file (below).

To be safe, ensure that all “offset”-ed hunks did indeed apply correctly.

Goto each FAILED hunk (the relevant source file), manually examine the diff and insert/delete lines as required.

Repeat until all patches are applied.

In vanilla 2.6.25:

Output of 

$ patch -p1 <../linux-2.6.24.4-ts7200_matt-10.patch >patching-24.4-to-25.out.txt

-now saved as patching-24.4-to-25.annotated.txt (and displayed here below):

-----
patching file arch/arm/configs/ts7200_defconfig

patching file arch/arm/Kconfig
Hunk #1 succeeded at 269 with fuzz 2 (offset 52 lines).
Hunk #2 succeeded at 777 (offset 74 lines).
Hunk #3 FAILED at 943.
Hunk #4 succeeded at 993 with fuzz 2 (offset 88 lines).
Hunk #5 FAILED at 1109.
2 out of 5 hunks FAILED -- saving rejects to file arch/arm/Kconfig.rej
OK.

patching file arch/arm/kernel/head.S
Hunk #1 succeeded at 83 (offset -3 lines).
OK.

patching file arch/arm/kernel/setup.c
Hunk #1 succeeded at 979 (offset -27 lines).
OK.

patching file arch/arm/mach-ep93xx/core.c
Hunk #1 FAILED at 156.                   <-- problem hunk.
Hunk #2 FAILED at 365.				<-- problem hunk.
Hunk #3 succeeded at 561 (offset 52 lines).
OK.
Hunk #4 succeeded at 624 (offset 52 lines).
OK.
2 out of 4 hunks FAILED -- saving rejects to file arch/arm/mach-ep93xx/core.c.rej

patching file arch/arm/mach-ep93xx/cpufreq.c
patching file arch/arm/mach-ep93xx/Kconfig
patching file arch/arm/mach-ep93xx/Makefile
patching file arch/arm/mach-ep93xx/ts72xx.c
patching file arch/arm/mach-ep93xx/ts72xx_sbcinfo.c
patching file arch/arm/mm/discontig.c
patching file arch/arm/mm/init.c
patching file arch/arm/mm/proc-arm920.S

patching file drivers/ata/Kconfig
Hunk #1 succeeded at 679 (offset 29 lines).

patching file drivers/ata/Makefile
Hunk #1 succeeded at 71 with fuzz 2 (offset 3 lines).

patching file drivers/ata/pata_ts7200_cf.c
patching file drivers/ata/pata_ts72xx.c
patching file drivers/ata/pata_ts9600.c
patching file drivers/i2c/busses/i2c-ep93xx.c

patching file drivers/i2c/busses/Kconfig
Hunk #1 succeeded at 672 (offset -3 lines).

patching file drivers/i2c/busses/Makefile
Hunk #1 succeeded at 52 (offset -1 lines).

patching file drivers/ide/arm/ide_ts9600.c

patching file drivers/ide/arm/Makefile
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file drivers/ide/arm/Makefile.rej
OK.

patching file drivers/ide/Kconfig
Hunk #1 succeeded at 886 with fuzz 2 (offset -1 lines).

patching file drivers/input/keyboard/ep93xx-keypad.c

patching file drivers/input/keyboard/Kconfig
Hunk #1 succeeded at 314 (offset 21 lines).

patching file drivers/input/keyboard/Makefile
Hunk #1 succeeded at 26 (offset 1 line).

patching file drivers/input/keyboard/ts72xx_dio_3x4.c
patching file drivers/input/keyboard/ts72xx_dio_4x4.c

patching file drivers/leds/Kconfig
Hunk #1 succeeded at 145 with fuzz 2 (offset 31 lines).

patching file drivers/leds/leds-ep93xx.c

patching file drivers/leds/Makefile
Hunk #1 FAILED at 19.
1 out of 1 hunk FAILED -- saving rejects to file drivers/leds/Makefile.rej
OK.

patching file drivers/misc/Kconfig
Hunk #1 succeeded at 327 with fuzz 2 (offset 95 lines).

patching file drivers/misc/Makefile
Hunk #1 FAILED at 17.
1 out of 1 hunk FAILED -- saving rejects to file drivers/misc/Makefile.rej
OK.

patching file drivers/misc/ts72xx_max197.c

patching file drivers/mtd/maps/Kconfig
Hunk #1 succeeded at 493 (offset -7 lines).

patching file drivers/mtd/maps/Makefile
Hunk #1 succeeded at 68 (offset -1 lines).

patching file drivers/mtd/maps/ts7200_flash.c
patching file drivers/net/arm/ep93xx_eth.c
patching file drivers/net/arm/Kconfig

patching file drivers/net/ax88796.c
Hunk #1 succeeded at 911 (offset 6 lines).

patching file drivers/net/ax88796_ts_eth100.c
patching file drivers/net/Kconfig
Hunk #1 succeeded at 244 (offset 5 lines).

patching file drivers/net/Makefile
Hunk #1 succeeded at 123 (offset 4 lines).

patching file drivers/serial/8250_ts_ser1.c
patching file drivers/serial/Kconfig
patching file drivers/serial/Makefile
patching file drivers/spi/Kconfig
Hunk #1 succeeded at 199 (offset 8 lines).
Hunk #2 succeeded at 245 (offset 8 lines).

patching file drivers/spi/Makefile
Hunk #1 FAILED at 27.
1 out of 1 hunk FAILED -- saving rejects to file drivers/spi/Makefile.rej
OK.

patching file drivers/spi/spi_ep93xx.c
patching file drivers/spi/tmp124.c
patching file drivers/video/console/Kconfig
patching file drivers/video/console/Makefile
patching file drivers/video/console/ts72xx_con.c
patching file drivers/watchdog/Kconfig
patching file drivers/watchdog/Makefile
patching file drivers/watchdog/ts72xx_wdt.c
patching file include/asm-arm/arch-ep93xx/ep93xx-keypad.h
patching file include/asm-arm/arch-ep93xx/ep93xx-regs.h
patching file include/asm-arm/arch-ep93xx/memory.h
patching file include/asm-arm/arch-ep93xx/platform.h
patching file include/asm-arm/arch-ep93xx/ts72xx.h
patching file include/asm-arm/arch-ep93xx/uncompress.h
patching file include/asm-arm/irq.h
patching file include/asm-arm/memory.h
patching file include/linux/irq.h

patching file Makefile
Hunk #1 FAILED at 190.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.rej

OK. (Actually, only set the

ARCH ?= arm

here; this is as we’ll specify the toolchain not with the CROSS_COMPILE directive in the Makefile, but with a CROSS_COMPILE=</path/to/cross-tools/…> environment variable on the command line/shell script).

—–

So: we find that we could successfully (manually) apply all changes as required, EXCEPT for the arch/arm/mach-ep93xx/core.c file. This is a definite TODO.

Now attempting the build with the new 2.6.25-ts72xx kernel.

 

Set PATH for the CodeSourcery G++ Lite ARM GNU EABI toolchain:

..set..

$ echo $PATH

/media/<…>/android/toolchain/CodeSourcery_ARM_Lite/bin:/usr/local/sbin:/usr/local/bin:…

$

 

$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

scripts/kconfig/mconf arch/arm/Kconfig

file drivers/ide/Kconfig already scanned?

make[1]: *** [menuconfig] Error 1

make: *** [menuconfig] Error 2

$

 

Hm. Turns out to be a small issue with the (modified) arch/arm/Kconfig menu system file.

–snip–

source “drivers/misc/Kconfig”

if PCMCIA || ARCH_CLPS7500 || ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX

|| ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC

|| ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE

|| ARCH_IXP23XX || ARCH_EP93XX

source “drivers/ide/Kconfig”

endif

 

# The make … menuconfig currently fails with:

# … scripts/kconfig/mconf arch/arm/Kconfig

# file drivers/ide/Kconfig already scanned?

# make[1]: *** [menuconfig] Error 1

# make: *** [menuconfig] Error 2

# So, ugly hack:

# Comment out the directive below as we “know” the if statement above

# will be true and therefore the source statement above takes effect.

# Hence we must get rid of it being called twice…

# source “drivers/ide/Kconfig”

 

source “drivers/scsi/Kconfig”

–snip–

 

Now it’s okay.

 

$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- ts7200_defconfig

HOSTLD scripts/kconfig/conf

arch/arm/configs/ts7200_defconfig:270:warning: trying to assign nonexistent symbol SUSPEND_UP_POSSIBLE

arch/arm/configs/ts7200_defconfig:459:warning: trying to assign nonexistent symbol BLK_DEV_RAM_BLOCKSIZE

arch/arm/configs/ts7200_defconfig:569:warning: trying to assign nonexistent symbol SHAPER

arch/arm/configs/ts7200_defconfig:679:warning: trying to assign nonexistent symbol SENSORS_DS1337

arch/arm/configs/ts7200_defconfig:680:warning: trying to assign nonexistent symbol SENSORS_DS1374

arch/arm/configs/ts7200_defconfig:1164:warning: trying to assign nonexistent symbol INSTRUMENTATION

*

* Linux Kernel Configuration

*

*

* General setup

*

Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [Y/n/?] y

Local version – append to kernel release (LOCALVERSION) [-matt] -matt

Automatically append version information to the version string (LOCALVERSION_AUTO) [N/y/?] n

Support for paging of anonymous memory (swap) (SWAP) [Y/n/?] y

System V IPC (SYSVIPC) [Y/n/?] y

$ grep EABI .config

# CONFIG_AEABI is not set

$

 

Build.

Porting of some methods required (as some functionalities changed from 2.6.24 to 2.6.25. For example, gpio_line_set() became gpio_set_value() ).

So, compatibility wrappers introduced into appropriate header:

 

But:

$ make CROSS_COMPILE=arm-none-linux-gnueabi-

CHK include/linux/version.h

make[1]: `include/asm-arm/mach-types.h’ is up to date.

CHK include/linux/utsrelease.h

CALL scripts/checksyscalls.sh

<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented

<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented

<stdin>:1321:2: warning: #warning syscall pselect6 not implemented

<stdin>:1325:2: warning: #warning syscall ppoll not implemented

<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented

<stdin>:1377:2: warning: #warning syscall timerfd_create not implemented

<stdin>:1389:2: warning: #warning syscall timerfd_settime not implemented

<stdin>:1393:2: warning: #warning syscall timerfd_gettime not implemented

CHK include/linux/compile.h

CC arch/arm/mach-ep93xx/core.o

arch/arm/mach-ep93xx/core.c:155: warning: ‘gpio_int_debounce’ defined but not used

CC arch/arm/mach-ep93xx/ts72xx.o

LD arch/arm/mach-ep93xx/built-in.o

arch/arm/mach-ep93xx/ts72xx.o: In function `gpio_line_config’:

ts72xx.c:(.text+0x5c): multiple definition of `gpio_line_config’

arch/arm/mach-ep93xx/core.o:core.c:(.text+0x5e4): first defined here

arch/arm/mach-ep93xx/ts72xx.o: In function `gpio_line_set’:

ts72xx.c:(.text+0x70): multiple definition of `gpio_line_set’

arch/arm/mach-ep93xx/core.o:core.c:(.text+0xec): first defined here

make[1]: *** [arch/arm/mach-ep93xx/built-in.o] Error 1

make: *** [arch/arm/mach-ep93xx] Error 2

$

 

Got rid of the ‘multiple definition’ error by declaring the warppers to be

static inline …

.

 

So the edit in include/asm-arm/arch-ep93xx/gpio.h is:

/*————————————————————*/

/* Compat: (knb)

* for 2.6.24.4-ts72xx kernel port to 2.6.25 ..

*/

#define GPIO_IN 0

#define GPIO_OUT 1

#define EP93XX_GPIO_LOW 0

#define EP93XX_GPIO_HIGH 1

 

extern void ep93xx_gpio_set_direction(unsigned line, int direction);

 

/* Compat wrappers */

static inline int gpio_line_get(int line)

{

return gpio_direction_input(line);

}

static inline void gpio_line_set(int line, int value)

{

gpio_set_value (line, value);

}

static inline void gpio_line_config(int line, int direction)

{

ep93xx_gpio_set_direction (line, direction);

}

/*————————————————————*/

 

Various related porting issues to handle (typically introducing wrappers or back-porting changes), before the kernel builds successfully.

 

RedBoot> load -r -b 0x218000 -m disk hda1:/images/zImage-2.6.25.9jan09

Raw file loaded 0x00218000-0x003eeda7, assumed entry at 0x00218000

RedBoot> exec -c “console=ttyAM0,115200 root=/dev/hda1”

Using base address 0x00218000 and length 0x001d6da8

Uncompressing Linux…………………………………………………………………………………………..

Linux version 2.6.25-ts72xx-matt (kaiwan@kaiwan-1) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #1 PREEMPT Fri Jan 99

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=40007177

Machine: Technologic Systems TS-72xx SBC

Memory policy: ECC disabled, Data cache writeback

CPU0: D VIVT write-back cache

CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets

CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets

Built 4 zonelists in Zone order, mobility grouping on. Total pages: 8128

Kernel command line: console=ttyAM0,115200 root=/dev/hda1

PID hash table entries: 128 (order: 7, 512 bytes)

Console: colour dummy device 80×30

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory: 8MB 8MB 8MB 8MB = 32MB total

Memory: 28320KB available (3624K code, 372K data, 108K init)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

net_namespace: 156 bytes

NET: Registered protocol family 16

ep93xx: PLL1 running at 400 MHz, PLL2 at 192 MHz

ep93xx: FCLK 200 MHz, HCLK 100 MHz, PCLK 50 MHz

SCSI subsystem initialized

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

NetWinder Floating Point Emulator V0.97 (extended precision)

NTFS driver 2.1.29 [Flags: R/W DEBUG].

JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.

io scheduler noop registered

io scheduler anticipatory registered

io scheduler deadline registered

io scheduler cfq registered (default)

Serial: 8250/16550 driver $Revision: 1.90 $ 1 ports, IRQ sharing disabled

Serial: AMBA driver $Revision: 1.41 $

apb:uart1: ttyAM0 at MMIO 0x808c0000 (irq = 52) is a AMBA

console [ttyAM0] enabled

apb:uart2: ttyAM1 at MMIO 0x808d0000 (irq = 54) is a AMBA

apb:uart3: ttyAM2 at MMIO 0x808e0000 (irq = 55) is a AMBA

ep93xx-eth version 0.1 loading

ep93xx_mii_bus: probed

Generic PHY 0:01: PHY supports MII frame preamble suppression

net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1)

net eth0: ep93xx on-chip ethernet, IRQ 39, 00:d0:69:40:15:3b

Driver ‘sd’ needs updating – please use bus_type methods

ep93xx-ohci ep93xx-ohci: EP93xx OHCI

ep93xx-ohci ep93xx-ohci: new USB bus registered, assigned bus number 1

ep93xx-ohci ep93xx-ohci: irq 56, io mem 0x80020000

usb usb1: configuration #1 chosen from 1 choice

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 3 ports detected

usb usb1: New USB device found, idVendor=1d6b, idProduct=0001

usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1

usb usb1: Product: EP93xx OHCI

usb usb1: Manufacturer: Linux 2.6.25-ts72xx-matt ohci_hcd

usb usb1: SerialNumber: ep93xx

Initializing USB Mass Storage driver…

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

mice: PS/2 mouse device common for all mice

ep93xx-rtc ep93xx-rtc: rtc core: registered ep93xx as rtc0

rtc-m48t86 rtc-m48t86: rtc core: registered m48t86 as rtc1

rtc-m48t86 rtc-m48t86: battery exhausted

Registered led device: ep93xx:green

Registered led device: ep93xx:red

usbcore: registered new interface driver usbhid

drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver

TCP cubic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

rtc-m48t86 rtc-m48t86: hctosys: invalid date/time

Root-NFS: No NFS server available, giving up.

VFS: Unable to mount root fs via NFS, trying floppy.

VFS: Cannot open root device “hda1” or unknown-block(2,0)

Please append a correct “root=” boot option; here are the available partitions:

Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

 

Okay!

The 2.6.25 kernel port for the TS72XX board is done. (We’ll (just like last time with 2.6.24.4) ignore the kernel panic regarding mounting of the RFS for now, as the root filesystem is not the right one…).

We even have the red LED blinking due to the “heartbeat” driver (Chris Matt).

S3. Then, see diff (patch) between vanilla 2.6.25 and Android 2.6.25.

Port those changes to the (S2) 2.6.25-ts72xx kernel to land up with the 2.6.25-ts72xx-android-r1 kernel.

 

Like in step S2, we proceed by organizing the kernel source tree for 2.6.25-ts72xx and the patch for android-2.6.25 (diff between vanilla 2.6.25 and android-2.6.25) in the folder above it. Then we attempt to apply the patch:

 

 

$ patch -p1 <../android-2.6.25.patch

 

<< We’ll annotate this..porting as necessary wherever it FAILED or we require a change. >>

 

patching file arch/arm/configs/goldfish_defconfig

patching file arch/arm/Kconfig

Hunk #3 succeeded at 499 (offset 2 lines).

Hunk #4 succeeded at 1208 (offset 27 lines).

patching file arch/arm/kernel/entry-armv.S

patching file arch/arm/kernel/process.c

patching file arch/arm/kernel/signal.c

patching file arch/arm/kernel/stacktrace.c

patching file arch/arm/mach-goldfish/audio.c

patching file arch/arm/mach-goldfish/board-goldfish.c

patching file arch/arm/mach-goldfish/Kconfig

patching file arch/arm/mach-goldfish/Makefile

patching file arch/arm/mach-goldfish/Makefile.boot

patching file arch/arm/mach-goldfish/pdev_bus.c

patching file arch/arm/mach-goldfish/pm.c

patching file arch/arm/mach-goldfish/switch.c

patching file arch/arm/mach-goldfish/timer.c

patching file arch/arm/Makefile

patching file arch/arm/mm/Kconfig

patching file Documentation/vm/pagemap.txt

patching file drivers/android/alarm.c

patching file drivers/android/binder.c

patching file drivers/android/Kconfig

patching file drivers/android/logger.c

patching file drivers/android/Makefile

patching file drivers/android/power.c

patching file drivers/android/ram_console.c

patching file drivers/android/timed_gpio.c

patching file drivers/char/goldfish_tty.c

patching file drivers/char/Kconfig

patching file drivers/char/Makefile

patching file drivers/char/mem.c

patching file drivers/input/evdev.c

patching file drivers/input/keyboard/goldfish_events.c

patching file drivers/input/keyboard/Kconfig

patching file drivers/input/keyboard/Makefile

patching file drivers/Kconfig

patching file drivers/leds/Kconfig

Hunk #1 succeeded at 187 (offset 6 lines).

patching file drivers/leds/ledtrig-sleep.c

patching file drivers/leds/Makefile

Hunk #1 succeeded at 27 (offset 1 line).

patching file drivers/Makefile

patching file drivers/misc/Kconfig

patching file drivers/misc/lowmemorykiller.c

patching file drivers/misc/Makefile

Hunk #1 succeeded at 21 with fuzz 2.

patching file drivers/misc/qemutrace/Makefile

patching file drivers/misc/qemutrace/qemu_trace.c

patching file drivers/misc/qemutrace/qemu_trace.h

patching file drivers/misc/qemutrace/qemu_trace_sysfs.c

patching file drivers/mmc/host/goldfish.c

patching file drivers/mmc/host/Kconfig

patching file drivers/mmc/host/Makefile

patching file drivers/mtd/devices/goldfish_nand.c

patching file drivers/mtd/devices/goldfish_nand_reg.h

patching file drivers/mtd/devices/Kconfig

patching file drivers/mtd/devices/Makefile

patching file drivers/power/goldfish_battery.c

patching file drivers/power/Kconfig

patching file drivers/power/Makefile

patching file drivers/rtc/Kconfig

patching file drivers/rtc/Makefile

patching file drivers/rtc/rtc-goldfish.c

patching file drivers/switch/Kconfig

patching file drivers/switch/Makefile

patching file drivers/switch/switch_class.c

patching file drivers/switch/switch_gpio.c

patching file drivers/video/goldfishfb.c

patching file drivers/video/Kconfig

patching file drivers/video/Makefile

patching file fs/exec.c

patching file fs/fat/dir.c

patching file fs/fat/inode.c

patching file fs/inotify_user.c

patching file fs/Kconfig

patching file fs/Makefile

patching file fs/proc/base.c

patching file fs/proc/proc_misc.c

patching file fs/proc/task_mmu.c

patching file fs/yaffs2/devextras.h

patching file fs/yaffs2/Kconfig

patching file fs/yaffs2/Makefile

patching file fs/yaffs2/moduleconfig.h

patching file fs/yaffs2/yaffs_checkptrw.c

patching file fs/yaffs2/yaffs_checkptrw.h

patching file fs/yaffs2/yaffs_ecc.c

patching file fs/yaffs2/yaffs_ecc.h

patching file fs/yaffs2/yaffs_fs.c

patching file fs/yaffs2/yaffs_getblockinfo.h

patching file fs/yaffs2/yaffs_guts.c

patching file fs/yaffs2/yaffs_guts.h

patching file fs/yaffs2/yaffsinterface.h

patching file fs/yaffs2/yaffs_mtdif1.c

patching file fs/yaffs2/yaffs_mtdif1.h

patching file fs/yaffs2/yaffs_mtdif2.c

patching file fs/yaffs2/yaffs_mtdif2.h

patching file fs/yaffs2/yaffs_mtdif.c

patching file fs/yaffs2/yaffs_mtdif.h

patching file fs/yaffs2/yaffs_nand.c

patching file fs/yaffs2/yaffs_nandemul2k.h

patching file fs/yaffs2/yaffs_nand.h

patching file fs/yaffs2/yaffs_packedtags1.c

patching file fs/yaffs2/yaffs_packedtags1.h

patching file fs/yaffs2/yaffs_packedtags2.c

patching file fs/yaffs2/yaffs_packedtags2.h

patching file fs/yaffs2/yaffs_qsort.c

patching file fs/yaffs2/yaffs_qsort.h

patching file fs/yaffs2/yaffs_tagscompat.c

patching file fs/yaffs2/yaffs_tagscompat.h

patching file fs/yaffs2/yaffs_tagsvalidity.c

patching file fs/yaffs2/yaffs_tagsvalidity.h

patching file fs/yaffs2/yportenv.h

patching file include/asm-arm/arch/dma.h

patching file include/asm-arm/arch/entry-macro.S

patching file include/asm-arm/arch/hardware.h

patching file include/asm-arm/arch/io.h

patching file include/asm-arm/arch/irqs.h

patching file include/asm-arm/arch/memory.h

patching file include/asm-arm/arch/system.h

patching file include/asm-arm/arch/timer.h

patching file include/asm-arm/arch/timex.h

patching file include/asm-arm/arch/uncompress.h

patching file include/asm-arm/arch/vmalloc.h

patching file include/asm-arm/arch-goldfish/dma.h

patching file include/asm-arm/arch-goldfish/entry-macro.S

patching file include/asm-arm/arch-goldfish/hardware.h

patching file include/asm-arm/arch-goldfish/io.h

patching file include/asm-arm/arch-goldfish/irqs.h

patching file include/asm-arm/arch-goldfish/memory.h

patching file include/asm-arm/arch-goldfish/system.h

patching file include/asm-arm/arch-goldfish/timer.h

patching file include/asm-arm/arch-goldfish/timex.h

patching file include/asm-arm/arch-goldfish/uncompress.h

patching file include/asm-arm/arch-goldfish/vmalloc.h

patching file include/asm-arm/elf.h

patching file include/linux/android_aid.h

patching file include/linux/android_alarm.h

patching file include/linux/android_power.h

patching file include/linux/android_timed_gpio.h

patching file include/linux/ashmem.h

patching file include/linux/binder.h

patching file include/linux/logger.h

patching file include/linux/mm.h

patching file include/linux/msdos_fs.h

patching file include/linux/sockios.h

patching file include/linux/switch.h

patching file include/linux/tick.h

patching file include/net/bluetooth/hci_core.h

patching file include/net/bluetooth/rfcomm.h

patching file include/net/tcp.h

patching file init/Kconfig

patching file kernel/exit.c

patching file kernel/fork.c

patching file kernel/hrtimer.c

patching file kernel/panic.c

patching file kernel/power/console.c

patching file kernel/power/process.c

patching file kernel/printk.c

patching file kernel/sched.c

patching file kernel/sched_fair.c

patching file kernel/softirq.c

patching file kernel/time/tick-sched.c

patching file kernel/timeconst.h

patching file Makefile

Hunk #1 FAILED at 1.

Hunk #3 FAILED at 192.

2 out of 3 hunks FAILED — saving rejects to file Makefile.rej

patching file mm/ashmem.c

patching file mm/filemap.c

patching file mm/Makefile

patching file mm/mmap.c

patching file mm/shmem.c

patching file mm/tiny-shmem.c

patching file net/bluetooth/af_bluetooth.c

patching file net/bluetooth/hci_event.c

patching file net/bluetooth/rfcomm/core.c

patching file net/bluetooth/rfcomm/sock.c

patching file net/bluetooth/sco.c

patching file net/ipv4/af_inet.c

patching file net/ipv4/devinet.c

patching file net/ipv4/tcp_ipv4.c

patching file net/ipv6/af_inet6.c

patching file scripts/kallsyms.c

$

 

$ make CROSS_COMPILE=arm-none-linux-gnueabi- goldfish_defconfig

$ make CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

<< make choices appropriate for the TS72xx keeping Android functionality as required. >>

$

 

Build.

 

$ make CROSS_COMPILE=arm-none-linux-gnueabi-

scripts/kconfig/conf -s arch/arm/Kconfig

drivers/video/Kconfig:1897:warning: multi-line strings not supported

#

# configuration written to .config

#

CHK include/linux/version.h

UPD include/linux/version.h

SYMLINK include/asm-arm/arch -> include/asm-arm/arch-ep93xx

Generating include/asm-arm/mach-types.h

CHK include/linux/utsrelease.h

UPD include/linux/utsrelease.h

SYMLINK include/asm -> include/asm-arm

CC arch/arm/kernel/asm-offsets.s

In file included from arch/arm/kernel/asm-offsets.c:14:

include/linux/mm.h: In function ‘virt_to_head_page’:

include/linux/mm.h:276: error: implicit declaration of function ‘ADDR_TO_MAPBASE’

include/linux/mm.h:276: error: implicit declaration of function ‘LOCAL_MAP_NR’

include/linux/mm.h:276: warning: initialization makes pointer from integer without a cast

make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1

make: *** [prepare0] Error 2

$

 

Ok. Port…

 

Find that the s-link include/asm/arch is not correct (arch seems to be a directory itself; so renamed it to arch.orig). Made a soft link arch -> arch-ep93xx:

 

$ ls -l include/asm/

total 1416

-rw-r–r– 1 kaiwan users 1511 2009-01-07 13:07 a.out-core.h

-rw-r–r– 1 kaiwan users 892 2009-01-07 13:07 a.out.h

lrwxrwxrwx 1 kaiwan users 12 2009-01-12 08:51 arch -> arch-ep93xx//

drwxr-xr-x 2 kaiwan users 4096 2009-01-07 13:07 arch-aaec2000/

$

 

Above problem solved.

(But why was the soft link not there??).

 

 

$ make CROSS_COMPILE=arm-none-linux-gnueabi-

LD drivers/char/hw_random/built-in.o

CC drivers/char/goldfish_tty.o

drivers/char/goldfish_tty.c: In function ‘goldfish_tty_probe’:

drivers/char/goldfish_tty.c:229: error: implicit declaration of function ‘IO_ADDRESS’

drivers/char/goldfish_tty.c:229: error: ‘IO_START’ undeclared (first use in this function)

drivers/char/goldfish_tty.c:229: error: (Each undeclared identifier is reported only once

drivers/char/goldfish_tty.c:229: error: for each function it appears in.)

make[2]: *** [drivers/char/goldfish_tty.o] Error 1

make[1]: *** [drivers/char] Error 2

make: *** [drivers] Error 2

$

 

Remove Goldfish TTY (character driver) support.

Remove Goldfish battery support.

Remove VGA Console support.

 

$ grep -i goldfish .config

# CONFIG_ARCH_GOLDFISH is not set

# CONFIG_MTD_GOLDFISH_NAND is not set

# CONFIG_KEYBOARD_GOLDFISH_EVENTS is not set

# CONFIG_GOLDFISH_TTY is not set

#CONFIG_BATTERY_GOLDFISH=y

# CONFIG_BATTERY_GOLDFISH is not set

# CONFIG_FB_GOLDFISH is not set

# CONFIG_RTC_DRV_GOLDFISH is not set

$

 

LD vmlinux

SYSMAP System.map

SYSMAP .tmp_System.map

OBJCOPY arch/arm/boot/Image

Kernel: arch/arm/boot/Image is ready

AS arch/arm/boot/compressed/head.o

GZIP arch/arm/boot/compressed/piggy.gz

AS arch/arm/boot/compressed/piggy.o

CC arch/arm/boot/compressed/misc.o

LD arch/arm/boot/compressed/vmlinux

OBJCOPY arch/arm/boot/zImage

Kernel: arch/arm/boot/zImage is ready

$

 

Done.

Try it; it hangs on boot after the message:

Using base address 0x00218000 and length 0x001b180c

Uncompressing Linux…………………………………………………………………………………………..

 

Try disabling ‘Preemptible kernel’.

Nope, still hangs.

 

Want to see printk’s early; early_printk() not supported on this platform. Googled and found that people then use helpers like printascii, printhex, etc. To compile this is, must turn on CONFIG_DEBUG_LL : Kernel Hacking /

[*] Kernel low-level debugging functions

[ ] Kernel low-level debugging via EmbeddedICE DCC channel

 

 

CONFIG_DEBUG_LL: │

│ │

│ Say Y here to include definitions of printascii, printch, printhex │

│ in the kernel. This is helpful if you are debugging code that │

│ executes before the console is initialized. │

│ │

│ Symbol: DEBUG_LL [=n] │

│ Prompt: Kernel low-level debugging functions │

│ Defined at arch/arm/Kconfig.debug:54 │

│ Depends on: DEBUG_KERNEL │

│ Location: │

│ -> Kernel hacking

 

 

 

Insert some printascii() calls to follow early init code.

Rebuild, reboot.

 

The printascii works! Kewl!

RedBoot> exec

Using base address 0x00218000 and length 0x001a248c

Uncompressing Linux…………………………………………………………………………………………..

***@1

***@2

***@3

***@4

***@5

***@6

<5>Linux version 2.6.25-ts72xx-android-try1 (kaiwan@kaiwan-1) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #9 Mon Ja9

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=40007177

Machine: Technologic Systems TS-72xx SBC

Memory policy: ECC disabled, Data cache writeback

<7>On node 0 totalpages: 2048

<5>Kernel command line: console=ttyAM0,115200 root=/dev/hda1

PID hash table entries: 128 (order: 7, 512 bytes)

Console: colour dummy device 80×30

***after console_init()

<6>Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

<6>JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.

yaffs Jan 12 2009 10:39:16 Installing.

<6>io scheduler noop registered

<6>io scheduler anticipatory registered (default)

<6>io scheduler deadline registered

<6>io scheduler cfq registered

<–now hangs here–>

 

 

<< An Aside:

Interestingly, only when CONFIG_DEBUG_LL is enabled (and therefore the printascii() takes effect), do the other printk’s show up, indeed any console output at all show up…

>>

 

Traced (narrowed down) the problem by also turning the initcall_debug mechanism on.

 

In init/main.c:

static void __init do_initcalls(void)

{

initcall_t *call;

–snip–

 

if (initcall_debug) {

printk(“Calling initcall 0x%p”, *call);

print_fn_descriptor_symbol(“: %s()”,

(unsigned long) *call);

printk(“n”);

t0 = ktime_get();

}

–snip–

Set:

static int __initdata initcall_debug=1;

(default uninitialized, so 0).

 

Now on boot, we see:

RedBoot> exec

Using base address 0x00218000 and length 0x001a0ff4

Uncompressing Linux…………………………………………………………………………………………..

***@1

***@2

***@3

***@4

***@5

***@6

<5>Linux version 2.6.25-ts72xx-android-try1 (kaiwan@kaiwan-1) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #16 Mon J9

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=40007177

Machine: Technologic Systems TS-72xx SBC

***12

***13

***14

<6>CPU: Testing write buffer coherency: ok

***calling rest_init(0) now…

<1>*** At kernel_init:838

Calling initcall 0xc001bbec: net_ns_init+0x0/0x104()

<6>net_namespace: 152 bytes

initcall 0xc001bbec: net_ns_init+0x0/0x104() returned 0.

initcall 0xc001bbec ran for 2 msecs: net_ns_init+0x0/0x104()

Calling initcall 0xc000e6b0: ptrace_break_init+0x0/0x2c()

initcall 0xc000e6b0: ptrace_break_init+0x0/0x2c() returned 0.

initcall 0xc000e6b0 ran for 0 msecs: ptrace_break_init+0x0/0x2c()

Calling initcall 0xc000f3ec: consistent_init+0x0/0xc0()

initcall 0xc000f3ec: consistent_init+0x0/0xc0() returned 0.

initcall 0xc000f3ec ran for 0 msecs: consistent_init+0x0/0xc0()

Calling initcall 0xc0017c04: deadline_init+0x0/0x20()

<6>io scheduler deadline registered

initcall 0xc0017c04: deadline_init+0x0/0x20() returned 0.

initcall 0xc0017c04 ran for 3 msecs: deadline_init+0x0/0x20()

Calling initcall 0xc0017dac: ts72xx_lcd_init+0x0/0x28()

<–hangs here–>

 

So we can now see that it hangs at the ts72xx_lcd_init() function. Naturally: the LCD hardware is not attached. Once attached, it continues to boot successfully!

(although it does seem to wait for abt 4 min at one point…):

Calling initcall 0xc001d318: inet_init+0x0/0x2ec()

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

initcall 0xc001d318: inet_init+0x0/0x2ec() returned 0.

initcall 0xc001d318 ran for 140 msecs: inet_init+0x0/0x2ec()

Calling initcall 0xc000e030: populate_rootfs+0x0/0xe8()

initcall 0xc000e030: populate_rootfs+0x0/0xe8() returned 0.

initcall 0xc000e030 ran for 1 msecs: populate_rootfs+0x0/0xe8()

Calling initcall 0xc000f1cc: timer_init_sysfs+0x0/0x40()

initcall 0xc000f1cc: timer_init_sysfs+0x0/0x40() returned 0.

initcall 0xc000f1cc ran for 1 msecs: timer_init_sysfs+0x0/0x40()

Calling initcall 0xc0014d58: ashmem_init+0x0/0xbc() << ashmem – android specific >>

ashmem: initialized

initcall 0xc0014d58: ashmem_init+0x0/0xbc() returned 0.

initcall 0xc0014d58 ran for 3 msecs: ashmem_init+0x0/0xbc()

Calling initcall 0xc0014e38: cpucache_init+0x0/0x1c()

initcall 0xc0014e38: cpucache_init+0x0/0x1c() returned 0.

initcall 0xc0014e38 ran for 0 msecs: cpucache_init+0x0/0x1c()

Calling initcall 0xc001742c: init_yaffs_fs+0x0/0xf0()

yaffs Jan 12 2009 10:39:16 Installing.

initcall 0xc001742c: init_yaffs_fs+0x0/0xf0() returned 0.

initcall 0xc001742c ran for 3 msecs: init_yaffs_fs+0x0/0xf0()

Calling initcall 0xc001751c: ipc_init+0x0/0x20()

initcall 0xc001751c: ipc_init+0x0/0x20() returned 0.

initcall 0xc001751c ran for 0 msecs: ipc_init+0x0/0x20()

Calling initcall 0xc0018e6c: ts_ser1_init+0x0/0x124()

initcall 0xc0018e6c: ts_ser1_init+0x0/0x124() returned -19.

initcall 0xc0018e6c ran for 0 msecs: ts_ser1_init+0x0/0x124()

Calling initcall 0xc0018f90: pl010_init+0x0/0x4c()

Serial: AMBA driver $Revision: 1.41 $

apb:uart1: ttyAM0 at MMIO 0x808c0000 (irq = 52) is a AMBA

console [ttyAM0] enabled

<6>apb:uart2: ttyAM1 at MMIO 0x808d0000 (irq = 54) is a AMBA

apb:uart2: ttyAM1 at MMIO 0x808d0000 (irq = 54) is a AMBA

<6>apb:uart3: ttyAM2 at MMIO 0x808e0000 (irq = 55) is a AMBA

apb:uart3: ttyAM2 at MMIO 0x808e0000 (irq = 55) is a AMBA

initcall 0xc0018f90initcall 0xc0018f90: pl010_init+0x0/0x4c(): pl010_init+0x0/0x4c() returned 0.

returned 0.

initcall 0xc0018f90 ran for 8493 msecs: initcall 0xc0018f90 ran for 8493 msecs: pl010_init+0x0/0x4c()

pl010_init+0x0/0x4c()

Calling initcall 0xc001910cCalling initcall 0xc001910c: pl011_init+0x0/0x4c(): pl011_init+0x0/0x4c()

 

<6>Serial: AMBA PL011 UART driver

Serial: AMBA PL011 UART driver

initcall 0xc001910cinitcall 0xc001910c: pl011_init+0x0/0x4c(): pl011_init+0x0/0x4c() returned 0.

returned 0.

initcall 0xc001b578initcall 0xc001b578: pcf8574_init+0x0/0x20(): pcf8574_init+0x0/0x20() returned 0.

returned 0.

initcall 0xc001b578 ran for 524461 msecs: initcall 0xc001b578 ran for 524461 msecs: pcf8574_init+0x0/0x20()

pcf8574_init+0x0/0x20()

Calling initcall 0xc001b598Calling initcall 0xc001b598: pcf8591_init+0x0/0x48(): pcf8591_init+0x0/0x48()

 

<7>i2c-core: driver [pcf8591] registered

<7>i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x48

<7>i2c-adapter i2c-0: master_xfer[0] W, addr=0x48, len=0

<7>i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x49

<7>i2c-adapter i2c-0: master_xfer[0] W, addr=0x49, len=0

<7>i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4a

<7>i2c-adapter i2c-0: master_xfer[0] W, addr=0x4a, len=0

<7>i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4b

<7>i2c-adapter i2c-0: master_xfer[0] W, addr=0x4b, len=0

<7>i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4c

<7>i2c-adapter i2c-0: master_xfer[0] W, addr=0x4c, len=0

<7>i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4d

<7>i2c-adapter i2c-0: master_xfer[0] W, addr=0x4d, len=0

<7>i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4e

<7>i2c-adapter i2c-0: master_xfer[0] W, addr=0x4e, len=0

<7>i2c-adapter i2c-0: found normal entry for adapter 0, addr 0x4f

<7>i2c-adapter i2c-0: master_xfer[0] W, addr=0x4f, len=0

initcall 0xc001b598initcall 0xc001b598: pcf8591_init+0x0/0x48(): pcf8591_init+0x0/0x48() returned 0.

returned 0.

initcall 0xc001b598 ran for 262241 msecs: initcall 0xc001b598 ran for 262241 msecs: pcf8591_init+0x0/0x48()

 

<< ~ 262 sec >>

 

pcf8591_init+0x0/0x48()

Calling initcall 0xc001b670Calling initcall 0xc001b670: ts72xx_wdt_init+0x0/0x1c(): ts72xx_wdt_init+0x0/0x1c()

<6>ts72xx_wdt: TS-72xx watchdog driver, v0.2

ts72xx_wdt: TS-72xx watchdog driver, v0.2

initcall 0xc001b670initcall 0xc001b670: ts72xx_wdt_init+0x0/0x1c(): ts72xx_wdt_init+0x0/0x1c() returned 0.

returned 0.

initcall 0xc001b670 ran for 10 msecs: initcall 0xc001b670 ran for 10 msecs: ts72xx_wdt_init+0x0/0x1c()

ts72xx_wdt_init+0x0/0x1c()

Calling initcall 0xc001ea18Calling initcall 0xc001ea18: ip_auto_config+0x0/0xe0c(): ip_auto_config+0x0/0xe0c()

 

initcall 0xc001ea18initcall 0xc001ea18: ip_auto_config+0x0/0xe0c(): ip_auto_config+0x0/0xe0c() returned 0.

returned 0.

initcall 0xc001ea18 ran for 0 msecs: initcall 0xc001ea18 ran for 0 msecs: ip_auto_config+0x0/0xe0c()

ip_auto_config+0x0/0xe0c()

VFS: Cannot open root device “hda1” or unknown-block(0,0)

VFS: Cannot open root device “hda1” or unknown-block(0,0)

Please append a correct “root=” boot option; here are the available partitions:

Please append a correct “root=” boot option; here are the available partitions:

0100 8192 ram00100 8192 ram0 (driver?)

(driver?)

0101 8192 ram10101 8192 ram1 (driver?)

(driver?)

0102 8192 ram20102 8192 ram2 (driver?)

(driver?)

0103 8192 ram30103 8192 ram3 (driver?)

(driver?)

0104 8192 ram40104 8192 ram4 (driver?)

(driver?)

0105 8192 ram50105 8192 ram5 (driver?)

(driver?)

0106 8192 ram60106 8192 ram6 (driver?)

(driver?)

010f 8192 ram15010f 8192 ram15 (driver?)

(driver?)

<0>Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

 

 

Yes. RFS does not mount as it’s an incorrect image for 2.6.

So upto that, the port is done!!

(And yes, the TS72xx heartbeat driver does work).

 

ToDo-

  • try to get rid of the long delay – check the reason; PCF8591 device not present, likely…

  • put in an android RFS image and try…
<!– @page { size: 21cm 29.7cm; margin: 2cm } P { margin-bottom: 0.21cm } –> 

 

i.e.

2.6.24.4 –> 2.6.24.4-ts72xx –> 2.6.25-ts72xx

2.6.25 –> 2.6.25-android-r1 –> 2.6.25-ts72xx-android-r1

Advertisements

One thought on “Porting Android kernel to the TS-72xx board (EP93xx)”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s