You can customize the partition table of a Digi embedded module using a series of U-Boot commands.
The eMMC is partitioned using a GPT. The partition table (partition names, sizes, and UUIDs) is described in a U-Boot environment variable.
The syntax for describing a GPT as a string is defined at doc/README.gpt file in the U-Boot source code:
Format of partitions layout:
"partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
name=kernel,size=60MiB,uuid=...;"
or
"partitions=uuid_disk=${uuid_gpt_disk};name=${uboot_name},
size=${uboot_size},uuid=${uboot_uuid};"
The fields 'name' and 'size' are mandatory for every partition.
The field 'start' is optional.
The fields 'uuid' and 'uuid_disk' are optional if CONFIG_RANDOM_UUID is
enabled. A random uuid will be used if omitted or they point to an empty/
non-existent environment variable. The environment variable will be set to
the generated UUID.
A size of - (without the MiB suffix) indicates that the partition will use the remaining available space on the media, so the dash is usually used for the last partition in the table.
|
Once the partition table is defined as a string, you can write the partition table to the media using U-Boot’s gpt
command.
Digi provides the following predefined variables to help define the partition table:
-
Partition tables
-
parts_linux_dualboot
: partition table for a dual boot system. See Dual boot for more information. -
parts_linux
: partition table for single system.
-
-
UUIDs
-
uuid_disk
: predefined UUID for the media. -
part1_uuid..partN_uuid
: predefined UUIDs for the partitions.
-
-
Scripts
-
partition_mmc_linux
: script for writing the partition table stored in variableparts_linux_dualboot
orparts_linux
to the MMC device index in variablemmcdev
.
-
Change the partition table (run-time)
-
Edit the partition table with
env edit
command.-
For dual boot system:
=> env edit parts_linux_dualboot
-
For single system:
=> env edit parts_linux
-
-
Modify the command to fit your desired partition table, but note the following:
-
Do not change the names of the system partitions. These partitions are meant to have their original names for system updates to work.
-
For dual boot system, these are: safe, safe2, linux_a, linux_b, rootfs_a, rootfs_b, data.
-
For single system, these are: safe, safe2, linux, recovery, rootfs, update, data.
-
-
You can resize system partitions, but make sure your system will fit in them.
-
For single system, the update partition must be approximately the size of the rootfs partition to fit system updates.
-
You can add partitions as necessary, but you must assign a different name and UUID.
-
-
(Optional) Set
mmcdev
to the desired media. By default this variable should point to the MMC media index you are booting from (eMMC or microSD). You don’t need to setmmcdev
unless you want to write the GPT to a specific MMC media other than the one you booted from. -
Save the environment with
saveenv
. -
Run the script to write the new partition table to the MMC media:
=> run partition_mmc_linux
The script checks variable On the ConnectCore 6, |
Change the default partition table (build-time)
You may want to change the default partition table so that all devices ship with the same partition layout. To do that:
-
Open your platform’s common header file in U-Boot source code at
include/configs/ccimx6_common.h
. -
Locate the partition table definition for your module’s eMMC capacity:
-
For dual boot system, these are:
-
LINUX_DUALBOOT_4GB_PARTITION_TABLE
-
LINUX_DUALBOOT_8GB_PARTITION_TABLE
-
LINUX_DUALBOOT_16GB_PARTITION_TABLE
-
-
For single system, these are:
-
LINUX_4GB_PARTITION_TABLE
-
LINUX_8GB_PARTITION_TABLE
-
LINUX_16GB_PARTITION_TABLE
-
-
-
Edit the appropriate constant in the header file using the syntax described in Change the partition table (run-time). For instance:
#define LINUX_8GB_PARTITION_TABLE \ "\"uuid_disk=${uuid_disk};" \ "start=2MiB," \ "name=linux,size=64MiB,uuid=${part1_uuid};" \ "name=recovery,size=64MiB,uuid=${part2_uuid};" \ "name=rootfs,size=3GiB,uuid=${part3_uuid};" \ "name=update,size=3GiB,uuid=${part4_uuid};" \ "name=safe,size=16MiB,uuid=${part5_uuid};" \ "name=safe2,size=16MiB,uuid=${part6_uuid};" \ "name=data,size=-,uuid=${part7_uuid};" \ "\""
-
Save your changes and recompile U-Boot.
-
Update the bootloader of your device and reboot it.
-
Reset the variable to default value:
# Reset variable for dual boot system => env default parts_linux_dualboot # Reset variable for single system => env default parts_linux
You can also reset the whole environment to default values:
=> env default -a
-
Save the environment with
saveenv
. -
Reset the device (or verify that
mmcdev
points to the MMC index of the media where the partition table will be written) -
Write the new partition table to the media:
=> run partition_mmc_linux
The
|