Skip to content
Guoxin Pu edited this page Sep 24, 2022 · 2 revisions

WARNING: THIS WIKI IS ONLY INTENDED TO BE USED WITH AMPART PRIOR TO COMMIT 2706de76d36d0663eb2d352cc197a3d236c7a490 (v0.1.1), FOR DOCUMENTATION OF THE CURRENT VERSION, READ THE DOC IN THE REPO DIRECTLY

The Command-Line Interface (CLI) of ampart is very simple, but it is very powerful

ampart [reserved/emmc] ([partition] ...) ([option [optarg]]...) 

Positional Arguments:

Arguments with * are required. The order of positional arguments matters

  • reserved/emmc* the path to /dev/reserved or /dev/mmcblkN or any image file you dumped from them (e.g. via dd if=/dev/mmcblk0 of=emmc.img, or dd if=/dev/reserved of=reserved.img).
    Whether it's a whole emmc disk or a reserved partition will be identified by its name and header, but you can also force its type by options --reserved / -r or --disk / -d
  • partition the partition(s) you would like to create/update/delete/clone, depending on the Major Mode You are using ampart for. Please check the Partition Argument document for the syntax

In-positional Arguments (options):

The order of most positional arguments does not matter, except those that'll early quit

Common options

  • --version/-v print the version info and early quit
  • --help/-h print a help message and early quit

Target options

  • --disk/-d force ampart to treat input as a whole emmc disk, conflicts with --reserved/-r
  • --reserved/-r force ampart to treat input as a reserved partition, conflicts with --disk/-d
  • --offset/-O [offset] will overwrite the default offset of the reserved partition
    • only valid when input is a whole emmc disk
    • only make sense if your OEM has modified it (e.g. Xiaomi set it to 4M, right after the bootloader)
    • default: 36M

Major Mode options

Check Major Mode for the details about the 3 modes: Normal Mode, Clone Mode and Update Mode

  • --clone/-c enable clone mode, conflicts with --update/-u
  • --update/-u enable update mode, conflicts with --clone/-c

Minor Mode options

Check Minor Mode for the details about the 2 modes: Dry-run Mode and Snapshot Mode

  • --snapshot/-s enable Snapshot Mode, early quit
  • --dry-run/-D enable Dry-run Mode, early quit

Device options

  • --no-node/-N don't try to remove partitions node from dtb
  • --partprobe/-p inform kernel about partition layout changes of the emmc (so you can use new partitions immediately). ampart auto does this when you update the part table so there is no nuch need to call this unless you run it with --no-reload/-n
  • --no-reload/-n do not notify kernel about the partition layout changes, remember to end your session with a --partprobe call if you are calling ampart for multiple times and don't want it to force the kernel to reload the partitions table every time (e.g. in a script, where you want to do stuffs in the GNU/parted -s way)

Examples

Print the partition table of /dev/mmcblk0

ampart /dev/mmcblk0

Print the partition table of underlying disk of /dev/reserved

ampart /dev/reserved

Create a single data partition on /dev/mmcblk0 to utilize all the space

ampart /dev/mmcblk0 data:::

Create a 2G system partition, mask2, and a data partition to utilize all the remaining space

ampart /dev/mmcblk0 system::2G:2 data:::

Same as the last one, except we leave a 8M gap before the 2 partitions, like some OEMs would do

ampart /dev/mmcblk0 system:+8M:2G:2 data:+8M::

A layout for EmuELEC

ampart /dev/mmcblk0 system::2G:2 data::2G: eeroms:::

Recreate a previous taken snapshot

ampart /dev/mmcblk0 --clone bootloader:0B:4M:0 reserved:36M:64M:0 cache:108M:512M:2 env:628M:8M:0 logo:644M:32M:1 recovery:684M:32M:1 rsv:724M:8M:1 tee:740M:8M:1 crypt:756M:32M:1 misc:796M:32M:1 boot:836M:32M:1 system:876M:2G:1 data:2932M:4524M:

Shrink, clone data, then create CE_FLASH, just like ceemmc in dual boot mode

ampart --update /dev/mmcblk0 ^-1:::-512M: ^-1%:CE_STORAGE CE_FLASH:::

Clone this wiki locally