1# short-description: Create an image for eMMC
2# long-description: Creates an eMMC card image for the User Data Area that can
3# be used with the Nuvoton SoC family.
4#
5# Assumes a minimum flash size of 1GB.
6# Assumes U-Boot is stored elsewhere, such as an eMMC boot volume or NOR flash.
7#
8#  --- - ---------- -------- -------- -------- -------- ------ -------
9# |GPT| | reserved | boot-a | boot-b | rofs-a | rofs-b | rwfs |GPT-sec|
10#  --- - ---------- -------- -------- -------- -------- ------ -------
11#       ^   1MB       64MB     64MB    256MB    256MB    256MB
12#       |
13#       0x5000
14#
15# Primary GPT size (Beginning of image):
16# 512B (Protective MBR) + 512B (Primary Header) + 16KB (Primary Table)
17# First partition (u-boot-env) is 4K-aligned, which puts it at offset 0x5000
18#
19# Secondary GPT size (End of image):
20# 16KB (Secondary Table) + 512B (Secondary Header)
21
22bootloader --ptable gpt
23
24# Hint: bootimg-partition size must be same as MMC_BOOT_PARTITION_SIZE
25# Note: the partition layout above is SoC default value, it may change by user
26#       set WKS_ROFS_SIZE, WKS_RWFS_SIZE or MMC_BOOT_PARTITION_SIZE.
27part --align 4 --fixed-size 1M
28part --fstype=ext4 --fixed-size ${MMC_BOOT_PARTITION_SIZE}K --source bootimg-partition --label boot-a
29part --fstype=ext4 --fixed-size ${MMC_BOOT_PARTITION_SIZE}K --source bootimg-partition --label boot-b
30part --fstype=ext4 --fixed-size ${WKS_ROFS_SIZE} --source rootfs --label rofs-a
31part --fstype=ext4 --fixed-size ${WKS_ROFS_SIZE} --source rootfs --label rofs-b
32part --fstype=ext4 --fixed-size ${WKS_RWFS_SIZE} --label rwfs
33