1
votes

I am using Yocto and it's wic tool to build my embedded Linux image.

The wic configuration file looks like this:

part /boot --source bootimg-partition --ondisk mmcblk --fstype=msdos --label boot --align 1024 --fixed-size 64
part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root_a --fixed-size 256 --active
part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root_b --fixed-size 256
part /permanent-storage --ondisk mmcblk --fstype=ext4 --label permanent-storage --fixed-size 300
part swap --ondisk mmcblk --size 64 --label swap --fstype=swap

I burn the resulting image to my SD Card and boot successfully, and there is an unexpected small ( 1K ) partition:

root@eval:/dev# ls -lrt /dev/mmcblk0*
brw-rw---- 1 root disk 179, 0 Feb 27 21:55 /dev/mmcblk0
brw-rw---- 1 root disk 179, 4 Feb 27 21:55 /dev/mmcblk0p4
brw-rw---- 1 root disk 179, 2 Feb 27 21:55 /dev/mmcblk0p2
brw-rw---- 1 root disk 179, 3 Feb 27 21:55 /dev/mmcblk0p3
brw-rw---- 1 root disk 179, 5 Feb 27 21:55 /dev/mmcblk0p5
brw-rw---- 1 root disk 179, 1 Feb 27 21:55 /dev/mmcblk0p1
brw-rw---- 1 root disk 179, 6 Feb 27 21:55 /dev/mmcblk0p6
root@eval:/dev# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0     179:0    0 59.6G  0 disk
|-mmcblk0p1 179:1    0   64M  0 part
|-mmcblk0p2 179:2    0  256M  0 part /
|-mmcblk0p3 179:3    0  256M  0 part
|-mmcblk0p4 179:4    0    1K  0 part
|-mmcblk0p5 179:5    0  300M  0 part
`-mmcblk0p6 179:6    0   64M  0 part

Why is wic creating this partition and how can I get rid of it with my wic file? Thanks.

1

1 Answers

2
votes

The mmcblk0p4 (1K) partition is an extended partition. When using a master boot record (MBR) to partition storage into more than 4 partitions one must use 3 primary partitions and 1 extended partition. This is because there is a maximum of 4 primary partitions. The extended partition may hold multiple logical partitions.

mmcblk0         <- Entire Storage
|--mmcblk0p1    <- Primary Partition 1
|--mmcblk0p2    <- Primary Partition 2
|--mmcblk0p3    <- Primary Partition 3
|--mmcblk0p4    <- Extended Partition
   |--mmcblk0p5 <- Logical Partition 1
   |--mmcblk0p6 <- Logical Partition 2

This is not Yocto specific. I use Buildroot and have a similar layout. The commonality is the disk partition method not the Linux distribution.