Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2165032
  • 博文数量: 438
  • 博客积分: 3871
  • 博客等级: 中校
  • 技术积分: 6075
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-10 00:11
个人简介

邮箱: wangcong02345@163.com

文章分类

全部博文(438)

文章存档

2017年(15)

2016年(119)

2015年(91)

2014年(62)

2013年(56)

2012年(79)

2011年(16)

分类: Android平台

2015-04-15 14:10:34

一. MTK6592的modem在ubuntu14.04 64位下的编译
1.要改动的文件
MTK6592的modem推荐的编译环境是ubuntu10.04 64位
要想在ubuntu 14.04 64位下编译需要改的文件是
  1. cong@msi:/work/mtk/bak/MT92_WE_JB9_MD1_GPRS_MD1_HSPA$ git status
  2.     modified: make.sh
  3.     modified: make/build.mak
  4.     modified: make/cmd_cfg.mak
  5.     modified: tools/NVRAMStatistic/nvram_auto_gen.mak
  6.     modified: tools/NVRAMStatistic/src/nvram_auto_gen.c
  7.     modified: tools/NVRAMStatistic/src/nvram_gen_util.c
a.原先shell中if字符串的判断的写法是 ==,ub14.04上是=,所以会导致编译不通过
b.gcc的路径不对,nvram_auto_gen.mak中ub10.40是/usr/bin/gcc-4.4而现在是/usr/bin/gcc-4.8
c.代码文件中#include不需要了
d.主要更改如下所示:
  1. diff --git a/make.sh b/make.sh
  2. index 83c9f70..eafcfd3 100755
  3. --- a/make.sh
  4. +++ b/make.sh
  5. @@ -35,7 +35,7 @@
  6.  #
  7.  export NUMBER_OF_PROCESSORS=`cat /proc/cpuinfo | grep 'processor' | wc -l`
  8.  export USERNAME=$LOGNAME
  9. -if [ "$MTK_INTERNAL" == "TRUE" ] && [ "$MTK_CF" != "TRUE" ]; then
  10. +if [ "$MTK_INTERNAL" = "TRUE" ] && [ "$MTK_CF" != "TRUE" ] ; then
  11.      molyq perl make.pl $*
  12.  else
  13.      perl make.pl $*
  14. diff --git a/make/build.mak b/make/build.mak
  15. index c888c11..011cb6f 100755
  16. --- a/make/build.mak
  17. +++ b/make/build.mak
  18. @@ -737,7 +737,7 @@ remake : backup bootloader done
  19.    else
  20.  remake : backup genlog cleanbin genverno libs $(BIN_FILE) cmmgen cfggen done
  21.    endif
  22. -else # MODIS_CONFIG == TRUE
  23. +else # MODIS_CONFIG = TRUE
  24.  remake : genlog cleanbin genverno
  25.  endif #ifneq ($(strip $(MODIS_CONFIG)),TRUE)
  26.  
  27. @@ -3045,7 +3045,6 @@ ifneq ($(strip $(MODIS_CONFIG)),TRUE)
  28.      $(DONE)
  29.  endif
  30.  
  31. -
  32.  ifeq ($(strip $(REDUCE_HEADER_DEPTH)),TRUE)
  33.      @$(STRCMPEX) abc abc e $(strip $(TMPDIR))/~compbld_2.tmp INCDIRS = $(strip $(HEADER_TEMP)) $(strip $(COMMINCDIRS))
  34.  else
  35. @@ -3063,9 +3062,9 @@ endif
  36.      @$(ECHO) -n "ARM9_PLATFORM = $(strip $(ARM9_PLATFORM))" >> $(strip $(TMPDIR))/~compbld.tmp
  37.      @$(ECHO) -n "ARM11_PLATFORM = $(strip $(ARM11_PLATFORM))" >> $(strip $(TMPDIR))/~compbld.tmp
  38.      @$(ECHO) -n "CR4_PLATFORM = $(strip $(CR4_PLATFORM))" >> $(strip $(TMPDIR))/~compbld.tmp
  39. -    @$(IF_NOT) $(P_VAR)0$(COMPILER) == $(P_VAR)0 $(THEN) \
  40. +    @$(IF_NOT) $(P_VAR)0$(COMPILER) = $(P_VAR)0 $(THEN) \
  41.          $(ECHO) -n "COMPILER = $(COMPILER)" >> $(strip $(TMPDIR))/~compbld.tmp $(CMD_END)
  42. -    @$(IF_NOT) $(P_VAR)0$(HEADER_TEMP) == $(P_VAR)0 $(THEN) \
  43. +    @$(IF_NOT) $(P_VAR)0$(HEADER_TEMP) = $(P_VAR)0 $(THEN) \
  44.          $(ECHO) -n "HEADER_TEMP = $(strip $(HEADER_TEMP))" >> $(strip $(TMPDIR))/~compbld.tmp $(CMD_END)
  45.      @$(ECHO) -n "AUTO_MERGE_PTH = $(AUTO_MERGE_PTH)">> $(strip $(TMPDIR))/~compbld.tmp
  46.  
  47. diff --git a/make/cmd_cfg.mak b/make/cmd_cfg.mak
  48. index 470c716..76a709a 100644
  49. --- a/make/cmd_cfg.mak
  50. +++ b/make/cmd_cfg.mak
  51. @@ -80,7 +80,7 @@ IF_EXIST = if [ -e
  52.  IF_NOT = if [ !
  53.  IF_NOT_EXIST = if [ ! -e
  54.  IF_ERR_TRUE = if [ $$? != 0
  55. -IF_ERR_FALSE = if [ $$? == 0
  56. +IF_ERR_FALSE = if [ $$? = 0
  57.  THEN = ]; then
  58.  ELSE = ;else
  59.  CMD_END = ;fi
  60. diff --git a/tools/NVRAMStatistic/nvram_auto_gen.mak b/tools/NVRAMStatistic/nvram_auto_gen.mak
  61. index 9bd6330..926f8d9 100644
  62. --- a/tools/NVRAMStatistic/nvram_auto_gen.mak
  63. +++ b/tools/NVRAMStatistic/nvram_auto_gen.mak
  64. @@ -29,7 +29,7 @@ ifeq ($(strip $(OS_VERSION)),MSWin32)
  65.      override PATH := tools/MinGW/bin:${PATH}
  66.      export $(PATH)
  67.  else
  68. - GCC := "/usr/bin/gcc-4.4"
  69. + GCC := "/usr/bin/gcc-4.8"
  70.      LINKER_SCRIPT := tools/NVRAMStatistic/src/nvram_auto_gen_linux.txt
  71.      MV := mv
  72.  endif
  73. diff --git a/tools/NVRAMStatistic/src/nvram_auto_gen.c b/tools/NVRAMStatistic/src/nvram_auto_gen.c
  74. index 5d9bf53..0828dd1 100644
  75. --- a/tools/NVRAMStatistic/src/nvram_auto_gen.c
  76. +++ b/tools/NVRAMStatistic/src/nvram_auto_gen.c
  77. @@ -568,7 +568,7 @@
  78.  #include <stdio.h>
  79.  #include <stdarg.h>
  80.  #include <stdlib.h>
  81. -#include <io.h>
  82. +//#include <io.h>
  83.  #include <errno.h>
  84.  
  85.  #include "nvram_auto_gen.h"
  86. diff --git a/tools/NVRAMStatistic/src/nvram_gen_util.c b/tools/NVRAMStatistic/src/nvram_gen_util.c
  87. index ee97c84..9d49275 100644
  88. --- a/tools/NVRAMStatistic/src/nvram_gen_util.c
  89. +++ b/tools/NVRAMStatistic/src/nvram_gen_util.c
  90. @@ -313,7 +313,7 @@
  91.  #include <stdio.h>
  92.  #include <stdarg.h>
  93.  #include <stdlib.h>
  94. -#include <io.h>
  95. +//#include <io.h>
  96.  
  97.  #include "nvram_auto_gen.h"
  98.  #if defined(__MMI_FMI__)
2.调试方法主要是打印
perl中打印出行号与文件名
print "tmd:",__FILE__,"[",__LINE__,"]","\n";
print ("tmd:",__FILE__,"[",__LINE__,"]","\n");
Makefile的脚本中的打印
在规则内部用的是echo
@echo "tmd: Codegen.mak[613]: nvram_auto_gen"
在规则外部打印变量用的是warning
$(warning "tmd:build.mak L2505")
3. 编译流程
a. 简单分析
  1. ./make.sh MT92_WE_JB9_HSPA.mak new
  2.  --> perl make.pl $*
  3.  a. ckmake执行如下:
  4.  make -fmake/build.mak -r -R PROJECT_NAME=MT92_WE_JB9_HSPA PROJECT_MAKEFILE=build/MT92_WE_JB9_HSPA/DEFAULT/bin/~MT92_WE_JB9_HSPA.mak FLAVOR=DEFAULT ckmake
  5.  b. new
  6. make.pl[1095]0 = make -fmake/build.mak -r -R PROJECT_NAME=MT92_WE_JB9_HSPA PROJECT_MAKEFILE=build/MT92_WE_JB9_HSPA/DEFAULT/bin/~MT92_WE_JB9_HSPA.mak FLAVOR=DEFAULT new
只有这么一点了

二. 编译与烧写

1. 命令
  a. 编译 . readme build
  b. 烧写 . readme flash
  c. 导入dump的log:  . readme pull
  d. 清除dump的log:  . readme del
  1. #!/bin/sh
  2. build()
  3. {
  4.     ./make.sh MT92_WE_JB9_HSPA.mak new
  5. }
  6. flash()
  7. {
  8.     adb remount
  9.     adb push ./build/MT92_WE_JB9_HSPA/DEFAULT/bin/MT92_WE_JB9_HSPA_PCB01_MT6592_S00.MOLY_WR8_W1315_MD_WG_MP_V21_P11.bin /system/etc/firmware/modem_1_wg_n.img
  10.     adb shell sync
  11.     adb shell sync
  12.     rm -rf /tmp/MDLog*
  13.     adb shell rm -r /sdcard/mtklog/mdlog/*
  14.     adb shell ls -l /sdcard/mtklog/mdlog/
  15.     adb reboot
  16. }
  17. pull()
  18. {
  19.     rm -rf /tmp/MDLog*
  20.     adb pull /sdcard/mtklog/mdlog/ /tmp/
  21. }

  22. del()
  23. {
  24.     adb shell rm -r /sdcard/mtklog/mdlog/*
  25.     adb shell ls -l /sdcard/mtklog/mdlog/
  26. }

  27. case "$1" in
  28. flash)
  29.     flash
  30.     ;;
  31. build)
  32.     build
  33.     ;;
  34. del)
  35.     del
  36.     ;;
  37. pull)
  38.     pull
  39.     ;;
  40. esac
1.2 加强版
  1. cong@msi:/work/mtk/modem$ cat readme
  2. #!/bin/sh
  3. build()
  4. {
  5.     ./make.sh HQUNITED72_WE_72_KK_HSPA.mak new
  6.     cp ./build/HQUNITED72_WE_72_KK_HSPA/DEFAULT/bin/HQUNITED72_WE_72_KK_HSPA_PCB01_MT6572_S00.MOLY_WR8_W1315_MD_WG_MP_V36.bin /tmp/modem_1_wg_n.img
  7. }
  8. flash()
  9. {
  10.     adb remount
  11.     #adb push ./build/MT92_WE_JB9_HSPA/DEFAULT/bin/MT92_WE_JB9_HSPA_PCB01_MT6592_S00.MOLY_WR8_W1315_MD_WG_MP_V21_P11.bin /system/etc/firmware/modem_1_wg_n.img
  12.     adb push ./build/HQUNITED72_WE_72_KK_HSPA/DEFAULT/bin/HQUNITED72_WE_72_KK_HSPA_PCB01_MT6572_S00.MOLY_WR8_W1315_MD_WG_MP_V36.bin /system/etc/firmware/modem_1_wg_n.img
  13.     adb shell sync
  14.     adb shell sync
  15.     rm -rf /tmp/MDLog*
  16.     adb shell rm -r /sdcard/mtklog/mdlog/*
  17.     adb shell ls -l /sdcard/mtklog/mdlog/
  18.     adb reboot
  19. }
  20. pull()
  21. {
  22.     rm -rf /tmp/MDLog*
  23.     adb pull /sdcard/mtklog/mdlog/ /tmp/
  24. }

  25. del()
  26. {
  27.     adb shell rm -r /sdcard/mtklog/mdlog/*
  28.     adb shell ls -l /sdcard/mtklog/mdlog/
  29. }

  30. flashbak()
  31. {
  32.     adb remount
  33.     adb push /work/mtk/bak/MT92_WE_JB9_HSPA_PCB01_MT6592_S00.MOLY_WR8_W1315_MD_WG_MP_V21_P11.bin /system/etc/firmware/modem_1_wg_n.img
  34.     adb shell sync
  35.     adb shell sync
  36.     rm -rf /tmp/MDLog*
  37.     adb shell rm -r /sdcard/mtklog/mdlog/*
  38.     adb shell ls -l /sdcard/mtklog/mdlog/
  39.     adb reboot
  40. }

  41. case "$1" in
  42. flash)
  43.     flash
  44.     ;;
  45. fb)
  46.     flashbak
  47.     ;;
  48. build)
  49.     build
  50.     ;;
  51. del)
  52.     del
  53.     ;;
  54. pull)
  55.     pull
  56.     ;;
  57. esac
2. modem的log查看
a. modem的log查看用的工用是Catcher.exe,windows下用的
b. controls --> Open Dump File...
SetPath:
D:\mtk\tst\database\BPLGUInfoCustomAppSrcP_MT6592_S00_MOLY_WR8_W1315_MD_WG_MP_V21_P11
D:\mtk\tst\database
c. 进入工程模式
*#*#3646633#*#*

阅读(3572) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~