这种一般是在工厂测试,为了提高效率 使用的
之前有写过一个,把SD卡制作好,然后通过另外分区, 加载到SD卡也能启动系统,但是这个有一个缺点,就是文件系统不能使用镜像直接烧了,要使用Linux拷贝文件到exit4中,
这样比较麻烦,今天记录一下在之前的基础上 实现 镜像的统一
参照这里把除了文件系统以外的uboot zImage相关的文件制作好,文件系统镜像留着
完成以上的步骤,得到
zImag MLO **.dtb u-boot.img
这里主要是修改bootargs启动参数
接下来就是分区合并了
命令操作如下:
sudo dd if=/dev/zero of=my.img bs=1M count=200
sudo losetup -f --show my.img
通过 fdisk 命令对磁盘文件进行分区,就跟普通磁盘文件一样。
sudo fdisk /dev/loop0
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x2e7df78e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n # 新建一个分区
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p # 主分区
Partition number (1-4, default 1): 1 # 分区号
First sector (2048-409599, default 2048): # 默认2048
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-409599, default 409599): +30M
# 给30M空间第一个分区
Command (m for help): n # 新建一个分区
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p # 主分区
Partition number (1-4, default 2): # 使用默认的2
Using default value 2
First sector (63488-409599, default 63488): # 使用默认值
Using default value 63488
Last sector, +sectors or +size{K,M,G} (63488-409599, default 409599): # 直接到结束
Using default value 409599
Command (m for help): t # 改变分区
Partition number (1-4): 1 # 改变第几个分区
Hex code (type L to list codes): e # 改为FAT16分区
Changed system type of partition 1 to e (W95 FAT16 (LBA))
Command (m for help): a # 增加boot 属性
Partition number (1-4): 1 # 指定第一个分区增加boot 属性
ommand (m for help): w # 保存相关信息
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
sudo kpartx -av /dev/loop0
sudo mkfs.vfat -n "boot" -F 16 /dev/mapper/loop0p1
sudo mkfs.ext3 -L "rootfs" /dev/mapper/loop0p2
接着挂载在p1 p2 上,首先新建两个文件夹 p1 p2
sudo mount /dev/mapper/loop0p1 p1
sudo mount /dev/mapper/loop0p2 p2
sync
就是复制你的镜像文件到对应的分区,把除了文件系统的文件,复制到p1 ,文件系统下的文件 复制到p2
然后解除挂载
sudo umount p1 p2
sudo kpartx -d /dev/loop0
sudo losetup -d /dev/loop0
就可以把第一步制作的my.img 拷贝出去,正常烧录
标签:409599,default,分区,sudo,dev,linux,table,arm,SD
来源: https://www.cnblogs.com/ChenChangXiong/p/12613760.html