首页 > 编程学习 > 收藏:魅族M8 Android内核源码和固件下载
20107 月1

收藏:魅族M8 Android内核源码和固件下载

魅族官方提供了M8的Android内核源码,包含了完整的驱动以及说明,由于MEIZU M8的物理硬件和iPhone一样平时操作的只有1个Home键无法模拟,Android的Back、Menu以及其他因素魅族放弃了M8跑Android的计划。由于M8使用的是Samsung ARM11内核的S3C6410工作频率为667MHz,山寨厂商有一定的借鉴价值。

  有关魅族M8的ADB驱动 http://m8-android-kernel.googlecode.com/files/M8_6410_adb_driver.rar

  M8的Android编译好固件下载,刷机方法和Wince的一致,下载后直接解压放到USB Storage的根目录 http://code.google.com/p/m8-android-kernel/source/browse/bin/m8_android.rar 

  M8 for Android源码托管在Google Code上面,使用SVN工具直接提取 浏览地址 http://code.google.com/p/m8-android-kernel/source/browse/#svn/trunk 需要注意的是Android开发网发现有关Modem这块代码没有,涉及到了英飞凌的机密,不过可以看到编译好的库,直接挂上即可。

  SVN Checkout地址 http://m8-android-kernel.googlecode.com/svn/trunk

  最后是Android123找到的有关M8的移植文章网上整理的word文档,有兴趣的网友可以DIY下,不过Android开发网表示Android和M8原始的Wince比较差距较大,个人还是建议使用完善的WinCE系统,毕竟可以直播RMVB、WinCE对于M8更适合些。

  1. make menuconfig

A. 串口改成串口3输出打印信息。 (一) (root=/dev/nfs init=/init nfsroot=192.168.1.10:/nfs ip=192.168.1.100 console=ttySAC2,115200 console=ttySAC2,串口2输出,必须与下面同时修改 (二) System Type  —>S3C UART to use for low-level messages—>2 值设成2,即串口2输出,必须与上面同时修改。

B. Onenand驱动支持 (一) Device Drivers  —>Memory Technology Device (MTD) support  —>OneNAND Device Support  —> []   Verify OneNAND page writes                                 <>   OneNAND Flash device via platform device driver (二) onenand的支持 从贺超提供的linux2.6.27包drivers\mtd\onenand目录复制s3c6410.h,s3c_onenand.c,s3c_onenand.h提供对三星onenand的支持 (三) Makefile修改 drivers\mtd\onenand\Makefile文件最后添加一行:onenand-objs = s3c_onenand.o,编译s3c_onenand.o,连接进内核。 (四) 在arch\arm\mach-s3c6410\mach-smdk6410.c中   static struct platform_device pmem_gpu1_device = {  .name = “android_pmem”,  .id = 1,  .dev = { .platform_data = &pmem_gpu1_pdata }, }; #endif 的后面添加代码: /add by liuyihui 2009-08-21/ / 添加onenand驱动支持 / / OneNAND Controller / / OneNAND flash controller / #define S3C64XX_PA_ONENAND     (0x70100000) #define S3C64XX_SZ_ONENAND     SZ_1M static struct resource s3c_onenand_resource[] = {  [0] = {   .start = S3C64XX_PA_ONENAND,   .end   = S3C64XX_PA_ONENAND + S3C64XX_SZ_ONENAND – 1,   .flags = IORESOURCE_MEM,  } }; 或者替换新的代码:  arch\arm\plat-s3c64xx\devs.c, linux/arch/arm/mach-s3c6400/include/mach/map.h struct platform_device s3c_device_onenand = {  .name    = “onenand”,  .id    = -1,  .num_resources   = ARRAY_SIZE(s3c_onenand_resource),  .resource   = s3c_onenand_resource,  .dev.platform_data = &s3c_nand_mtd_part_info }; /add end/ 在数组static struct platform_device smdk6410_devices[] __initdata = {的最后添加:  &s3c_device_onenand /add by liuyihui 2009-08-21/ (五) 分区表修改:使userdata从0x0a000000开始 文件linux/arch/arm/plat-s3c/include/plat/partition.h中:           {                 .name  = “cache”,                 .offset  = MTDPART_OFS_APPEND,                 .size  = (67SZ_1M)+0x1000000,//orig:(67SZ_1M)/modified by cefanty 2009-08-21/         },   (六) 修改drivers\mtd\onenand\generic.c 复制drivers\mtd\onenand\generic.c替换掉。  

C. Device Drivers  —>Input device support  —>  []   Keyboards  —> (一) 暂时去掉键盘支持,因为键盘占用了GPK14口,GPK14口在M8是USB供电开关的GPIO,拉高才能用USB

D. Device Drivers  —> [] USB support  —>  <>   USB Gadget Support  —> (一) <>   USB Gadget Drivers (Ethernet Gadget (with CDC Ethernet supp (二) Ethernet Gadget (with CDC Ethernet support)              (三) [ ]       RNDIS support (四) d.1)选择Ethernet Gadget (with CDC Ethernet supp,用于把M8模拟成网卡,实现nfs挂载系统。同时去掉RNDIS support支持,因为ubuntu下没有驱动支持。 (五) drivers\usb\gadget\s3c-udc-otg-hs.c修改为USB使用外部晶振   //writel(0x20, S3C_USBOTG_PHYCLK); /commented by liuyihui 2009-08-24/ writel(0x00, S3C_USBOTG_PHYCLK);  /00:USB使用外部晶振。modified by liuyihui 2009-08-24*/

2. 驱动移植和修改

A. LCD驱动移植 i. drivers\video\Kconfig,搜索config FB_S3C_LTS222QV,在后面添加如下选项 config FB_S3C_LMS340KC01  bool “LMS340KC01”  —help—  TBA ii. 添加驱动:drivers\video\samsung\s3cfb_lms340kc01.c   a) 复制刘奕辉开发的s3cfb_lms340kc01.c驱动到目录drivers\video\samsung\ b) 在drivers\video\samsung\Makefile文件最后添加内容: obj-$(CONFIG_FB_S3C_LMS340KC01) += s3cfb_lms340kc01.o iii. 修改drivers\video\samsung\s3cfb_fimd4x.c,在函数s3cfb_set_gpio最后注释代码,添加:  

#if 0/commented by liuyihui 2009-08-24/  / module reset /  if (gpio_is_valid(S3C64XX_GPN(5))) {   err = gpio_request(S3C64XX_GPN(5), “GPN”);

  if (err) {    printk(KERN_ERR “failed to request GPN for ”     “lcd reset control\n”);    return err;   }

  gpio_direction_output(S3C64XX_GPN(5), 1);  }

 mdelay(100);

 gpio_set_value(S3C64XX_GPN(5), 0);  mdelay(10);

 gpio_set_value(S3C64XX_GPN(5), 1);  mdelay(10);

 gpio_free(S3C64XX_GPF(15));  gpio_free(S3C64XX_GPN(5)); #endif

