Skip to content

# 20.2. J6X Acore Board Id 修改适配

## 20.2.1. Acore SPL&UBOOT 修改适配

- 文件路径： `uboot/arch/arm/dts/Makefile`

- 功能说明：添加对应的uboot的dtb

- 添加说明：新增一组uboot dtb

    dtb-$(CONFIG_HOBOT_J6E) += hobot-j6e-qemu.dtb \
        hobot-j6e-matrix.dtb \
        hobot-j6e-matrixA.dtb \
        hobot-j6e-matrixLX.dtb \
        ......

- 文件路径： `uboot/configs/hobot_j6e_evm_defconfig`

- 功能说明：在CONFIG_OF_LIST中添加对应的uboot dtb

- 添加说明：新增一组uboot dtb至CONFIG_OF_LIST中

    CONFIG_OF_LIST="hobot-j6e-evm hobot-j6e-matrix hobot-j6e-matrixA hobot-j6e-matrixLX hobot-j6e-matrix-sip hobot-j6e-matrix-sipA hobot-j6e-galaxy"

- 文件路径： `uboot/arch/arm/mach-hobot/j6/boot_info.c`

- 功能说明：添加对应的boardid以及main域的启动方式（emmc|ufs|strappin）

- 添加说明：新增一组boardid以及main域启动方式

    const static struct hb_j6x_btype_node hb_j6x_btype_list[] = {
        {0x3, 0x9, "strappin"},
        {0x4, 0x2, "strappin"},
        {0x4, 0x3, "strappin"},
        ......
    };

- 文件路径： `uboot/arch/arm/mach-hobot/j6/boot_info.c`

- 功能说明：添加对应的boardinfo,可以传递到内核

