一、SD卡启动
1. 烧写uboot:sudo dd if=u-boot.imx of=/dev/sdb bs=512 seek=2 skip=0 conv=sync
2. 建立fat分区1:存放zImage、dtb文件,分区可大可小;
3. 建立ext分区2:存放根文件系统。
4. 拨码开关拨到SD启动
二、eMMC启动(SD卡启动后通过命令烧写eMMC)
1. 烧写u-boot,并且设置eMMC启动
#!/bin/bash
dd if=/dev/zero of=/dev/mmcblk3 bs=1k seek=384 conv=fsync count=129
echo 0 > /sys/block/mmcblk3boot0/force_ro
dd if=u-boot.imx of=/dev/mmcblk3boot0 bs=512 seek=2
echo 1 > /sys/block/mmcblk3boot0/force_ro
mmc bootpart enable 1 1 /dev/mmcblk3
2. 建立fat分区1:存放zImage、dtb文件,分区可大可小;
3. 建立ext分区2:存放根文件系统。
4. 拨码开关拨到eMMC启动
三、使用fdisk分区
fdisk /dev/mmcblk3
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (16-28835839, default 16): 2048
Last sector or +size or +sizeM or +sizeK (2048-28835839, default 28835839): 2099200
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First sector (16-28835839, default 16): 2099201
Last sector or +size or +sizeM or +sizeK (2099201-28835839, default 28835839): Using default value 28835839
Command (m for help): p
Disk /dev/mmcblk3: 14.7 GB, 14763950080 bytes
4 heads, 16 sectors/track, 450560 cylinders, total 28835840 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/mmcblk3p1 2048 2099200 1048576+ 83 Linux
/dev/mmcblk3p2 2099201 28835839 13368319+ 83 Linux
Command (m for help): w