Petalinux EMMC启动(qspiflash存BOOT.bin,emmc存image.ub和rootfs)

环境:petalinux 2018.3

实现目的:在Petalinux下,qspiflash存储BOOT.bin,EMMC的blk0存储image.ub,blk1存储rootfs。

前提:该文档描述的方式需要开发板支持SD卡启动。即ZYNQ的SDC0接SD卡,SDC1接EMMC。

Petalinux 配置

petalinux-config

->Subsystem AUTO Hardware Setting 

-> Advanced bootable images storage settings

-> boot image settings;

选择primary flash,这里是将BOOT.bin设置为从qspi flash启动

image-20220508204338936

->Subsystem AUTO Hardware Setting 

->Advanced bootable images storage settings

->kernel image settings;

选择primary sd,实际就是设置image.ub的存放区域。

img

image-20220508183323573

Subsystem AUTO Hardware Settings ---> SD/SDIO Settings ---> Primary SD/SDIO

从SD卡启动的系统选择:

Primary SD/SDIO (ps7_sd_0)

从eMMC引导的系统选择:

Primary SD/SDIO (ps7_sd_1)

对于从eMMC引导的系统,即便选择了Primary SD/SDIO (psu_sd_1),仍然不能完全启动,需要从文件

<plnx-proj-root>/project-spec/meta-plnx-generated/recipes-bsp/u-boot/configs/platform-auto.h

里,复制U-boot环境参数定义部分内容:

#define CONFIG_EXTRA_ENV_SETTINGS 该宏的参数

到文件

<plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h

中,并将后者全部 “mmcinfo” 修改为 “mmc dev ${sdbootdev}” ,共5处

关于SD和EMMC设备的说明:

首先需要明确:

img

关于Flash分区的说明:

img

在petalinux配置里看到的parttion0,1,2,3 的字样,其实就是在linux系统里面对应的设备是/dev/mtd0,/dev/mtd1,/dev/mtd2,/dev/mtd3。

image-20220508205933394

Linux下格式化EMMC

格式化EMMC第一个BOOT分区为FAT32,用于存放image.ub。第二个分区为EXT4格式用于存放根文件系统。

切记输入 w保存配置。。。。。。

格式化之前如果之前已经分区过,首先需要umount,然后使用fdisk删除分区(d指令)

mkdosfs -F 32 /dev/mmcblk1p1 格式化为FAT32格式。

mkfs.ext4 /dev/mmcblk1p2 格式化为EXT4格式

格式为第一个分为为FAT32

格式化第一块分区,为FAT32格式,大小为128MB

root@MZ702P_FEP:~# fdisk /dev/mmcblk1

Device contains neither a valid DOS partition table, nor Sun, SGI, OSF or GPT disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that the previous content

won't be recoverable.

`` 

`` 

The number of cylinders for this disk is set to 232448.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

\1) software that runs at boot time (e.g., old versio
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值