This commit is contained in:
黑猫 2023-05-11 15:47:08 +08:00
commit d9fb91881c
12 changed files with 2396 additions and 0 deletions

160
ipq6018/config.xml Normal file
View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
===========================================================================
Copyright (c) 2017, 2019 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
===========================================================================
-->
<config>
<data type="ARCH">
<SOC>ipq6018</SOC>
</data>
<data type="NOR_PARAMETER">
<page_size>256</page_size>
<pages_per_block>256</pages_per_block>
<total_block>256</total_block>
</data>
<data type="NAND_PARAMETER">
<entry type="2k">
<page_size>2048</page_size>
<pages_per_block>64</pages_per_block>
<total_block>4096</total_block>
</entry>
<entry type="audio-2k">
<page_size>2048</page_size>
<pages_per_block>64</pages_per_block>
<total_block>4096</total_block>
</entry>
<entry type="4k">
<page_size>4096</page_size>
<pages_per_block>64</pages_per_block>
<total_block>4096</total_block>
</entry>
<entry type="audio-4k">
<page_size>4096</page_size>
<pages_per_block>64</pages_per_block>
<total_block>4096</total_block>
</entry>
</data>
<data type="EMMC_PARAMETER">
<total_block>7634944</total_block>
<partition_mbn>gpt_main0.bin</partition_mbn>
<partition_mbn_backup>gpt_backup0.bin</partition_mbn_backup>
</data>
<data type="NORPLUSNAND_PARAMETER">
<page_size>256</page_size>
<pages_per_block>256</pages_per_block>
<total_block>256</total_block>
</data>
<data type="NORPLUSEMMC_PARAMETER">
<page_size>256</page_size>
<page_size_flash>512</page_size_flash>
<pages_per_block>256</pages_per_block>
<total_block>256</total_block>
<partition_mbn>gpt_main1.bin</partition_mbn>
<partition_mbn_backup>gpt_backup1.bin</partition_mbn_backup>
</data>
<data type="MACH_ID_BOARD_MAP">
<entry>
<machid>0x8030000</machid>
<board>AP-CP01-C1</board>
<spi_nand>false</spi_nand>
<memory>256M32_DDR3</memory>
</entry>
<entry>
<machid>0x8030001</machid>
<board>AP-CP01-C2</board>
<spi_nand>false</spi_nand>
<memory>256M32_DDR3</memory>
</entry>
<entry>
<machid>0x8030002</machid>
<board>AP-CP01-C3</board>
<spi_nand>false</spi_nand>
<memory>256M32_DDR3</memory>
</entry>
<entry>
<machid>0x8030003</machid>
<board>AP-CP01-C4</board>
<spi_nand>false</spi_nand>
<memory>256M32_DDR3</memory>
<discrete_smps>true</discrete_smps>
</entry>
<entry>
<machid>0x8030100</machid>
<board>AP-CP02-C1</board>
<spi_nand>false</spi_nand>
<memory>256M32_DDR4</memory>
</entry>
<entry>
<machid>0x8030200</machid>
<board>AP-CP03-C1</board>
<spi_nand>false</spi_nand>
<memory>256M16_DDR3</memory>
</entry>
<entry>
<machid>0x1030000</machid>
<board>DB-CP01</board>
<spi_nand>false</spi_nand>
<memory>256M32_DDR3</memory>
</entry>
<entry>
<machid>0x1030100</machid>
<board>DB-CP02</board>
<spi_nand>false</spi_nand>
<memory>1024M32_DDR4</memory>
</entry>
<entry>
<machid>0xF030000</machid>
<board>CP-EMU</board>
<spi_nand>false</spi_nand>
<memory>256M32_DDR3</memory>
</entry>
</data>
<data type="COPY_IMAGES">
<image type="BOOT">
<entry><image_path>/boot_images/build/ms/bin/8074/nor/sbl1_nor.mbn</image_path></entry>
<entry><image_path>/boot_images/build/ms/bin/8074/nand/sbl1_nand.mbn</image_path></entry>
<entry><image_path>/boot_images/build/ms/bin/8074/emmc/sbl1_emmc.mbn</image_path></entry>
<entry><image_path>/boot_images/build/ms/bin/8074/flashless/sbl1_flashless.mbn</image_path></entry>
<entry><image_path>/boot_images/core/bsp/tools/flash/partition_tool_exe/build/partition_tool</image_path></entry>
<entry><image_path>/boot_images/core/bsp/tools/flash/bootconfig_exe/build/bootconfig_tool</image_path></entry>
</image>
<image type="TZ">
<entry><image_path>/trustzone_images/build/ms/bin/SANAANAA/tz.mbn</image_path></entry>
<entry><image_path>/trustzone_images/build/ms/bin/SANAANAA/devcfg_noac.mbn</image_path></entry>
<entry><image_path>/trustzone_images/build/ms/bin/SANAANAA/devcfg_nosmmu.mbn</image_path></entry>
</image>
<image type="NHSS32">
<entry><image_path>/apss_proc/out/ipq807x/openwrt-ipq807x-u-boot.elf</image_path></entry>
<entry><image_path>/apss_proc/out/ipq807x/openwrt-ipq-ipq807x-squashfs-root.img</image_path></entry>
<entry><image_path>/apss_proc/out/ipq807x/openwrt-ipq-ipq807x-qcom-ipq807x-hkxx-fit-uImage.itb</image_path></entry>
<entry><image_path>/apss_proc/out/ipq807x/openwrt-ipq-ipq807x-ubi-root.img</image_path></entry>
<entry><image_path>/apss_proc/out/pack.py</image_path></entry>
</image>
<image type="NHSS64">
<entry><image_path>/apss_proc/out/ipq807x/openwrt-ipq807x-u-boot.elf</image_path></entry>
<entry><image_path>/apss_proc/out/ipq807x_64/openwrt-ipq-ipq807x_64-squashfs-root.img</image_path></entry>
<entry><image_path>/apss_proc/out/ipq807x_64/openwrt-ipq-ipq807x_64-qcom-ipq807x-hkxx-fit-uImage.itb</image_path></entry>
<entry><image_path>/apss_proc/out/ipq807x_64/openwrt-ipq-ipq807x_64-ubi-root.img</image_path></entry>
<entry><image_path>/apss_proc/out/pack.py</image_path></entry>
</image>
<image type="RPM">
<entry><image_path>/rpm_proc/build/ms/bin/8074/rpm.mbn</image_path></entry>
</image>
<image type="WIFIFW">
<entry><image_path>/wlan_proc/build/ms/bin/wifi_fw_squashfs.img</image_path></entry>
<entry><image_path>/wlan_proc/build/ms/bin/wifi_fw_ubi.img</image_path></entry>
</image>
</data>
</config>