/add by liuyihui 2009-08-24/ / 打开M8 LCD需要用到的GPIO口 / #if 1 //M8 GPIO set hight  / module reset ///LCD_nRESET_SHIFT/4*/  if (gpio_is_valid(S3C64XX_GPQ(4))) {   err = gpio_request(S3C64XX_GPQ(4), “GPQ”);

  if (err) {    printk(KERN_ERR “failed to request GPQ for ”     “lcd reset control\n”);    return err;   }   gpio_direction_output(S3C64XX_GPQ(4), 1);  }  mdelay(100);  gpio_free(S3C64XX_GPQ(4));

 / module reset ///LCD_nSS_SHIFT/5/  if (gpio_is_valid(S3C64XX_GPQ(5))) {   err = gpio_request(S3C64XX_GPQ(5), “GPQ”);

  if (err) {    printk(KERN_ERR “failed to request GPQ for ”     “lcd reset control\n”);    return err;   }   gpio_direction_output(S3C64XX_GPQ(5), 0);  }  mdelay(100);  gpio_free(S3C64XX_GPQ(5));     / module reset ///LCD_MOSI_SHIFT/7/  if (gpio_is_valid(S3C64XX_GPQ(6))) {   err = gpio_request(S3C64XX_GPQ(6), “GPQ”);

  if (err) {    printk(KERN_ERR “failed to request GPQ for ”     “lcd reset control\n”);    return err;   }   gpio_direction_output(S3C64XX_GPQ(6), 1);  }  mdelay(100);  gpio_free(S3C64XX_GPQ(6));     / module reset ///LCD_MOSI_SHIFT/7/  if (gpio_is_valid(S3C64XX_GPQ(7))) {   err = gpio_request(S3C64XX_GPQ(7), “GPQ”);

  if (err) {    printk(KERN_ERR “failed to request GPQ for ”     “lcd reset control\n”);    return err;   }   gpio_direction_output(S3C64XX_GPQ(7), 1);  }  mdelay(100);  gpio_free(S3C64XX_GPQ(7));    / module reset ///LCD_CLK_SHIFT/8/  if (gpio_is_valid(S3C64XX_GPQ(8))) {   err = gpio_request(S3C64XX_GPQ(8), “GPQ”);

  if (err) {    printk(KERN_ERR “failed to request GPQ for ”     “lcd reset control\n”);    return err;   }   gpio_direction_output(S3C64XX_GPQ(8), 1);  }  mdelay(100);  gpio_free(S3C64XX_GPQ(8));

