[ 物联网篇 ] 10 - NXP i.MX8M Mini 烧录固件

2019-07-02 18:06:31 浏览数 (2)

NXP i.MX8M Mini烧录固件的方式主要通过uuu工具进行烧录, 这个工具本身开源,但是提供给开发者烧录的方式及其不友好, 不得不吐槽。

烧录固件

如果没有uuu的文档,真心看不懂uuu.auto的语法。其中应该主要是为兼容Linux烧录,封装了fastboot协议而写的一套规则。

烧录固件 : uuu uuu.auto

代码语言:javascript复制
uuu.auto 
uuu_version 1.0.1

SDP: boot -f imx-boot-imx8mmevk-sd.bin-flash_evk
# This command will be run when use SPL
SDPU: delay 1000
SDPU: write -f imx-boot-imx8mmevk-sd.bin-flash_evk -offset 0x57c00
SDPU: jump
# This command will be run when ROM support stream mode
SDPS: boot -f imx-boot-imx8mmevk-sd.bin-flash_evk

FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev ${emmc_dev}
FB: ucmd mmc dev ${emmc_dev}
#FB: flash -raw2sparse all sdcard.img
FB: flash -raw2sparse all core-image-minimal-imx8mmevk-20190521120542.rootfs.sdcard
FB: flash bootloader imx-boot-imx8mmevk-sd.bin-flash_evk
FB: ucmd mmc partconf ${emmc_dev} 0 1 0
FB: done
  • 调试快速烧录

开发板开机进入uboot界面

代码语言:javascript复制
fastboot ttyUSB1 (指定烧录口)

PC端通过uuu运行

代码语言:javascript复制
uuu FB: flash -raw2sparse all sdcard.img`
系统分区

一般的系统分区可以通过dts中的参数配置,比如Amlogic A113X

代码语言:javascript复制
// arch/arm64/boot/dts/amlogic/xxx.dts
	mtd_nand {
		compatible = "amlogic, aml_mtd_nand";
		dev_name = "mtdnand";
		status = "disable";
		reg = <0x0 0xFFE07800 0x0 0x200>;
		interrupts = <	0 34 1 >;
		pinctrl-names = "nand_rb_mod","nand_norb_mod", "nand_cs_only";
		pinctrl-0 = <&all_nand_pins>;
		pinctrl-1 = <&all_nand_pins>;
		pinctrl-2 = <&nand_cs_pins>;
		device_id = <0>;

		/*fip/tpl configurations, must be same
		 * with uboot if bl_mode was set as 1
		 * bl_mode: 0 compact mode; 1 descrete mode
		 * if bl_mode was set as 1, fip configeration will work
		 */
		bl_mode = <1>;
		/*copy count of fip*/
		fip_copies = <4>;
		/*size of each fip copy */
		fip_size = <0x200000>;
		nand_clk_ctrl = <0xFFE07000>;
		plat-names = "bootloader","nandnormal";
		plat-num = <2>;
		plat-part-0 = <&bootloader>;
		plat-part-1 = <&nandnormal>;
		bootloader: bootloader{
			enable_pad ="ce0";
			busy_pad = "rb0";
			timming_mode = "mode5";
			bch_mode = "bch8_1k";
			t_rea = <20>;
			t_rhoh = <15>;
			chip_num = <1>;
			part_num = <0>;
			rb_detect = <1>;
		};
		nandnormal: nandnormal{
			enable_pad ="ce0";
			busy_pad = "rb0";
			timming_mode = "mode5";
			bch_mode = "bch8_1k";
			plane_mode = "twoplane";
			t_rea = <20>;
			t_rhoh = <15>;
			chip_num = <2>;
			part_num = <3>;
			partition = <&nand_partitions>;
			rb_detect = <1>;
		};
		nand_partitions:nand_partition{
			/*
			 * if bl_mode is 1, tpl size was generate by
			 * fip_copies * fip_size which
			 * will not skip bad when calculating
			 * the partition size;
			 *
			 * if bl_mode is 0,
			 * tpl partition must be comment out.
			 */
			tpl{
				offset=<0x0 0x0>;
				size=<0x0 0x0>;
			};
			logo{
				offset=<0x0 0x0>;
				size=<0x0 0x200000>;
			};
			recovery{
				offset=<0x0 0x0>;
				size=<0x0 0x1000000>;
			};
			boot{
				offset=<0x0 0x0>;
				size=<0x0 0xF00000>;
			};
			system{
				offset=<0x0 0x0>;
				size=<0x0 0x82000000>;
			};
		};
	};

而针对NXP i.MX8M Mini这边,并没有提供DTS的配置方式,而是通过uuu工具来实现的。官方资料中提供了kernel_emmc.uuu参考例子。

代码语言:javascript复制
// create partition
FBK: ucmd mmc=`cat /tmp/mmcdev`; PARTSTR=$'10M,500M,0cn600M,,83n'; echo "$PARTSTR" | sfdisk --force /dev/mmcblk${mmc}

0 人点赞