首页 > 代码库 > android 5.0 clone project 的方式

android 5.0 clone project 的方式

Clone Project 指的是对现有的Project创建出新的Project
后面指令中使用的变量含义如下:
$BASE_PROJECT 指的是新Project的基础Project
$NEW_PROJECT 指的是将创建的新的Project
$PLATFORM 指的是平台信息,如MT6795等
$COMPANY 指的是开案公司的名字,如lenovo, tinno, huawei等等。
 
 cd bootable/bootloader/preloader/custom   :(clone preloader)
           输入以下指令
          cp -r  ${BASE_PROJECT}   ${NEW_PROJECT}
            mv ${NEW_PROJECT}/${BASE_PROJECT}.mk   ${NEW_PROJECT}/${NEW_PROJECT}.mk
           sed -i  s/${BASE_PROJECT}/${NEW_PROJECT}/g  ${NEW_PROJECT}/${NEW_PROJECT}.mk
 cd bootable/bootloader/lk   : (clone lk)
          输入以下指令
          cp project/${BASE_PROJECT}.mk  project/${NEW_PROJECT}.mk
          cp -r target/${BASE_PROJECT}  target/${NEW_PROJECT}
         sed -i  s/${BASE_PROJECT}/${NEW_PROJECT}/g  project/${NEW_PROJECT}.mk
          sed -i s /${BASE_PROJECT}/${NEW_PROJECT}/g  target/${NEW_PROJECT}/include/target/cust_usb.h
 cd kernel-3.10/     :(clone kernel)
          输入以下指令
         cp -r drivers/misc/mediatek/mach/mt6795/${BASE_PROJECT}  drivers/misc/mediatek/mach/mt6795/${NEW_PROJECT}
         cp arch/arm64/configs/${BASE_PROJECT}_defconfig   arch/arm64/configs/${NEW_PROJECT}_defconfig
         cp arch/arm64/configs/${BASE_PROJECT}_debug_defconfig   arch/arm64/configs/${NEW_PROJECT}_debug_defconfig
           cd kernel-3.10/arch/arm64/
         sed -i s/${BASE_PROJECT}/${NEW_PROJECT}/g   configs/${NEW_PROJECT}_defconfig
        sed -i s/${BASE_PROJECT}/${NEW_PROJECT}/g   configs/${NEW_PROJECT}_debug_defconfig
          cp boot/dts/ ${BASE_PROJECT}.dts  boot/dts/ ${NEW_PROJECT}.dts
clone android
         cp -r device/${COMPANY}/${BASE_PROJECT}   device/${COMPANY}/${NEW_PROJECT}
        mv device/${COMPANY}/${NEW_PROJECT}/full_${BASE_PROJECT}.mk   device/${COMPANY}/  ${NEW_PROJECT}/full_${NEW_PROJECT}.mk
        cp -r vendor/mediatek/proprietary/custom/${BASE_PROJECT}  vendor/mediatek/proprietary/custom/${NEW_PROJECT}
        cp vendor/mediatek/proprietary/trustzone/project /${BASE_PROJECT} mk  vendor/mediatek/proprietary/trustzone/project /${NEW_PROJECT } mk
        cp md32/md32/project /${BASE_PROJECT} .mk md32/md32/project /${NEW_PROJECT} .mk
       sed -i s/${BASE_PROJECT}/${NEW_PROJECT}/g  device/${COMPANY}/${NEW_PROJECT}/AndroidProducts.mk
       sed -i s/${BASE_PROJECT}/${NEW_PROJECT}/g  device/${COMPANY}/${NEW_PROJECT}/BoardConfig.mk
       sed -i s/${BASE_PROJECT}/${NEW_PROJECT}/g  device/${COMPANY}/${NEW_PROJECT}/device.mk
      sed -i s/${BASE_PROJECT}/${NEW_PROJECT}/g  device/${COMPANY}/${NEW_PROJECT}/full_${NEW_PROJECT}.mk
      sed -i s/${BASE_PROJECT}/${NEW_PROJECT}/g  device/${COMPANY}/${NEW_PROJECT}/vendorsetup.sh
      sed -i s/${BASE_PROJECT}/${NEW_PROJECT}/g  vendor/mediatek/proprietary/custom/${NEW_PROJECT}/Android.mk
If share libraries with ${BASE_PROJECT}
sed -i s#vendor/${COMPANY}/libs/${NEW_PROJECT}#vendor/${COMPANY}/libs/${BASE_PROJECT}#g device/${COMPANY}/${NEW_PROJECT}/device.mk
If not share libraries with ${BASE_PROJECT}
cp –r vendor/${COMPANY}/libs/${BASE_PROJECT}  vendor/${COMPANY}/libs/${NEW_PROJECT}

android 5.0 clone project 的方式