#endif

 return 0; } /add end/ c)  iv. 修改drivers\video\samsung\s3cfb_spi.c,在函数s3cfb_set_gpio最后注释代码,添加:   在代码#elif defined(CONFIG_PLAT_S3C64XX)后面添加:

#define MEIZU_M8 #ifdef MEIZU_M8 #define S3C_FB_SPI_CLK(x) (S3C64XX_GPQ(8 + ( 4))) #define S3C_FB_SPI_MOSI(x) (S3C64XX_GPQ(7 + (4))) #define S3C_FB_SPI_CS(x) (S3C64XX_GPQ(6 + (4))) #else #define S3C_FB_SPI_CLK(x) (S3C64XX_GPC(1 + (ch 4))) #define S3C_FB_SPI_MOSI(x) (S3C64XX_GPC(2 + (ch 4))) #define S3C_FB_SPI_CS(x) (S3C64XX_GPC(3 + (ch * 4))) #endif

B. 触摸屏移植 drivers\input\touchscreen:synaptics510_i2c.c,synaptics510_i2c.h,Makefile,Kconfig        C. 按键移植 覆盖如下文件:目录drivers\input\keyboard\下的:gpio_keys.c  

3. Busybox在Android上的使用

To build busybox • Download the latest version of busybox from the following website. At the time of writing the latest version was v.1.13.3. http://www.busybox.net • Extract the busybox source: tar jxf busybox-1.13.3.tar.bz2 • Configure busybox by running menuconfig cd busybox-1.13.3/ make menuconfig • In menuconfig set the following options Busybox Settings –> Build Options –> Build Busybox as a static binary (no shared libs)  –  Enable this option by pressing “Y” Busybox Settings –> Build Options –> Cross compiler prefix  –  Set this option equal to “arm-none-linux-gnueabi-” Busybox Settings –> Installation Options –> Don’t use /usr  –  Enable this option by pressing “Y” Linux Module Utilities  —>  [ ] Simplified modutils 这项不能选,否则insmod 驱动模块加载会提示找不到*.ko驱动文件的路径 • Export path to where the cross-compiler is located on the host, for example: export PATH=/opt/arm/arm-2007q3/bin:$PATH • Build busybox make   Installing Busybox


To install busybox in the target file-system • Create a /bin directory in the target file-system. For example: mkdir //bin • Copy the busybox binary to the /bin directory in the target file-system cp busybox //bin •  Install the busybox command line tools on the target by executing the following commands: cd /bin ./busybox –install   Make the Busybox shell the default shell


To make the busybox shell the default shell, edit the file “init.rc” in the target file-system as follows: • Edit the console service so that it runs the busybox shell and not the default shell by replacing: service console /system/bin/sh With: service console /bin/sh • Add the path of the busybox command line tools to the system path variable by replacing: export PATH /sbin:/system/sbin:/system/bin:/system/xbin With export PATH /bin:/sbin:/system/sbin:/system/bin:/system/xbin

Android cupcake 1.5版移植

1. 在Android挂载SD移植

cupcake 1.5版需要改写下列文件。

A.    编译mountd,并在文件系统中启动这一服务。

   修改 system/core/mountd/Android.mk文件,开放最后一行

    # disabled – we are using vold now instead     # include $(BUILD_EXECUTABLE)     为:

    # disabled – we are using vold now instead     include $(BUILD_EXECUTABLE)

B.     增加 安装mountd.conf 文件

      修改 system/core/rootdir/init.rc文件

   释放下两行:

     service mountd /system/bin/mountd           socket mountd stream 0660 root mount C.     修改  system/core/rootdir/Android.mk 文件, 增加 etc/mountd.conf \,如下:

    copy_from := \        etc/dbus.conf \        etc/init.goldfish.sh \        etc/mountd.conf \        etc/hosts D. 修改根文件系统的system\etc \mountd.conf文件: block_device    /dev/block/mmcblk0

本文地址:https://wizzer.cn/archives/112 , 转载请保留.

本文目前尚无任何评论.

发表评论