android:imx8qm平台下spi_norflash启动kernel

思路是这样:
    板子本身是支持emmc启动。另外norflash很小。目前计划是装入U-boot即可.
    首先要保证u-boot的img放在nor_flash里面:
      我的做法是:通过dd命令写入nor_flash分区
      在android正常从emmc上启动以后;
      dd if=/dev/zero of=/dev/block/mtdblock0
      dd if=/data/u-boot-imx8qm.imx of=/dev/block/mtdblock0 bs=1k seek=4
      dd if=/data/qspi-header of=/dev/block/mtdblock0 bs=1k seek=1

这里面:

      1. u-boot-imx8qm.imx编译的时候需要修改参数,目标文件是device/fsl/vinson/AndroidUboot.mk
          

 device/fsl/vinson/AndroidUboot.mk:
 cp$(FSL_PROPRIETARY_PATH)/fsl-proprietary/uboot-firmware/imx8q/mx$$SCFW_PLATFORM-scfw-tcm.bin $(IMX_MKIMAGE_PATH)/imx-mkimage/$$MKIMAGE_PLATFORM/scfw_tcm.bin; \
       cp  $(FSL_PROPRIETARY_PATH)/fsl-proprietary/uboot-firmware/imx8q/bl31-$(strip $(2)).bin $(IMX_MKIMAGE_PATH)/imx-mkimage/$$MKIMAGE_PLATFORM/bl31.bin; \
                     $(MAKE) -C $(IMX_MKIMAGE_PATH)/imx-mkimage/ clean; \
                     $(MAKE) -C $(IMX_MKIMAGE_PATH)/imx-mkimage/ SOC=$$MKIMAGE_PLATFORM flash; \
                     cp $(IMX_MKIMAGE_PATH)/imx-mkimage/$$MKIMAGE_PLATFORM/flash.bin $(PRODUCT_OUT)/u-boot-$(strip $(2)).imx;
            +        $(MAKE) -C $(IMX_MKIMAGE_PATH)/imx-mkimage/ clean; \
            +        $(MAKE) -C $(IMX_MKIMAGE_PATH)/imx-mkimage/ SOC=$$MKIMAGE_PLATFORM flash_flexspi; \
            +        cp $(IMX_MKIMAGE_PATH)/imx-mkimage/$$MKIMAGE_PLATFORM/flash.bin $(PRODUCT_OUT)/u-boot-$(strip $(2))_flexspi.imx;
             endef


        生成需要的flex_spi uboot

      2. 需要在boot之前的地址增加qspi-header的文件:
            qspi-header是根据mfg里面的ucl2_classic.xml里面的命令生成的
                                                            [源文件是qspi-header.sh.tar,ucl2_classic.xml,都在mfg工具里面]
                                                            qspi包里面还有指定nor_flash的config文件


      3. 硬件是要短接,保证走spi流程启动[需要跳帽]

修改:
uboot/arch/arm/cpu/armv8/imx8/cpu.c
@@ -802,6 +802,7 @@ int mmc_get_env_dev(void)

            switch(dev_rsrc) {
            case SC_R_SDHC_0:
    +       case SC_R_FSPI_0:
                   devno = 0;
                   break;
            case SC_R_SDHC_1:
    

uboot/common/image-android.c
@@ -109,7 +109,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
                sprintf(newbootargs,
                        " androidboot.storage_type=sd");
        } else if (bootdev == MMC1_BOOT || bootdev == MMC2_BOOT ||
                bootdev == MMC3_BOOT || bootdev == MMC4_BOOT) {
+               bootdev == MMC3_BOOT || bootdev == MMC4_BOOT || bootdev == FLEXSPI_BOOT) {
                sprintf(newbootargs,
                        " androidboot.storage_type=emmc");
        } else if (bootdev == NAND_BOOT) {
    

uboot/drivers/usb/gadget/f_fastboot.c
    @@ -1189,6 +1189,7 @@ void board_fastboot_setup(void)
            case MMC2_BOOT:
            case MMC3_BOOT:
            case MMC4_BOOT:
    +       case FLEXSPI_BOOT:
                    dev_no = mmc_get_env_dev();
                    sprintf(boot_dev_part,"mmc%d",dev_no);
                    if (!getenv("fastboot_dev"))

按照以上流程修改完毕。能够保证uboot流程里面拥有一条nor_引导emmc启动kernel的通路。

你可能感兴趣的:(bootloader)