[[Software/Virtual Platform/Android]] ~ こちらは''CentOS 4''での作業になります。~ * Android 対応にしたKernelの変更点 [#ged8483f] ubuntu8.04上でOpen Source版Androidをgitリポジトリから取得し、~ その中にあるkernelをCentOS 4へコピーして ~ workingディレクトリに置き作業します。~ Android Kernel version は2.6.27です。~ ARM926EJS-CoWareVP-VersatilePB-Addon-Vanilla-SW.tgzに含まれる ~ VP用 kernelとの差分を調査し、その部分を加えます。~ さらに、調整を加えました。~ ここでの記述はVirtual PlatformのLCDの解像度~ 320x240用の作業を記しています。~ Virtual PlatformのLCD解像度640x480でも動作を確認していますが、記述していません。~ (参考)~ VP用 kernel はARM926EJS-CoWareVP-VersatilePB-Addon-Vanilla-SW.tgzを展開すると~ ~/ARM926EJS-CoWareVP-VersatilePB-SingleCore-Free-1.04/other/vanilla/software/linux-2.6.23-eabi 以下にあります。 ** kerenlソースファイル変更点 [#zc520862] kernelソースファイルの変更点は以下のようになります。 - kernel/arch/arm/mach-versatile/core.c の修正 ~ @@ -176,14 +176,14 @@ .type = MT_DEVICE }, #endif -#ifdef CONFIG_DEBUG_LL + //#ifdef CONFIG_DEBUG_LL { .virtual = IO_ADDRESS(VERSATILE_UART0_BASE), .pfn = __phys_to_pfn(VERSATILE_UART0_BASE), .length = SZ_4K, .type = MT_DEVICE }, -#endif + //#endif #ifdef CONFIG_PCI { .virtual = IO_ADDRESS(VERSATILE_PCI_CORE_BASE), @@ -237,15 +243,18 @@ * long as there is always less than 89 seconds between successive * calls to this function. */ +unsigned long long __sim_clock=0; unsigned long long sched_clock(void) { +#if 0 unsigned long long v = cnt32_to_63(readl(VERSATILE_REFCOUNTER)); /* the <<1 gets rid of the cnt_32_to_63 top bit saving on a bic insn */ v *= 125<<1; do_div(v, 3<<1); return v; +#endif + return __sim_clock+=100; } @@ -731,24 +736,27 @@ AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL); static struct amba_device *amba_devs[] __initdata = { - &dmac_device, &uart0_device, &uart1_device, &uart2_device, - &smc_device, - &mpmc_device, &clcd_device, - &sctl_device, - &wdog_device, + &dmac_device, &gpio0_device, &gpio1_device, + &wdog_device, &rtc_device, - &sci0_device, &ssp0_device, - &aaci_device, - &mmc0_device, &kmi0_device, &kmi1_device, + +#ifdef FULL_VERSATILE + &smc_device, + &mpmc_device, + &sctl_device, + &sci0_device, + &aaci_device, + &mmc0_device, +#endif }; #ifdef CONFIG_LEDS @@ -793,13 +799,13 @@ void __init versatile_init(void) { int i; + platform_device_register(&smc91x_device); clk_register(&versatile_clcd_clk); +#ifdef FULL_VERSATILE platform_device_register(&versatile_flash_device); platform_device_register(&versatile_i2c_device); - platform_device_register(&smc91x_device); +#endif for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i]; amba_device_register(d, &iomem_resource); @@ -821,12 +828,13 @@ /* * How long is the timer interval? */ -#define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10) +#define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10*10000) #if TIMER_INTERVAL >= 0x100000 #define TIMER_RELOAD (TIMER_INTERVAL >> 8) #define TIMER_DIVISOR (TIMER_CTRL_DIV256) #define TICKS2USECS(x) (256 * (x) / TICKS_PER_uSEC) #elif TIMER_INTERVAL >= 0x10000 #define TIMER_RELOAD (TIMER_INTERVAL >> 4) /* Divide by 16 */ #define TIMER_DIVISOR (TIMER_CTRL_DIV16) #define TICKS2USECS(x) (16 * (x) / TICKS_PER_uSEC) @@ -846,9 +852,10 @@ switch(mode) { case CLOCK_EVT_MODE_PERIODIC: writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_LOAD); ctrl = TIMER_CTRL_PERIODIC; ctrl |= TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ENABLE; + ctrl=0xe0; break; case CLOCK_EVT_MODE_ONESHOT: /* period set, and timer enabled in 'next_event' hook */ @@ -951,6 +953,18 @@ writel(0, TIMER1_VA_BASE + TIMER_CTRL); writel(0, TIMER2_VA_BASE + TIMER_CTRL); writel(0, TIMER3_VA_BASE + TIMER_CTRL); + + writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_LOAD); + writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_VALUE); + writel(TIMER_DIVISOR | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC | + TIMER_CTRL_IE, TIMER0_VA_BASE + TIMER_CTRL); + + writel(0, TIMER3_VA_BASE + TIMER_CTRL); + writel(0xffffffff, TIMER3_VA_BASE + TIMER_LOAD); + writel(0xffffffff, TIMER3_VA_BASE + TIMER_VALUE); + writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC, + TIMER3_VA_BASE + TIMER_CTRL); + /* * Make irqs happen for the system timer - kernel/arch/arm/kernel/entry-common.S の修正~ @@ -13,7 +13,20 @@ #include "entry-header.S" + + + /* See include/asm/threadinfo.h + * offset of task_struct in thread_info */ + .set coware_swa_task_struct_offset, 0xc + /* See include/linux/sched.h + * offset of pid in task_struct */ + .set coware_swa_pid_offset, 0xd4 + /* See include/linux/sched.h + * offset of comm in task_struct */ + .set coware_swa_comm_offset, 0x1c4 + + .align 5 /* * This is the fast syscall return path. We do as little as - kernel/arch/arm/mach-versatile/versatile_pb.c の修正~ @@ -74,11 +74,13 @@ AMBA_DEVICE(gpio3, "dev:e7", GPIO3, NULL); static struct amba_device *amba_devs[] __initdata = { +#ifdef FULL_VERSATILE &uart3_device, &gpio2_device, &gpio3_device, &sci1_device, &mmc1_device, +#endif }; - kernel/drivers/char/tty_io.c の修正 ~ @@ -2204,7 +2204,7 @@ extern struct tty_driver *console_driver; driver = console_driver; index = fg_console; - noctty = 1; + noctty = 0; goto got_driver; } #endif @@ -2216,7 +2216,7 @@ if (driver) { /* Don't let /dev/console block */ filp->f_flags |= O_NONBLOCK; - noctty = 1; + noctty = 0; goto got_driver; } mutex_unlock(&tty_mutex); @@ -2238,7 +2238,7 @@ check_tty_count(tty, "tty_open"); if (tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER) - noctty = 1; + noctty = 0; #ifdef TTY_DEBUG_HANGUP printk(KERN_DEBUG "opening %s...", tty->name); #endif - kernel/arch/arm/mach-versatile/include/mach/debug-macro.S の修正 ~ @@ -17,7 +17,7 @@ moveq \rx, #0x10000000 movne \rx, #0xf1000000 @ virtual base orr \rx, \rx, #0x001F0000 - orr \rx, \rx, #0x00001000 + orr \rx, \rx, #0x00002000 .endm #include <asm/hardware/debug-pl01x.S> - kernel/arch/arm/mach-versatile/include/mach/platform.h ~ @@ -33,12 +33,12 @@ #define VERSATILE_SSRAM_SIZE SZ_2M #define VERSATILE_FLASH_BASE 0x34000000 -#define VERSATILE_FLASH_SIZE SZ_64M +#define VERSATILE_FLASH_SIZE SZ_16M /* * SDRAM */ -#define VERSATILE_SDRAM_BASE 0x00000000 +#define VERSATILE_SDRAM_BASE 0x4000000 /* * Logic expansion modules @@ -241,7 +241,7 @@ #define VERSATILE_PCI_MEM_BASE1_SIZE 0x10000000 /* 256Mb */ #define VERSATILE_PCI_MEM_BASE2_SIZE 0x10000000 /* 256Mb */ -#define VERSATILE_SDRAM67_BASE 0x70000000 /* SDRAM banks 6 and 7 */ +#define VERSATILE_SDRAM67_BASE 0x8000000 /* SDRAM banks 6 and 7 */ #define VERSATILE_LT_BASE 0x80000000 /* Logic Tile expansion */ /* @@ -318,7 +318,7 @@ #define INT_COMMRx 2 /* Debug Comm Rx interrupt */ #define INT_COMMTx 3 /* Debug Comm Tx interrupt */ #define INT_TIMERINT0_1 4 /* Timer 0 and 1 */ -#define INT_TIMERINT2_3 5 /* Timer 2 and 3 */ +#define INT_TIMERINT2_3 4 /* Timer 2 and 3 */ #define INT_GPIOINT0 6 /* GPIO 0 */ #define INT_GPIOINT1 7 /* GPIO 1 */ #define INT_GPIOINT2 8 /* GPIO 2 */ - kernel/init/calibrate.c の修正 ~ @@ -115,6 +115,7 @@ { unsigned long ticks, loopbit; int lps_precision = LPS_PREC; + return ; if (preset_lpj) { loops_per_jiffy = preset_lpj; - kernel/net/ipv4/ipconfig.c の修正 ~ @@ -115,7 +115,7 @@ */ int ic_set_manually __initdata = 0; /* IPconfig parameters set manually */ -static int ic_enable __initdata = 0; /* IP config enabled? */ +static int ic_enable __initdata = 1; /* IP config enabled? */ /* Protocol choice */ int ic_proto_enabled __initdata = 0 - kernel/kernel/sched.c の修正 ~ @@ -70,6 +70,15 @@ #include <asm/tlb.h> #include <asm/irq_regs.h> +/* Symbols to enable CoWare SWA */ +/* offset of task_struct in thread_info */ +char coware_swa_task_struct_offset[(int) &((struct thread_info*) 0)->task]; +/* offset of pid in task_struct */ +char coware_swa_pid_offset[(int) &((struct task_struct*) 0)->pid]; +/* offset of comm in task_struct */ +char coware_swa_comm_offset[(int) &((struct task_struct*) 0)->comm]; + + - drivers/input/mouse/touchkit_ps2.c ~ @@ -35,8 +35,13 @@ #include "psmouse.h" #include "touchkit_ps2.h" -#define TOUCHKIT_MAX_XC 0x07ff -#define TOUCHKIT_MAX_YC 0x07ff + +// Changed for Android: +#define TOUCHKIT_MAX_XC 320 +#define TOUCHKIT_MAX_YC 240 + (これは画像サイズ320x240の場合) #define TOUCHKIT_CMD 0x0a #define TOUCHKIT_CMD_LENGTH 1 @@ -85,6 +93,7 @@ return -ENODEV; if (set_properties) { + printk(KERN_WARNING "touchkit_ps2.c:Patched resolution to work with Android.\n"); dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); set_bit(BTN_TOUCH, dev->keybit); input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); ** PATH [#h95c43bd] ~/ARM926EJS-CoWareVP-VersatilePB-SingleCore-Free-1.04/other/vanilla/tools/arm-eabi-4.2.1/ 以下にtoolchainがありますので、そこにPATHを追加します。 export PATH=$PATH:~/ARM926EJS-CoWareVP-VersatilePB-SingleCore-Free-1.04/other/vanilla/tools/arm-eabi-4.2.1/bin ** config [#o58f0779] &ref(VP-android.config); 添付されているVP-android.configを.configにリネームし~ &ref(VPandroid.config); ~ 添付されているVPandroid.configを.configにリネームし~ make oldconfig ARCH=arm を実行します。~ menuconfigでCPU TYPEがARM versatileになっていることを~ 確認してください。~ make menuconfig ARCH=arm ** ビルド [#cc060ca9] 上記の設定が終了すればビルドします。~ make CROSS_COMPILE=arm-eabi- ARCH=arm ** 配置 [#e71153e0] インストールされているVirtual PlatfromのskinをコピーしAndroid用の環境にします。~ ~/ARM926EJS-CoWareVP-VersatilePB-SingleCore-Free-1.04/skin/Vanilla をコピーします。~ $ cd ~/ARM926EJS-CoWareVP-VersatilePB-SingleCore-Free-1.04/skin $ cp -afr Vanilla Vanilla-Android-320x240 作業したkernelのディレクトリに移動し以下のファイルをVanilla-Android/sim内にコピーします。~ $ cd {workDir}/kernel $ cp vmlinux ~/ARM926EJS-CoWareVP-VersatilePB-SingleCore-Free-1.04/skin/Vanilla-Android-320x240/sim $ cp arch/arm/boot/zImage ~/ARM926EJS-CoWareVP-VersatilePB-SingleCore-Free-1.04/skin/Vanilla-Android/sim $ cp arch/arm/boot/compressed/vmlinux ~/ARM926EJS-CoWareVP-VersatilePB-SingleCore-Free-1.04/skin/Vanilla-Android/sim/vmlinux_compressed (vmlinux_compressedへリネームしてください) 以上で、kernelでの変更点は終了です。~