View File

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
===========================================================================
Copyright (c) 2017-2019 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
===========================================================================
-->
<nandboot>
<magic_numbers>
<usr_part_magic1>0xAA7D1B9A</usr_part_magic1>
<usr_part_magic2>0x1F7D48BC</usr_part_magic2>
</magic_numbers>
<partition_version length="4">0x4</partition_version>
<partitions>
<partition>
<name length="16" type="string">0:SBL1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">xbl_nand.elf</img_name>
</partition>
<partition>
<name length="16" type="string">0:MIBIB</name>
<size_kb length="4">512</size_kb>
<pad_kb length="2">512</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">nand-system-partition-ipq6018-m4096-p256KiB.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:BOOTCONFIG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">bootconfig.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:BOOTCONFIG1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">bootconfig.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">tz.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE_1</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">devcfg.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:RPM</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">rpm.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:RPM_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:CDT</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">cdt.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:CDT_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBLENV</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBL</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">openwrt-ipq6018-u-boot.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:APPSBL_1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:ART</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">rootfs</name>
<size_kb length="4">85504</size_kb>
<pad_kb length="2">1024</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string" mode="32" image_type="hlos">openwrt-ipq-ipq60xx-ubi-root-m4096-p256KiB.img</img_name>
<img_name type="string" mode="64" image_type="hlos">openwrt-ipq-ipq60xx_64-ubi-root-m4096-p256KiB.img</img_name>
</partition>
<partition>
<name length="16" type="string">rootfs_1</name>
<size_kb length="4">85504</size_kb>
<pad_kb length="2">1024</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:ETHPHYFW</name>
<size_kb length="4">2048</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
</partitions>
</nandboot>

View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
===========================================================================
Copyright (c) 2017, 2019 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
===========================================================================
-->
<nandboot>
<magic_numbers>
<usr_part_magic1>0xAA7D1B9A</usr_part_magic1>
<usr_part_magic2>0x1F7D48BC</usr_part_magic2>
</magic_numbers>
<partition_version length="4">0x4</partition_version>
<partitions>
<partition>
<name length="16" type="string">0:SBL1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">xbl_nand.elf</img_name>
</partition>
<partition>
<name length="16" type="string">0:MIBIB</name>
<size_kb length="4">512</size_kb>
<pad_kb length="2">512</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">nand-audio-system-partition-ipq6018-m4096-p256KiB.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:BOOTCONFIG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">bootconfig-audio.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:BOOTCONFIG1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">bootconfig-audio.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">tz.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE_1</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">devcfg_noac.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:RPM</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">rpm.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:RPM_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:CDT</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">cdt.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:CDT_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBLENV</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBL</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">openwrt-ipq6018-u-boot.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:APPSBL_1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:ART</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">rootfs</name>
<size_kb length="4">197120</size_kb>
<pad_kb length="2">1024</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string" mode="32" image_type="hlos">openwrt-ipq-ipq60xx-ubi-root-m4096-p256KiB.img</img_name>
<img_name type="string" mode="64" image_type="hlos">openwrt-ipq-ipq60xx_64-ubi-root-m4096-p256KiB.img</img_name>
</partition>
<partition>
<name length="16" type="string">0:ETHPHYFW</name>
<size_kb length="4">2048</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
</partitions>
</nandboot>

View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
===========================================================================
Copyright (c) 2017, 2019 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
===========================================================================
-->
<nandboot>
<magic_numbers>
<usr_part_magic1>0xAA7D1B9A</usr_part_magic1>
<usr_part_magic2>0x1F7D48BC</usr_part_magic2>
</magic_numbers>
<partition_version length="4">0x4</partition_version>
<partitions>
<partition>
<name length="16" type="string">0:SBL1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">xbl_nand.elf</img_name>
</partition>
<partition>
<name length="16" type="string">0:MIBIB</name>
<size_kb length="4">512</size_kb>
<pad_kb length="2">512</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">nand-audio-system-partition-ipq6018-m2048-p128KiB.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:BOOTCONFIG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">bootconfig-audio.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:BOOTCONFIG1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">bootconfig-audio.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">tz.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE_1</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">devcfg_noac.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:RPM</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">rpm.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:RPM_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:CDT</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">cdt.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:CDT_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBLENV</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBL</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">openwrt-ipq6018-u-boot.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:APPSBL_1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:ART</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">rootfs</name>
<size_kb length="4">108544</size_kb>
<pad_kb length="2">1024</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string" mode="32" image_type="hlos">openwrt-ipq-ipq60xx-ubi-root.img</img_name>
<img_name type="string" mode="64" image_type="hlos">openwrt-ipq-ipq60xx_64-ubi-root.img</img_name>
</partition>
<partition>
<name length="16" type="string">0:ETHPHYFW</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
</partitions>
</nandboot>

View File

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
===========================================================================
Copyright (c) 2017, 2019 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
===========================================================================
-->
<nandboot>
<magic_numbers>
<usr_part_magic1>0xAA7D1B9A</usr_part_magic1>
<usr_part_magic2>0x1F7D48BC</usr_part_magic2>
</magic_numbers>
<partition_version length="4">0x4</partition_version>
<partitions>
<partition>
<name length="16" type="string">0:SBL1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">xbl_nand.elf</img_name>
</partition>
<partition>
<name length="16" type="string">0:MIBIB</name>
<size_kb length="4">512</size_kb>
<pad_kb length="2">512</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">nand-system-partition-ipq6018.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">tz.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">devcfg.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:RPM</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">rpm.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:CDT</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">cdt.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:APPSBLENV</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBL</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">openwrt-ipq6018-u-boot.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:ART</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">bdata</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">crash</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">crash_syslog</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">rootfs</name>
<size_kb length="4">113664</size_kb>
<pad_kb length="2">1024</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string" mode="32" image_type="hlos">openwrt-ipq-ipq60xx-ubi-root.img</img_name>
<img_name type="string" mode="64" image_type="hlos">openwrt-ipq-ipq60xx_64-ubi-root.img</img_name>
</partition>
</partitions>
</nandboot>

View File

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
===========================================================================
Copyright (c) 2017, 2019 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
===========================================================================
-->
<nandboot>
<magic_numbers>
<usr_part_magic1>0xAA7D1B9A</usr_part_magic1>
<usr_part_magic2>0x1F7D48BC</usr_part_magic2>
</magic_numbers>
<partition_version length="4">0x4</partition_version>
<partitions>
<partition>
<name length="16" type="string">0:SBL1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">xbl_nand.elf</img_name>
</partition>
<partition>
<name length="16" type="string">0:MIBIB</name>
<size_kb length="4">512</size_kb>
<pad_kb length="2">512</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">nand-system-partition-ipq6018.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:BOOTCONFIG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">bootconfig.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:BOOTCONFIG1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">bootconfig.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">tz.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:QSEE_1</name>
<size_kb length="4">1792</size_kb>
<pad_kb length="2">1792</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">devcfg.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:DEVCFG_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:RPM</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">rpm.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:RPM_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:CDT</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">cdt.bin</img_name>
</partition>
<partition>
<name length="16" type="string">0:CDT_1</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBLENV</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:APPSBL</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string">openwrt-ipq6018-u-boot.mbn</img_name>
</partition>
<partition>
<name length="16" type="string">0:APPSBL_1</name>
<size_kb length="4">768</size_kb>
<pad_kb length="2">768</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:ART</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">rootfs</name>
<size_kb length="4">53760</size_kb>
<pad_kb length="2">1024</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
<img_name type="string" mode="32" image_type="hlos">openwrt-ipq-ipq60xx-ubi-root.img</img_name>
<img_name type="string" mode="64" image_type="hlos">openwrt-ipq-ipq60xx_64-ubi-root.img</img_name>
</partition>
<partition>
<name length="16" type="string">rootfs_1</name>
<size_kb length="4">53760</size_kb>
<pad_kb length="2">1024</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
<partition>
<name length="16" type="string">0:ETHPHYFW</name>
<size_kb length="4">256</size_kb>
<pad_kb length="2">256</pad_kb>
<which_flash length="2">0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
</partitions>
</nandboot>