- 添加说明：新增一组boardinfo

    struct hb_boardinfo_t g_board_info[BOARD_TYPE_NUM] = {
        /* J6E CVB */
        {0x22, "J6E", "CVB", "rc", "V1.0"},
        {0x23, "J6E", "CVB", "ep", "V1.0"},
        /* J6E/M EVM */
        {0x30, "J6M", "EVM", "ep", "V1.0"},
        {0x39, "J6M", "EVM", "rc", "V1.0"},
        ......

- 文件路径： `uboot/arch/arm/mach-hobot/j6/j6x_board.c`

- 功能说明：添加对应的boardid，uboot使用的dtb，内核使用的extlinux label

- 添加说明：新增一组boardid以及对应的uboot和内核的启动项

    const static struct hb_j6x_btype_node hb_j6x_btype_list[] = {
        {0x3, 0x9, "hobot-j6e-evm", "j6e-evm-kernel"},
        {0x4, 0x2, "hobot-j6e-matrixA", "j6e-matrixA-kernel"},
        {0x4, 0x3, "hobot-j6e-matrixA", "j6e-matrixA-kernel"},
        ......
    };

## 20.2.2. Acore DDR Board ID 修改适配

- 文件路径： `hbbin/ddr/drivers/ddr/sys/sys_board_id_config.c`。

- 功能说明：添加DDR Board ID对应的DDR类型、Rank类型以及Swap类型。

- 添加说明：根据DDR Board ID对应的DDR信息，新增一组boardid以及对应的DDR类型、Rank类型以及Swap类型。

    static const struct pcb_info pcb_info_table[] = {
        {0,     40,     LPDDR4,         SINGLE_RANK,    SWAP_TYPE0,},
        {41,    80,     LPDDR4,         DUAL_RANK,      SWAP_TYPE0,},
        {81,    140,    LPDDR4,         SINGLE_RANK,    SWAP_TYPE1,},
        ......
    };

## 20.2.3. Acore Build系统修改适配

- 文件路径： `device/horizon/j6/extlinux/j6e_extlinux`

- 功能说明：根据uboot通过boardid判断板子类型，选择出的label，获取内核启动相关参数配置

- 添加说明：新增一个对应boardid的label，并提供内核启动相关参数配置

    label j6e-matrix-kernel
        kernel /KERNEL_IMAGE
        fdt /hobot/hobot-j6e-matrix.dtb
        initrd /UBUNTU_RAMDISK

## 20.2.4. Kernel Dts修改适配

- 文件路径： `hobot-drivers/kernel-dts/`

- 功能说明：通过boardid判断板子类型获取的内核启动相关参数，提供对应名称的dts文件

- 添加说明：新增一个j6e_extlinux中对应dtb名称的dts文件，并在Makefile中添加新dts对应编译命令

    dtb-$(CONFIG_ARCH_HOBOT) += hobot-j6e-matrix.dtb

## 20.2.5. Dfu下载脚本修改适配

### 20.2.5.1. usb_serial_download.sh

- 文件路径： `tools/misc_tools/xmodem_tools/usb_serial_download.sh`

- 功能说明：使用USB下载方式时，USB驱动可以根据boardid打印出对应板子类型，脚本根据板子类型选择对应MCU镜像

- 添加说明：在get_mcu_img函数中添加数组中添加板子类型对应MCU镜像名称

    get_mcu_img() {
        if [[ $1 == *"J6M EVM"* ]]; then
            mcu_bin="J6M_MCU_EVM_V1.0.bin"
        elif [[ $1 == *"J6M Matrix V1.0"* ]]; then
            mcu_bin="J6M_MCU_Matrix_V1.0.bin"
        elif [[ $1 == *"J6M Matrix V1.1"* ]]; then
            mcu_bin="J6M_MCU_Matrix_V1.1.bin"
        elif [[ $1 == *"J6M SIP_Matrix V1.0"* ]]; then
            mcu_bin="J6M_MCU_SIP_Matrix_V1.0.bin"
        elif [[ $1 == *"J6M SIP_Matrix V1.1"* ]]; then
            mcu_bin="J6M_MCU_SIP_Matrix_V1.1.bin"
        elif [[ $1 == *"J6M Matrix_LX V1.1"* ]]; then
            mcu_bin="J6M_MCU_Matrix_LX_V1.1.bin"
        elif [[ $1 == *"J6E Matrix V1.0"* ]]; then
            mcu_bin="J6E_MCU_Matrix_V1.0.bin"
        elif [[ $1 == *"J6E Matrix V1.1"* ]]; then
            mcu_bin="J6E_MCU_Matrix_V1.1.bin"
        elif [[ $1 == *"J6E SIP_Matrix V1.1"* ]]; then
            mcu_bin="J6E_MCU_SIP_Matrix_V1.1.bin"
        elif [[ $1 == *"J6E Matrix_LX V1.1"* ]]; then
            mcu_bin="J6E_MCU_Matrix_LX_V1.1.bin"
        else
            echo "!! no mcu interface or mcu interface not support now !!"
            echo "!! run dfu-util -l to check your board type and add it in this script !!"
            exit 1
        fi
    }

### 20.2.5.2. usb_serial_download_secure.sh

- 文件路径： `tools/misc_tools/xmodem_tools/usb_serial_download_secure.sh`

- 功能说明：使用USB Secure下载方式镜像时，USB驱动可以根据boardid打印出对应板子类型，脚本根据板子类型选择对应MCU镜像

- 添加说明：在get_mcu_img函数中添加数组中添加板子类型对应MCU镜像名称

    get_mcu_img() {
        if [[ $1 == *"J6M EVM"* ]]; then
            mcu_img="MCU_J6M_EVM_V1.0.img"
        elif [[ $1 == *"J6M Matrix V1.0"* ]]; then
            mcu_img="MCU_J6M_Matrix_V1.0.img"
        elif [[ $1 == *"J6M Matrix V1.1"* ]]; then
            mcu_img="MCU_J6M_Matrix_V1.1.img"
        elif [[ $1 == *"J6M SIP_Matrix V1.0"* ]]; then
            mcu_img="MCU_J6M_SIP_Matrix_V1.0.img"
        elif [[ $1 == *"J6M SIP_Matrix V1.1"* ]]; then
            mcu_img="MCU_J6M_SIP_Matrix_V1.1.img"
        elif [[ $1 == *"J6M Matrix_LX V1.1"* ]]; then
            mcu_img="MCU_J6M_Matrix_LX_V1.1.img"
        elif [[ $1 == *"J6E Matrix V1.0"* ]]; then
            mcu_img="MCU_J6E_Matrix_V1.0.img"
        elif [[ $1 == *"J6E Matrix V1.1"* ]]; then
            mcu_img="MCU_J6E_Matrix_V1.1.img"
        elif [[ $1 == *"J6E SIP_Matrix V1.1"* ]]; then
            mcu_img="MCU_J6E_SIP_Matrix_V1.1.img"
        elif [[ $1 == *"J6E Matrix_LX V1.1"* ]]; then
            mcu_img="MCU_J6E_Matrix_LX_V1.1.img"
        else
            echo "!! no mcu interface or mcu interface not support now !!"
            echo "!! run dfu-util -l to check your board type and add it in this script !!"
            exit 1
        fi
    }