github.com/amazechain/amc@v0.1.3/docs/installation/build-for-arm-devices.md (about)

     1  # Building for ARM devices
     2  
     3  amc can be built for and run on ARM devices, but there are several considerations to be taken into account beforehand.
     4  
     5  ## CPU Architecture
     6  
     7  First, you must have a 64-bit CPU and Operating System, otherwise some of the project dependencies will not be able to compile or be executed.
     8  
     9  ## Memory Layout on AArch64
    10  
    11  Then, you must setup the virtual memory layout in such a way that the user space is sufficiently large.
    12  From [the Linux Kernel documentation](https://www.kernel.org/doc/html/v5.3/arm64/memory.html#:~:text=AArch64%20Linux%20uses%20either%203,for%20both%20user%20and%20kernel.), you can see that the memory layout with 4KB pages and a level-3 translation table limits the user space to 512GB, which is too low for AMCto sync on Ethereum mainnet.
    13  
    14  ## ARM Board Virtual Memory Limitation
    15  
    16  ### Issue Description
    17  
    18  Some ARM boards are equipped with only 3-level paging, which imposes a virtual memory limitation of 256GB for user space on Linux. This limitation can be a challenge for running applications like "reth", as the MDBX (Memory-mapped Database eXtreme) library requires a larger virtual memory allocation by design.
    19  
    20  ### Understanding the Limitation
    21  
    22  To determine if a specific ARM board is affected by this virtual memory limitation:
    23  
    24  1. **Check Specifications:** When considering an ARM board, review its specifications for information on paging levels. Boards with 3-level paging may have a 256GB virtual memory limit.
    25  
    26  2. **Manufacturer Documentation:** Consult the official ARM board documentation for details on supported paging levels.
    27  
    28  3. **Community Discussions:** Search online ARM and Linux forums for insights into virtual memory limitations of specific boards.
    29  
    30  ### Additional Context
    31  
    32  According to MDBX documentation, changing this upper bound, which dictates the maximum size the database can reach, is a costly operation. Therefore, a reasonably large value was chosen. Given that the upper bound is currently set to 4TB, the assumption was that growth to 3TB might occur relatively soon. If the upper bound size is set to only 342GB, then "reth" cannot store more than 342GB of data, which is insufficient for a full sync.
    33  
    34  It's worth noting that on x86_64 architecture, there is a 48-bit address space divided in half between user space and the kernel, providing each with 128TB of address space. In contrast, AArch64 architecture features a user space address space of 512GB and a kernel address space of 256TB.
    35  
    36  Some newer versions of ARM architecture offer support for Large Virtual Address space, but enabling this requires running with a 64KB page size. The specifics of how to enable this functionality might vary.
    37  
    38  ### Additional Resources
    39  
    40  - [ARM developer documentation](https://developer.arm.com/documentation/ddi0406/cb/Appendixes/ARMv4-and-ARMv5-Differences/System-level-memory-model/Virtual-memory-support)
    41  - [ARM Community Forums](https://community.arm.com)
    42  
    43  ## Build amc
    44  
    45  If both your CPU architecture and memory layout are valid, the instructions for building amc will not differ from the standard process.
    46  
    47  ## Troubleshooting
    48  
    49  > If you ever need to recompile the Linux Kernel because the official OS images for your ARM board don't have the right memory layout configuration, you can use [the Armbian build framework](https://github.com/armbian/build).
    50  
    51  ### Failed to open database
    52  
    53  This error is raised whenever MBDX can not open a database due to the limitations imposed by the memory layout of your kernel. If the user space is limited to 512GB, the database will not be able to grow below this size.
    54  
    55  You will need to recompile the Linux Kernel to fix the issue.
    56  
    57  A simple and safe approach to achieve this is to use the Armbian build framework to create a new image of the OS that will be flashed to a storage device of your choice - an SD card for example - with the following kernel feature values:
    58  - **Page Size**: 64 KB
    59  - **Virtual Address Space Size**: 48 Bits
    60  
    61  To be able to build an Armbian image and set those values, you will need to:
    62  - Clone the Armbian build framework repository
    63  ```shell
    64  git clone https://github.com/armbian/build
    65  cd build
    66  ```
    67  - Run the compile script with the following parameters:
    68  ```shell
    69  ./compile.sh \
    70  BUILD_MINIMAL=yes \
    71  BUILD_DESKTOP=no \
    72  KERNEL_CONFIGURE=yes \
    73  CARD_DEVICE="/dev/sdX" # Replace sdX with your own storage device
    74  ```
    75  - From there, you will be able to select the target board, the OS release and branch. Then, once you get in the **Kernel Configuration** screen, select the **Kernel Features options** and set the previous values accordingly.
    76  - Wait for the process to finish, plug your storage device into your board and start it. You can now download or install AMCand it should work properly.