BIN
ipq6018/in/partition_tool Normal file

Binary file not shown.

368
prepareSingleImage.py Normal file
View File

@ -0,0 +1,368 @@
# ===========================================================================
#Copyright (c) 2017, 2019 Qualcomm Technologies, Inc.
#All Rights Reserved.
#Confidential and Proprietary - Qualcomm Technologies, Inc.
# ===========================================================================
import xml.etree.ElementTree as ET
import itertools
import os
import subprocess
import sys
from getopt import getopt
from getopt import GetoptError
arch=""
flash="nor,tiny-nor,nand,norplusnand,emmc,norplusemmc"
bootImgDir=""
rpmImgDir=""
tzImgDir=""
nhssImgDir=""
wififwImgDir=""
cdir = os.path.dirname(__file__)
cdir = os.path.abspath(cdir)
inDir = ""
mode = ""
mbn_v6 = ""
def print_help():
print "\nUsage: python prepareSingleImage.py <option> <value>\n"
print "--arch \t\tArch(e.g ipq40xx/ipq807x/ipq807x_64/ipq6018/ipq6018_64/ipq5018/ipq5018_64/ipq9048/ipq9048_64)\n"
print " \t\te.g python prepareSingleImage.py --arch ipq807x\n\n"
print "--fltype \tFlash Type (nor/nand/emmc/norplusnand/norplusemmc)"
print " \t\tMultiple flashtypes can be passed by a comma separated string"
print " \t\tDefault is all. i.e If \"--fltype\" is not passed image for all the flash-type will be created.\n"
print " \t\te.g python prepareSingleImage.py --fltype nor,nand,norplusnand\n\n"
print "--in \t\tGenerated binaries and images needed for singleimage will be copied to this location"
print "\t\tDefault path: ./<ARCH>/in/\n"
print "\t\te.g python prepareSingleImage.py --gencdt --in ./\n\n"
print "--bootimg \tBoot image path"
print "\t\tIf specified the boot images available at <PATH> will be copied to the directory provided with \"--in\"\n"
print "\t\te.g python prepareSingleImage.py --bootimg <PATH>\n\n"
print "--tzimg \tTZ image path"
print "\t\tIf specified the TZ images available at <PATH> will be copied to the directory provided with \"--in\"\n"
print "\t\te.g python prepareSingleImage.py --tzimg <PATH>\n\n"
print "--nhssimg \tNHSS image path"
print "\t\tIf specified the NHSS images available at <PATH> will be copied to the directory provided with \"--in\"\n"
print "\t\te.g python prepareSingleImage.py --nhssimg <PATH>\n\n"
print "--rpmimg \tRPM image path"
print "\t\tIf specified the RPM images available at <PATH> will be copied to the directory provided with \"--in\"\n"
print "\t\te.g python prepareSingleImage.py --rpmimg <PATH>\n\n"
print "--gencdt \tWhether CDT binaries to be generated"
print "\t\tIf not specified CDT binary will not be generated"
print "\t\tThis Argument does not take any value\n"
print "\t\te.g python prepareSingleImage.py --gencdt\n\n"
print "--memory \tWhether to use Low Memory Profiles for cdt binaries to be generated"
print "\t\tThis option depends on '--gencdt'\n"
print "\t\tIf specified the <VALUE> is taken as memory size in generating cdt binaries\n"
print "\t\te.g python prepareSingleImage.py --gencdt --memory <VALUE>\n\n"
print "--genpart \tWhether flash partition table(s) to be generated"
print "\t\tIf not specified partition table(s) will not be generated"
print "\t\tThis Argument does not take any value\n"
print "\t\te.g python prepareSingleImage.py --genpart\n\n"
print "--genbootconf \tWhether bootconfig binaries to be generated"
print "\t\tIf not specified bootconfig binaries will not be generated"
print "\t\tThis Argument does not take any value\n"
print "\t\te.g python prepareSingleImage.py --genbootconf\n\n"
print "--genmbn \tWhether u-boot.elf to be converted to u-boot.mbn"
print "\t\tIf not specified u-boot.mbn will not be generated"
print "\t\tThis is currently used/needed only for IPQ807x, IPQ6018, IPQ5018"
print "\t\tThis Argument does not take any value\n"
print "\t\te.g python prepareSingleImage.py --genmbn\n\n"
print "--lk \t\tWhether lkboot.elf to be converted to lkboot.mbn"
print "\t\tIf not specified lkboot.mbn will not be generated"
print "\t\tThis is currently used/needed only for IPQ807x"
print "\t\tThis Argument does not take any value"
print "\t\tThis option depends on '--genmbn'\n"
print "\t\te.g python prepareSingleImage.py --genmbn --lk\n\n"
print "--genbootldr \tWhether bootldr binaries to be generated"
print "\t\tIf not specified bootldr binaries will not be generated"
print "\t\tThis Argument does not take any value\n"
print "\t\te.g python prepareSingleImage.py --genbootldr\n\n"
print "--help \t\tPrint This Message\n\n"
print "\t\t\t\t <<<<<<<<<<<<< A Sample Run >>>>>>>>>>>>>\n"
print "python prepareSingleImage.py --arch ipq40xx --fltype nor,nand,norplusnand --gencdt --genbootconf --genpart --in ./in_put/\n\n\n"
def copy_images(image_type, build_dir):
global arch
global configDir
tree = ET.parse(configDir)
root = tree.getroot()
entries = root.findall("./data[@type='COPY_IMAGES']/image[@type='" + image_type + "']/entry")
for entry in entries:
image_path = entry.find(".//image_path")
image_path.text = build_dir.rstrip() + image_path.text
print "image_path.text:" + image_path.text
print "cp " + image_path.text + " " + inDir
os.system("cp " + image_path.text + " " + inDir)
def gen_cdt():
global srcDir
global configDir
global memory
cdt_path = srcDir + '/gen_cdt_bin.py'
prc = subprocess.Popen(['python', cdt_path, '-c', configDir, '-o', inDir, '-m', memory], cwd=cdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create CDT binary'
return prc.returncode
return 0
def gen_part(flash):
global srcDir
global configDir
flash_partition_path = srcDir + '/gen_flash_partition_bin.py'
for flash_type in flash.split(","):
prc = subprocess.Popen(['python', flash_partition_path, '-c', configDir, '-f', flash_type, '-o', inDir], cwd=cdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to generate partition table for ' + flash_type
return prc.returncode
return 0
def gen_bootconfig():
global srcDir
global configDir
bootconfig_path = srcDir + '/gen_bootconfig_bin.py'
print "Creating Bootconfig"
prc = subprocess.Popen(['python', bootconfig_path, '-c', configDir, '-o', inDir], cwd=cdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create bootconfig binary'
return prc.returncode
return 0
def gen_bootldr():
global srcDir
global configDir
global memory
bootldr_path = srcDir + '/gen_bootldr_bin.py'
print "Creating bootldr"
prc = subprocess.Popen(['python', bootldr_path, '-c', configDir, '-o', inDir, '-m', memory], cwd=cdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create bootldr binary'
return prc.returncode
return 0
def gen_mbn():
global srcDir
global mbn_v6
bootconfig_path = srcDir + '/elftombn.py'
print "Converting u-boot elf to mbn ..."
tiny_path=inDir + "/openwrt-" + arch + "_tiny" + "-u-boot.elf"
if mbn_v6 != "true":
prc = subprocess.Popen(['python', bootconfig_path, '-f', inDir + "/openwrt-" + arch + "-u-boot.elf", '-o', inDir + "/openwrt-" + arch + "-u-boot.mbn"], cwd=cdir)
if os.path.exists(tiny_path):
prc = subprocess.Popen(['python', bootconfig_path, '-f', inDir + "/openwrt-" + arch + "_tiny" + "-u-boot.elf", '-o', inDir + "/openwrt-" + arch + "_tiny" + "-u-boot.mbn"], cwd=cdir)
else:
prc = subprocess.Popen(['python', bootconfig_path, '-f', inDir + "/openwrt-" + arch + "-u-boot.elf", '-o', inDir + "/openwrt-" + arch + "-u-boot.mbn", '-v', "6"], cwd=cdir)
if os.path.exists(tiny_path):
prc = subprocess.Popen(['python', bootconfig_path, '-f', inDir + "/openwrt-" + arch + "_tiny" + "-u-boot.elf", '-o', inDir + "/openwrt-" + arch + "_tiny" + "-u-boot.mbn", '-v', "6"], cwd=cdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to convert U-Boot .elf to .mbn'
return prc.returncode
else:
print "U-Boot .mbn file is created"
return 0
def gen_lk_mbn():
global srcDir
bootconfig_path = srcDir + '/elftombn.py'
print "Converting LK elf to mbn ..."
if mbn_v6 != "true":
prc = subprocess.Popen(['python', bootconfig_path, '-f', inDir + "/openwrt-" + arch + "-lkboot.elf", '-o', inDir + "/openwrt-" + arch + "-lkboot.mbn"], cwd=cdir)
else:
prc = subprocess.Popen(['python', bootconfig_path, '-f', inDir + "/openwrt-" + arch + "-lkboot.elf", '-o', inDir + "/openwrt-" + arch + "-lkboot.mbn", '-v', "6"], cwd=cdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to convert LK .elf to .mbn'
return prc.returncode
else:
print "LK .mbn file is created"
return 0
def main():
global flash
global arch
global bootImgDir
global tzImgDir
global nhssImgDir
global rpmImgDir
global wififwImgDir
global srcDir
global configDir
global inDir
global mode
global mbn_v6
global memory
to_generate_cdt = "false"
to_generate_part = "false"
to_generate_bootconf = "false"
to_generate_mbn = "false"
to_generate_lk_mbn = "false"
to_generate_bootldr = "false"
memory = "default"
if len(sys.argv) > 1:
try:
opts, args = getopt(sys.argv[1:], "h", ["arch=", "fltype=", "in=", "bootimg=", "tzimg=", "nhssimg=", "rpmimg=", "wififwimg", "gencdt", "memory=", "genpart", "genbootconf", "genmbn", "lk", "genbootldr", "help"])
except GetoptError, e:
print_help()
raise
for option, value in opts:
if option == "--arch":
arch = value
if arch not in ["ipq40xx", "ipq806x", "ipq807x", "ipq807x_64", "ipq6018", "ipq6018_64", "ipq5018", "ipq5018_64", "ipq9048", "ipq9048_64"]:
print "Invalid arch type: " + arch
print_help()
return -1
if arch == "ipq807x" or arch == "ipq5018" or arch == "ipq9048":
mode = "32"
elif arch == "ipq807x_64" or arch == "ipq5018_64" or arch == "ipq9048_64":
mode = "64"
arch = arch[:-3]
if arch == "ipq6018":
mode = "32"
elif arch == "ipq6018_64":
mode = "64"
arch = "ipq6018"
elif option == "--fltype":
flash = value
for flash_type in flash.split(","):
if flash_type not in ["nor", "tiny-nor", "nand", "norplusnand", "emmc", "norplusemmc", "tiny-nor-debug"]:
print "Invalid flash type: " + flash_type
print_help()
return -1
elif option == "--in":
inDir = value
elif option == "--bootimg":
bootImgDir = value
elif option == "--tzimg":
tzImgDir = value
elif option == "--nhssimg":
nhssImgDir = value
elif option == "--rpmimg":
rpmImgDir = value
elif option == "--wififwimg":
wififwImgDir = value
elif option == "--gencdt":
to_generate_cdt = "true"
elif option == "--memory":
memory = value
elif option == "--genbootconf":
to_generate_bootconf = "true"
elif option == "--genpart":
to_generate_part = "true"
elif option == "--genmbn":
to_generate_mbn = "true"
elif option == "--lk":
to_generate_lk_mbn = "true"
elif option == "--genbootldr":
to_generate_bootldr = "true"
elif (option == "-h" or option == "--help"):
print_help()
return 0
srcDir="$$/scripts"
srcDir = srcDir.replace('$$', cdir)
configDir="$$/" + arch + "/config.xml"
configDir = configDir.replace('$$', cdir)
if inDir == "":
inDir="$$/" + arch + "/in"
inDir = inDir.replace('$$', cdir)
inDir = os.path.abspath(inDir + "/")
if not os.path.exists(inDir):
os.makedirs(inDir)
if bootImgDir != "":
copy_images("BOOT", bootImgDir)
if tzImgDir != "":
copy_images("TZ", tzImgDir)
if nhssImgDir != "":
copy_images("NHSS" + mode, nhssImgDir)
if rpmImgDir != "":
copy_images("RPM", rpmImgDir)
if wififwImgDir != "":
copy_images("WIFIFW", wififwImgDir)
if to_generate_cdt == "true":
if gen_cdt() != 0:
return -1
if to_generate_bootconf == "true":
if gen_bootconfig() != 0:
return -1
if to_generate_part == "true":
if gen_part(flash) != 0:
return -1
if to_generate_bootldr == "true":
if gen_bootldr() != 0:
return -1
if to_generate_mbn == "true":
if arch == "ipq807x" or arch == "ipq6018" or arch == "ipq5018" or arch == "ipq9048":
if arch == "ipq6018":
mbn_v6 = "true"
if gen_mbn() != 0:
return -1
if to_generate_lk_mbn == "true" and gen_lk_mbn() != 0:
return -1
else:
print "Invalid arch \"" + arch + "\" for mbn conversion"
print "--genmbn is needed/used only for ipq807x, ipq6018, ipq5018 and ipq9048 type"
return 0
else:
print_help()
return 0
if __name__ == '__main__':
main()

View File

@ -0,0 +1,668 @@
# ===========================================================================
#Copyright (c) 2017 Qualcomm Technologies, Inc.
#All Rights Reserved.
#Confidential and Proprietary - Qualcomm Technologies, Inc.
# ===========================================================================
from collections import namedtuple
import xml.etree.ElementTree as ET
import os
import subprocess
import sys
from getopt import getopt
from getopt import GetoptError
cdir = os.path.dirname("")
cdir = os.path.abspath(cdir)
Nor_Params = namedtuple("Nor_Params", "pagesize pages_per_block total_blocks")
Nand_Params = namedtuple("nand_Params", "pagesize pages_per_block total_blocks")
outputdir = ""
def process_nand_device(pagesize, pages_per_block, total_blocks, entry, nand_type):
global mbn_gen
global nandsyspartition
global partition_tool
global cdir
global ARCH_NAME
global outputdir
global QCN9000
nand_pagesize = pagesize
nand_pages_per_block = pages_per_block
nand_total_blocks = total_blocks
if nand_type == "audio-4k":
nand_partition = "$$/" + ARCH_NAME + "/flash_partition/nand-audio-4k-partition.xml"
elif nand_type == "audio-2k":
nand_partition = "$$/" + ARCH_NAME + "/flash_partition/nand-audio-partition.xml"
elif nand_type == "4k":
nand_partition = "$$/" + ARCH_NAME + "/flash_partition/nand-4k-partition.xml"
elif nand_type == "2k":
if QCN9000:
nand_partition = "$$/" + ARCH_NAME + "/flash_partition/nand-partition-qcn9000.xml"
else:
nand_partition = "$$/" + ARCH_NAME + "/flash_partition/nand-partition.xml"
nand_partition = nand_partition.replace('$$', cdir)
nand_parts = Nand_Params(nand_pagesize, nand_pages_per_block, nand_total_blocks)
mbn_gen = '$$/scripts/nand_mbn_generator.py'
mbn_gen = mbn_gen.replace('$$', cdir)
if ARCH_NAME == "ipq806x":
partition_tool = outputdir + '/nor_tool'
else:
partition_tool = outputdir + '/partition_tool'
os.chmod(partition_tool, 0744)
if entry == False or (entry == True and nand_pagesize == 2048 and nand_type == '2k'):
if QCN9000:
nandsyspartition = outputdir + '/nand-system-partition-' + ARCH_NAME + '-qcn9000.bin'
nanduserpartition = 'nand-user-partition-qcn9000.bin'
else:
nandsyspartition = outputdir + '/nand-system-partition-' + ARCH_NAME + '.bin'
nanduserpartition = 'nand-user-partition.bin'
else:
nand_blocksize = (nand_pagesize * nand_pages_per_block) / 1024
if nand_type == "audio-2k" or nand_type == "audio-4k":
nand_type = "audio-"
elif nand_type == "4k":
nand_type = ""
nandsyspartition = outputdir + '/nand-' + nand_type + 'system-partition-' + ARCH_NAME + '-m' + str(nand_pagesize) + '-p' + str(nand_blocksize) + 'KiB.bin'
nanduserpartition = 'nand-' + nand_type + 'user-partition-m' + str(nand_pagesize) + '-p' + str(nand_blocksize) + 'KiB.bin'
nanduserbin= os.path.splitext(nanduserpartition)[0] + ".bin"
print '\tNand page size: ' + str(nand_parts.pagesize) + ', pages/block: ' \
+ str(nand_parts.pages_per_block) + ', total blocks: ' \
+ str(nand_parts.total_blocks)
print '\tPartition info: ' + nand_partition
print '\tCreating user partition',
prc = subprocess.Popen(['python', mbn_gen, nand_partition,
nanduserbin], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create user partition'
return prc.returncode
else:
print '...User partition created'
userpart_path = os.path.join(outputdir, nanduserbin)
print '\tCreating system partition'
prc = subprocess.Popen([
partition_tool,
'-s',
str(nand_parts.pagesize),
'-p',
str(nand_parts.pages_per_block),
'-b',
str(nand_parts.total_blocks),
'-u',
userpart_path,
'-o',
nandsyspartition,
], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create system partition'
return prc.returncode
else:
print '...System partition created'
return 0
def process_nand(config_path, flash_type):
global mbn_gen
global nandsyspartition
global partition_tool
global cdir
global ARCH_NAME
global outputdir
global QCN9000
tree = ET.parse(config_path)
root = tree.getroot()
arch = root.find(".//data[@type='ARCH']/SOC")
ARCH_NAME = str(arch.text)
entry = False
QCN9000 = False
if ARCH_NAME == "ipq807x":
QCN9000 = True
if root.find(".//data[@type='NAND_PARAMETER']/entry") != None:
entry = True
entries = root.findall("./data[@type='NAND_PARAMETER']/entry")
for nand_param in entries:
nand_pagesize = int(nand_param.find(".//page_size").text)
nand_pages_per_block = int(nand_param.find(".//pages_per_block").text)
nand_total_blocks = int(nand_param.find(".//total_block").text)
nand_type = nand_param.get('type')
if QCN9000:
if process_nand_device(nand_pagesize, nand_pages_per_block, nand_total_blocks, entry, nand_type) != 0:
return -1
QCN9000 = False
if process_nand_device(nand_pagesize, nand_pages_per_block, nand_total_blocks, entry, nand_type) != 0:
return -1
else:
nand_param = root.find(".//data[@type='NAND_PARAMETER']")
nand_pagesize = int(nand_param.find('page_size').text)
nand_pages_per_block = int(nand_param.find('pages_per_block').text)
nand_total_blocks = int(nand_param.find('total_block').text)
if QCN9000:
if process_nand_device(nand_pagesize, nand_pages_per_block, nand_total_blocks, entry, "2k") != 0:
return -1
QCN9000 = False
if process_nand_device(nand_pagesize, nand_pages_per_block, nand_total_blocks, entry, "2k") != 0:
return -1
return 0
def process_nor(config_path, flash_type):
global mbn_gen
global syspart
global partition_tool
global cdir
global ARCH_NAME
global outputdir
tree = ET.parse(config_path)
root = tree.getroot()
arch = root.find(".//data[@type='ARCH']/SOC")
ARCH_NAME = str(arch.text)
nor_param = root.find(".//data[@type='NOR_PARAMETER']")
nor_pagesize = int(nor_param.find('page_size').text)
nor_pages_per_block = int(nor_param.find('pages_per_block').text)
nor_total_blocks = int(nor_param.find('total_block').text)
block_size = (nor_pagesize * nor_pages_per_block) / 1024
density = (block_size * nor_total_blocks) / 1024
nor_partition = "$$/" + ARCH_NAME + "/flash_partition/" + flash_type + "-partition.xml"
nor_partition = nor_partition.replace('$$', cdir)
if ARCH_NAME != "ipq806x":
root_part = ET.parse(nor_partition)
part = root_part.find(".//partitions/partition[2]")
part[5].text = str(block_size)
part[6].text = str(density)
root_part.write(nor_partition)
nor_parts = Nor_Params(nor_pagesize, nor_pages_per_block, nor_total_blocks)
mbn_gen = '$$/scripts/nand_mbn_generator.py'
mbn_gen = mbn_gen.replace('$$', cdir)
if ARCH_NAME == "ipq806x":
partition_tool = outputdir + '/nor_tool'
else:
partition_tool = outputdir + '/partition_tool'
os.chmod(partition_tool, 0744)
syspart = outputdir + '/' + flash_type + '-system-partition-' + ARCH_NAME + '.bin'
userpart = flash_type + '-user-partition.bin'
noruserbin= os.path.splitext(userpart)[0] + ".bin"
print '\tNor page size: ' + str(nor_parts.pagesize) + ', pages/block: ' \
+ str(nor_parts.pages_per_block) + ', total blocks: ' \
+ str(nor_parts.total_blocks) + ', partition info: ' + nor_partition
print '\tCreating user partition',
prc = subprocess.Popen(['python', mbn_gen, nor_partition,
noruserbin], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create user partition'
return prc.returncode
else:
print '...User partition created'
userpart_path = os.path.join(outputdir, noruserbin)
print '\tCreating system partition'
prc = subprocess.Popen([
partition_tool,
'-s',
str(nor_parts.pagesize),
'-p',
str(nor_parts.pages_per_block),
'-b',
str(nor_parts.total_blocks),
'-c',
str(1),
'-u',
userpart_path,
'-o',
syspart,
], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create system partition'
return prc.returncode
else:
print '...System partition created'
return 0
def process_norplusnand_device(nor_pagesize, nor_pages_per_block, nor_total_blocks,
nand_pagesize, nand_pages_per_block, nand_total_blocks, entry):
global mbn_gen
global norplusnandsyspartition
global partition_tool
global cdir
global ARCH_NAME
global outputdir
global QCN9000
if nand_pagesize == 2048:
if QCN9000:
norplusnand_partition = "$$/" + ARCH_NAME + "/flash_partition/norplusnand-partition-qcn9000.xml"
else:
norplusnand_partition = "$$/" + ARCH_NAME + "/flash_partition/norplusnand-partition.xml"
else:
norplusnand_partition = "$$/" + ARCH_NAME + "/flash_partition/norplusnand-4k-partition.xml"
norplusnand_partition = norplusnand_partition.replace('$$', cdir)
nand_parts = Nand_Params(nand_pagesize, nand_pages_per_block, nand_total_blocks)
nor_parts = Nor_Params(nor_pagesize, nor_pages_per_block, nor_total_blocks)
mbn_gen = '$$/scripts/nand_mbn_generator.py'
mbn_gen = mbn_gen.replace('$$', cdir)
if ARCH_NAME == "ipq806x":
partition_tool = outputdir + '/nor_tool'
else:
partition_tool = outputdir + '/partition_tool'
os.chmod(partition_tool, 0744)
if entry == False or (entry == True and nand_pagesize == 2048):
if QCN9000:
norplusnandsyspartition = outputdir + '/norplusnand-system-partition-' + ARCH_NAME + '-qcn9000.bin'
userpart = 'norplusnand-user-partition-qcn9000.bin'
else:
norplusnandsyspartition = outputdir + '/norplusnand-system-partition-' + ARCH_NAME + '.bin'
userpart = 'norplusnand-user-partition.bin'
else:
nand_blocksize = (nand_pagesize * nand_pages_per_block) / 1024
norplusnandsyspartition = outputdir + '/norplusnand-system-partition-' + ARCH_NAME + '-m' + str(nand_pagesize) + '-p' + str(nand_blocksize) + 'KiB.bin'
userpart = 'norplusnand-user-partition-m' + str(nand_pagesize) + '-p' + str(nand_blocksize) + 'KiB.bin'
norplusnanduserbin= os.path.splitext(userpart)[0] +".bin"
print '\tNor page size: ' + str(nor_parts.pagesize) + ', pages/block: ' \
+ str(nor_parts.pages_per_block) + ', total blocks: ' \
+ str(nor_parts.total_blocks)
print '\tPartition info: ' + norplusnand_partition
print '\tCreating user partition',
prc = subprocess.Popen(['python', mbn_gen, norplusnand_partition,
norplusnanduserbin], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create user partition'
return prc.returncode
else:
print '...User partition created'
userpart_path = os.path.join(outputdir, norplusnanduserbin)
print '\tCreating system partition'
prc = subprocess.Popen([
partition_tool,
'-s',
str(nor_parts.pagesize),
'-p',
str(nor_parts.pages_per_block),
'-b',
str(nor_parts.total_blocks),
'-x',
str(nand_parts.pagesize),
'-y',
str(nand_parts.pages_per_block),
'-z',
str(nand_parts.total_blocks),
'-c',
str(1),
'-u',
userpart_path,
'-o',
norplusnandsyspartition,
], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create system partition'
return prc.returncode
else:
print '...System partition created'
return 0
def process_norplusnand(config_path, flash_type):
global mbn_gen
global norplusnandsyspartition
global partition_tool
global cdir
global ARCH_NAME
global outputdir
global QCN9000
tree = ET.parse(config_path)
root = tree.getroot()
arch = root.find(".//data[@type='ARCH']/SOC")
ARCH_NAME = str(arch.text)
nor_param = root.find(".//data[@type='NOR_PARAMETER']")
nor_pagesize = int(nor_param.find('page_size').text)
nor_pages_per_block = int(nor_param.find('pages_per_block').text)
nor_total_blocks = int(nor_param.find('total_block').text)
norplusnand_partition = "$$/" + ARCH_NAME + "/flash_partition/norplusnand-partition.xml"
norplusnand_partition = norplusnand_partition.replace('$$', cdir)
if ARCH_NAME != "ipq806x":
root_part = ET.parse(norplusnand_partition)
part = root_part.find(".//partitions/partition[2]")
block_size = (nor_pagesize * nor_pages_per_block) / 1024
density = (block_size * nor_total_blocks) / 1024
part[5].text = str(block_size)
part[6].text = str(density)
root_part.write(norplusnand_partition)
entry = False
QCN9000 = False
if ARCH_NAME == "ipq807x":
QCN9000 = True
if root.find(".//data[@type='NAND_PARAMETER']/entry") != None:
entry = True
entries = root.findall("./data[@type='NAND_PARAMETER']/entry")
for nand_param in entries:
nand_pagesize = int(nand_param.find(".//page_size").text)
nand_pages_per_block = int(nand_param.find(".//pages_per_block").text)
nand_total_blocks = int(nand_param.find(".//total_block").text)
if QCN9000:
if process_norplusnand_device(nor_pagesize,
nor_pages_per_block, nor_total_blocks, nand_pagesize,
nand_pages_per_block, nand_total_blocks, entry) != 0:
return -1
QCN9000 = False
if process_norplusnand_device(nor_pagesize,
nor_pages_per_block, nor_total_blocks, nand_pagesize,
nand_pages_per_block, nand_total_blocks, entry) != 0:
return -1
else:
nand_param = root.find(".//data[@type='NAND_PARAMETER']")
nand_pagesize = int(nand_param.find('page_size').text)
nand_pages_per_block = int(nand_param.find('pages_per_block').text)
nand_total_blocks = int(nand_param.find('total_block').text)
if QCN9000:
if process_norplusnand_device(nor_pagesize,
nor_pages_per_block, nor_total_blocks, nand_pagesize,
nand_pages_per_block, nand_total_blocks, entry) != 0:
return -1
QCN9000 = False
if process_norplusnand_device(nor_pagesize,
nor_pages_per_block, nor_total_blocks, nand_pagesize,
nand_pages_per_block, nand_total_blocks, entry) != 0:
return -1
return 0
def process_emmc(config_path, flash_type):
global ptool
global msp
global ARCH_NAME
global outputdir
tree = ET.parse(config_path)
root = tree.getroot()
arch = root.find(".//data[@type='ARCH']/SOC")
ARCH_NAME = str(arch.text)
emmc_partition = "$$/" + ARCH_NAME + "/flash_partition/emmc-partition.xml"
emmc_partition = emmc_partition.replace('$$', cdir)
emmc_total_blocks = None
emmc_entry = root.find(".//data[@type='EMMC_PARAMETER']/total_block")
total_blocks = int(emmc_entry.text)
ptool = '$$/scripts/ptool.py'
ptool = ptool.replace('$$', cdir)
msp = '$$/scripts/msp.py'
msp = msp.replace('$$', cdir)
emmc_total_blocks = total_blocks
print '\tTotal blocks: ' + str(emmc_total_blocks)
print '\tPartition info: ' + emmc_partition
print '\temmc path: ' + outputdir
print '\tCreating rawprogram0.xml and patch0.xml',
prc = subprocess.Popen(['python', ptool, '-x', emmc_partition], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create rawprogram0.xml and patch0.xml'
return prc.returncode
else:
print '...rawprogram0.xml and patch0.xml created'
rawprogram_path = os.path.join(outputdir, 'rawprogram0.xml')
patch_path = os.path.join(outputdir, 'patch0.xml')
print '\t rawprogram' + rawprogram_path
print '\t patch' + patch_path
print '\tRunning msp.py to update gpt_main0.bin partition'
prc = subprocess.Popen([
'python',
msp,
'-r',
rawprogram_path,
'-p',
patch_path,
'-d',
str(emmc_total_blocks),
'-n',
], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create system partition'
return prc.returncode
else:
print '...System partition created'
return 0
def process_norplusemmc(config_path, flash_type):
global mbn_gen
global syspart
global partition_tool
global cdir
global ptool
global msp
global ARCH_NAME
global outputdir
tree = ET.parse(config_path)
root = tree.getroot()
arch = root.find(".//data[@type='ARCH']/SOC")
ARCH_NAME = str(arch.text)
blocks = root.find(".//data[@type='EMMC_PARAMETER']")
emmc_total_blocks = int(blocks.find('total_block').text)
nor_param = root.find(".//data[@type='NORPLUSEMMC_PARAMETER']")
nor_pagesize = int(nor_param.find('page_size').text)
nor_pages_per_block = int(nor_param.find('pages_per_block').text)
nor_total_blocks = int(nor_param.find('total_block').text)
norplusemmc_partition = "$$/" + ARCH_NAME + "/flash_partition/norplusemmc-partition.xml"
emmc_partition = "$$/" + ARCH_NAME + "/flash_partition/emmc-partition.xml"
norplusemmc_partition = norplusemmc_partition.replace('$$', cdir)
emmc_partition = emmc_partition.replace('$$', cdir)
if ARCH_NAME != "ipq806x":
root_part = ET.parse(norplusemmc_partition)
part = root_part.find(".//partitions/partition[2]")
block_size = (nor_pagesize * nor_pages_per_block) / 1024
density = (block_size * nor_total_blocks) / 1024
part[5].text = str(block_size)
part[6].text = str(density)
root_part.write(norplusemmc_partition)
nor_parts = Nor_Params(nor_pagesize, nor_pages_per_block, nor_total_blocks)
mbn_gen = '$$/scripts/nand_mbn_generator.py'
mbn_gen = mbn_gen.replace('$$', cdir)
ptool = '$$/scripts/ptool.py'
ptool = ptool.replace('$$', cdir)
msp = '$$/scripts/msp.py'
msp = msp.replace('$$', cdir)
if ARCH_NAME == "ipq806x":
partition_tool = outputdir + '/nor_tool'
else:
partition_tool = outputdir + '/partition_tool'
os.chmod(partition_tool, 0744)
syspart = outputdir + '/norplusemmc-system-partition-' + ARCH_NAME + '.bin'
userpart = 'norplusemmc-user-partition.bin'
norplusemmcuserbin= os.path.splitext(userpart)[0] + ".bin"
print '\tNor page size: ' + str(nor_parts.pagesize) + ', pages/block: ' \
+ str(nor_parts.pages_per_block) + ', total blocks: ' \
+ str(nor_parts.total_blocks) + ', partition info: ' + norplusemmc_partition
print '\tCreating user partition',
prc = subprocess.Popen(['python', mbn_gen, norplusemmc_partition,
norplusemmcuserbin], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create user partition'
return prc.returncode
else:
print '...User partition created'
userpart_path = os.path.join(outputdir, norplusemmcuserbin)
print '\tCreating system partition'
prc = subprocess.Popen([
partition_tool,
'-s',
str(nor_parts.pagesize),
'-p',
str(nor_parts.pages_per_block),
'-b',
str(nor_parts.total_blocks),
'-c',
str(1),
'-u',
userpart_path,
'-o',
syspart,
], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create system partition'
return prc.returncode
else:
print '...System partition created'
print '\tCreating rawprogram1.xml and patch1.xml',
prc = subprocess.Popen(['python', ptool, '-x', emmc_partition, '-p', '1'], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create rawprogram1.xml and patch1.xml'
return prc.returncode
else:
print '...rawprogram1.xml and patch1.xml created'
rawprogram_path = os.path.join(outputdir, 'rawprogram1.xml')
patch_path = os.path.join(outputdir, 'patch1.xml')
print '\t rawprogram' + rawprogram_path
print '\t patch' + patch_path
print '\tRunning msp.py to update gpt_main0.bin partition',
prc = subprocess.Popen([
'python',
msp,
'-r',
rawprogram_path,
'-p',
patch_path,
'-d',
str(emmc_total_blocks),
'-n',
], cwd=outputdir)
prc.wait()
if prc.returncode != 0:
print 'ERROR: unable to create system partition'
return prc.returncode
else:
print '...System partition created'
return 0
def main():
global cdir
global ARCH_NAME
global outputdir
funcdict = {
'nor': process_nor,
'tiny-nor': process_nor,
'nand': process_nand,
'norplusnand': process_norplusnand,
'emmc': process_emmc,
'norplusemmc': process_norplusemmc,
'tiny-nor-debug': process_nor
}
if len(sys.argv) > 1:
try:
opts, args = getopt(sys.argv[1:], "c:f:o:")
except GetoptError, e:
print "Configuration xml, flash type and output path are needed to generate cdt files"
raise
for option, value in opts:
if option == "-c":
config_path = value
if option == "-o":
outputdir = value
if option == "-f":
flash_type = value
print flash_type
else:
print "Configuration xml, flash type and output path are needed to generate cdt files"
if funcdict[flash_type](config_path, flash_type) < 0:
return -1
if __name__ == '__main__':
main()

View File

@ -0,0 +1,178 @@
# ===========================================================================
#Copyright (c) 2017 Qualcomm Technologies, Inc.
#All Rights Reserved.
#Confidential and Proprietary - Qualcomm Technologies, Inc.
# ===========================================================================
import re
import sys
c_file_name = "boot_cdt_array.c"
debug = True
if len(sys.argv) < 3:
print "Usage: cdt_generator.py filename.xml binfile.bin"
sys.exit(1);
filename = sys.argv[1]
bin_file_name = sys.argv[2]
token_stack = []
ignore_tags = ['comment', 'img_name', 'layout']
xml_comment_tag = '!--'
partitions_parent_tag_name = "partition"
partition_table_header_size = 16
partition_entry_size = 28
num_partition_entries = 32
full_file_length = (partition_table_header_size + (partition_entry_size * num_partition_entries))
header = []
metadata = []
blockdata = []
footer = []
all_data = []
def clean_string(some_string):
from string import printable
some_string = "".join([ ch for ch in some_string if ch in printable ])
some_string = some_string.replace("\n", "")
some_string = some_string.replace("\r", "")
return some_string
def strip_hex(hex_string):
if len(hex_string) < 3 or not (hex_string[:2] == "0x" or hex_string[:2] == "0X"):
return hex_string
return hex_string[2:]
def little_endian(hex_string):
if len(hex_string) % 2 != 0:
print "%s is an invalid value to convert to little endian!" % (hex_string)
return
swap_list = []
for i in range(0, len(hex_string), 2):
swap_list.insert(0, hex_string[i:i+2])
return ''.join(swap_list)
def get_attribute(token, att_name):
tag = get_tag_name(token)
tag_att_list = re.split('\s+', strip_tags(token))
tag_att_list.remove(tag)
for att in tag_att_list:
att_val = att.split("=")
if len(att_val) == 2 and att_val[0] == att_name:
return att_val[1].strip('"').strip("'")
return None
def pad_string(token, length, rightjust=True):
if len(token) >= length:
return token
else:
return (rightjust and token.rjust(length, '0') or token.ljust(length, '0'))
def is_tag(token):
return (len(token) > 2 and token[0] == '<' and token[-1] == '>')
def strip_tags(token):
if is_tag(token):
return token[1:-1]
def is_closing_tag(token):
return (is_tag(token) and token[1] == '/')
def get_tag_name(tag):
if is_closing_tag(tag):
return tag[2:-1]
else:
tag_split = re.split('\s+', tag[1:-1])
return tag_split[0]
def process_tag(tag):
tag_name = get_tag_name(tag)
parent_tag_name = len(token_stack) >= 2 and get_tag_name(token_stack[-2]) or ""
if is_closing_tag(tag):
if tag_name == partitions_parent_tag_name:
if len(metadata) == 0:
metadata.append(1)
else:
metadata[0] = metadata[0] + 1
def process_data(data, token_stack):
tag = token_stack[-1]
tag_name = get_tag_name(tag)
parent_tag_name = len(token_stack) >= 2 and get_tag_name(token_stack[-2]) or ""
if tag_name in ignore_tags:
return
clean_data = data
data_length = get_attribute(tag, "length")
data_type = get_attribute(tag, "type")
if not data_type == "string":
clean_data = "%02X" % eval(clean_data)
else:
clean_data = "".join(["%02x" % ord(x) for x in clean_data])
if not data_length is None:
data_length = int(data_length)
clean_data = pad_string(clean_data, data_length * 2, data_type != "string")
data_endianness = get_attribute(tag, "endian")
# assuming big-endian by default
# assuming 'string's need to be converted to little endian
if not data_type == "string" or ((not data_endianness is None) and data_endianness.lower() == "little"):
clean_data = little_endian(clean_data)
if not parent_tag_name == partitions_parent_tag_name:
header.append(clean_data)
else:
blockdata.append(clean_data)
def generate_metadata():
if len(metadata) > 0:
metadata[0] = little_endian(pad_string("%02X" % metadata[0], 4*2))
def generate_footer():
current_file_len = 0
for x in all_data:
current_file_len = current_file_len + len(x)/2
footer.append("0" * 2 * (full_file_length - current_file_len))
def write_bin_file(filename, data):
fp = open(filename, 'wb')
for i in range(0, len(data), 2):
data_item = data[i:i+2]
fp.write(chr(int(data_item, 16)))
fp.close()
file_string = open(filename, 'r').read()
file_string = re.sub(r'>\s+', ">", file_string)
file_string = re.sub(r'\s+<', "<", file_string)
file_string = clean_string(file_string)
# A token is either a tag i.e. <[^>\s]*> or it is a (non-tag) value i.e. [^<>]+
#splitter = re.compile('(<\/?\S+[^>]*>|[^<>]+)')
splitter = re.compile('(<[^>]*>|[^<>]+)')
token_list = splitter.findall(file_string)
for token in token_list:
#print "Processing", token
if is_tag(token):
if get_tag_name(token) == xml_comment_tag or get_tag_name(token) == "?xml":
continue
if is_closing_tag(token):
token_stack.pop()
else:
token_stack.append(token)
process_tag(token)
else:
process_data(token, token_stack)
generate_metadata()
all_data.extend(header)
all_data.extend(metadata)
all_data.extend(blockdata)
generate_footer()
all_data.extend(footer)
all_data = "".join(all_data)
write_bin_file(bin_file_name, all_data)

1
命令.txt Normal file
View File

@ -0,0 +1 @@
python prepareSingleImage.py --arch ipq6018 --fltype nand --genpart

3
说明.txt Normal file
View File

@ -0,0 +1,3 @@
修改nand-partition.xml
运行命令
找到nand-system-partition-ipq6018.bin