編譯 Qualcomm modem (MSM8626)

原文: https://forum.xda-developers.com/android/software-hacking/dev-building-qualcomm-modem-sources-t3489833
 

1.安裝64位Ubuntu系統(實體安裝、虛擬機安裝均可)

 
2.更新系統至最新版本,在終端下輸入

  1. sudo apt-get update
  2. sudo apt-get upgrade
3.安裝編譯必需軟件包
  1. sudo apt-get install p7zip-full lib32z1 lib32ncurses5 scons libxml
4.建立目錄並下載程式碼
  1. mkdir msm8626
  2. cd msm8626
  3. git clone --branch "master" --progress -v "https://v2.pikacode.com/jsr-d10/qcom_msm8626_modem_proc.git" modem_proc
  4. git clone --branch "master" --progress -v "https://v2.pikacode.com/jsr-d10/qcom_msm8626_adsp_proc.git" adsp_proc
  5. git clone --branch "master" --progress -v "https://v2.pikacode.com/jsr-d10/qcom_msm8626_wcnss_proc.git" wcnss_proc
5.下載 HEXAGON Tools, 並解壓縮
  1. mkdir ~/msm8626/downloads
  2. wget https://v2.pikacode.com/remittor/qualcomm_hexagon_tools/raw/ht-6.4.06.a/hexagon_tools_6.4.06.a.7z -O downloads/hexagon_tools_6.4.06.a.7z
  3. 7za x -y -o$HOME/Qualcomm/HEXAGON_Tools downloads/hexagon_tools_6.4.06.a.7z
6.開始編譯 Modem
  1. cd ~/msm8626/modem_proc/build/ms/
  2. ./build.sh 8626.gen.prod BUILD_ID=AAAAANAZ -k
7.開始編譯 ADSP
  1. cd ~/msm8626/adsp_proc/build/ms/
  2. ./build.sh msm8x26 msm8x26_MPD BUILD_VER=1234 -k
8.下載 pil-splitter.py
  1. cd ~/msm8626/
  2. wget http://github.com/remittor/qcom-mbn-tools/raw/master/pil-splitter.py
9.將官方韌體中的 NON-HLOS.bin 改名為 NON-HLOS-BASE.bin
  1. mv NON-HLOS.bin NON-HLOS-BASE.bin
10.建立 makeimg.sh 內容如下
  1. cd `dirname $0`
  2. ROOTDIR=$(pwd)
  3. TMPDIR=mbn_images
  4. rm -rf $ROOTDIR/$TMPDIR
  5. mkdir -p $ROOTDIR/$TMPDIR
  6. cd $ROOTDIR/$TMPDIR
  7. MODEM_STK=$ROOTDIR/NON-HLOS-BASE.bin
  8. MODEM_NEW=$ROOTDIR/NON-HLOS.bin
  9. BUILD_ID=AAAAANAZ
  10. IMAGE_DIR=$ROOTDIR/modem_proc/build/ms/bin/$BUILD_ID
  11. python $ROOTDIR/pil-splitter.py $IMAGE_DIR/qdsp6sw.mbn modem
  12. python $ROOTDIR/pil-splitter.py $IMAGE_DIR/mba.mbn mba
  13. BUILD_ID=AAAAAAAA
  14. IMAGE_DIR=$ROOTDIR/adsp_proc/build/ms/bin/$BUILD_ID
  15. python $ROOTDIR/pil-splitter.py $IMAGE_DIR/dsp2.mbn adsp
  16. BUILD_ID=8x26
  17. IMAGE_DIR=$ROOTDIR/wcnss_proc/build/ms/bin/$BUILD_ID
  18. python $ROOTDIR/pil-splitter.py $IMAGE_DIR/wcnss.mbn wcnss
  19. MODEMVERSTR=`grep -aohPz "QC_IMAGE_VERSION_STRING=.*" ./modem.*`
  20. MODEMVER=`echo $MODEMVERSTR | cut -d "=" -f 2`
  21. echo $MODEMVER > $ROOTDIR/ver_info.txt
  22. MODEM_VDISK=/media/vdisk
  23. cp -f $MODEM_STK $MODEM_NEW
  24. sudo mkdir -p $MODEM_VDISK
  25. sudo mount -t vfat $MODEM_NEW -o rw,umask=0000,shortname=lower $MODEM_VDISK
  26. rm -f $MODEM_VDISK/image/modem.*
  27. rm -f $MODEM_VDISK/image/mba.*
  28. rm -f $MODEM_VDISK/image/adsp.*
  29. rm -f $MODEM_VDISK/image/wcnss.*
  30. cp -f ./* $MODEM_VDISK/image/
  31. rm -f $MODEM_VDISK/verinfo/ver_info.txt
  32. mkdir -p $MODEM_VDISK/verinfo
  33. cp -f $ROOTDIR/ver_info.txt $MODEM_VDISK/verinfo/
  34. sudo umount $MODEM_NEW
  35. cd $ROOTDIR
11. 設定權限並執行 makeimg.sh 
  1. chmod a+x makeimg.sh
  2. ./makeimg.sh
12.編譯完成得到新的 NON-HLOS.bin