Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> Android開發 >> 高級開發 >> 魅族M8 Android內核源碼和固件下載

魅族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 = (67*SZ_1M)+0x1000000,//orig:(67*SZ_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 /<path-to-android-fs>/bin
• Copy the busybox binary to the /bin directory in the target file-system
cp busybox /<path-to-android-fs>/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

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved