Create Snapshot Image With memmap Tools

Last modified by Microchip on 2026/08/17 10:29

Build memmap Tools

If you are using "Load Pre-Saved Snapshot Image Mode", use the memmap tool to generate the required pre-saved snapshot image.

Download the memmap tool from GitHub®. See the GitHub source memmap tools page. 

 


Install memmap tools on Linux®.


Unzip memmap-main.zip.


Run the following command to build mem_map tools:

> make ARCH=x86

Run the following command to test the mem_map tools:

> ./memmap -h

generating the required pre-saved snapshot image with memmap tools

Back to Top

Edit JSON File With memmap Parameters

Edit and update the parameters in snapshot.json. Run the following command to load the parameters in the snapshot.json file:

> ./memmap -e > snapshot.json

This is an example:

cat snapshot.json

{

"ddr-base":            0x60000000,

                "block-size":          0x200,

"block-align":        64,

                "auto-mode":         false,

                "zero-page":          false,

                "secure": false,

                "dump":  false,

                "crc":       false,

                "mem-map":          {

                                "canary": 0x60e08360,

                                "resume":               0x6010ab98,

                                "mem-map":          0x8f7fa000,

                                "max-mapnr":        0x40000,

                                "struct-size":          0x20,

                                "page-shift":          0xc,

                                "page-type":          0xf0,

                                "page-off":             0x18,

                                "order-off":             0x14,

                                "linux-ver":             0x5

                },

                "secure-info":        {

                                "key-size":             192,

                                "key-0":  0x0,

                                "key-1":  0x1,

                                "key-2":  0x2,

                                "key-3":  0x3,

                                "key-4":  0x4,

                                "key-5":  0x5,

                                "key-6":  0x6,

                                "key-7":  0x7,

                                "iv-0":      0x1,

                                "iv-1":      0x2,

                                "iv-2":      0x3,

                                "iv-3":      0x4

                }

}

This is an example:

cat snapshot.json

{

"ddr-base":            0x60000000,

                "block-size":          0x200,

"block-align":        64,

                "auto-mode":         false,

                "zero-page":          false,

                "secure": false,

                "dump":  false,

                "crc":       false,

                "mem-map":          {

                                "canary": 0x60e08360,

                                "resume":               0x6010ab98,

                                "mem-map":          0x8f7fa000,

                                "max-mapnr":        0x40000,

                                "struct-size":          0x20,

                                "page-shift":          0xc,

                                "page-type":          0xf0,

                                "page-off":             0x18,

                                "order-off":             0x14,

                                "linux-ver":             0x5

                },

                "secure-info":        {

                                "key-size":             192,

                                "key-0":  0x0,

                                "key-1":  0x1,

                                "key-2":  0x2,

                                "key-3":  0x3,

                                "key-4":  0x4,

                                "key-5":  0x5,

                                "key-6":  0x6,

                                "key-7":  0x7,

                                "iv-0":      0x1,

                                "iv-1":      0x2,

                                "iv-2":      0x3,

                                "iv-3":      0x4

                }

}
  • ddr-base: DRAM base address
    • 0x20000000 for SAM9X60, SAM9X7 and SAMA5D2
    • 0x60000000 for SAMA7G54 and SAMA7D65
  • block size: the smallest physical storage unit on flash memory
    • 0x200 for SD, eMMC card and Quad Serial Peripheral Interface (QSPI) flash
    • 0x1000 for NAND flash
  • block-align: block size in page
    • 0 for SD™, eMMC card and QSPI flash
    • 64 for NAND flash(for NAND flash, the block size is 0x40000)
  • zero-page:
    • true: enable Zero-Page optimization mode
    • false: disable Zero-Page optimization mode
  • Secure:
    • true: enable secure snapshot mode
    • false: disable secure snapshot mode
  • dump
    • true: outputs the fast boot configuration to the debug console
    • false: does not output any messages
  • crc               
    • true: generate CRC-32 code for snapshot image validation.
    • false: do not generate CRC-32
  • memmap: memory mapping parameters

You can find most of these parameters in the kernel boot console message (requires the Ultra-Fast Boot patch) and use this data to fill the mem-map structure.

For example:

mem-map structure data

  • Canary: canary data for memory checking after exit from backup mode
  • Resume: CPU resume address
  • mem-map: The start virtual address of kernel 'page' structures
  • max-mapnr: The maximum Number of Mapped Pages
  • struct-size: The size of ‘struct page’ structure
  • page-shift: The offset of ‘page-shift’ in ‘struct page’
  • page-type: The offset of ‘page_type’ in ‘struct page’
  • page-off: The offset of ‘page_type’ in ‘struct page’
  • order-off: The offset of ‘private' in ‘struct page’
  • linux-ver: Linux kernel version 
    • 0       Yes             Linux 6.12.48 linux4microchip-2025.10
    • 1       Yes             Linux 6.12.22 linux4microchip-2025.04
    • 2       TBD             Linux 6.11.11
    • 3       TBD             Linux 6.10.14
    • 4       TBD             Linux 6.6.51  linux4microchip-2024.10
    • 5       TBD             Linux 6.6.23  linux4microchip-2024.04
  • secure-info: secure parameters
    • key-size: select the length of the cipher -> 128 | 192 | 256
    • key-x: cipher words
    • iv-x: initialization vector words

Trim and save the Linux runtime snapshot image with:

./memmap -i Input.bin -o Output.bin

Example: Convert ddr-2g-raw.bin and save it as snapshot.bin

Example converting ddr-2g-raw.bin and save it as snapshot.bin

 

Back to Top