summaryrefslogtreecommitdiff
path: root/source/amberelec-internals.rst
blob: 5b742a049adc638cdd048382b8202b0539b537fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
###################
AmberELEC internals
###################

`AmberELEC`_ (former 351ELEC) is a fork of `EmuELEC`_, which is a fork of `CoreELEC`_, which is a fork of `LibreELEC`_, which is a fork of `OpenELEC`_). Knowing this inheritance scheme may help you find some lost knowledge and understand reasoning behind some decisions.

.. _AmberELEC: https://github.com/AmberELEC/AmberELEC
.. _EmuELEC: https://github.com/EmuELEC/EmuELEC
.. _CoreELEC: https://github.com/CoreELEC/CoreELEC
.. _LibreELEC: https://github.com/LibreELEC/LibreELEC.tv
.. _OpenELEC: https://github.com/OpenELEC/OpenELEC.tv

How the disk image file is constructed
======================================

The image is built by ``/scripts/mkimage`` script.

The final image has size of 2097 MiB and consists of the following parts:

* 16 MiB - A padding, purpose is unclear. It is defined by ``SYSTEM_PART_START`` variable, measured in sectors, 1 sector = 512 bytes. The ``SYSTEM_PART_START`` variable is defined in the ``/projects/Rockchip/options`` file.
* 2 GiB - System storage partition, a FAT file system, containing the bootloader, the kernel, device tree blobs and the system - a squasfs file of rootfs.
* 32 MiB - Games storage partition, an ext4 file system, to be expanded at first boot to fill out all available memory on the microSD card.
* 1 MiB - Some GPT padding, purpose is unclear.

Tools used in the script:

* ``dd`` is used to create the disk image file.
* ``parted`` is used to crate partitions on the file like if it was a disk.
* ``sync``  is used to fully commit changes made to the file.
* ``mformat`` is used to create boot sector, format the first partition in FAT system and create the root directory on the partition.
* ``mcopy`` is used to copy files into the first partition's file system.
* ``mmd`` is used to create directories inside the first partition's file system.
* ``pigz`` is used to compress the image file

Where the tools are coming from:

* ``dd`` and ``sync`` are from ``/packages/tools/sysutils/coreutils`` package.
* ``pigz`` is from ``/packages/compress/pigz`` package.
* ``mformat``, ``mcopy`` and ``mmd`` are from ``/packages/tools/mtools`` package.
* ``parted`` is from ``/packages/tools/sysutils/parted`` package.

How the system is loaded
========================

The ``init`` script, that ends up in the ``initramfs`` CPIO image, is copied from ``/packages/sysutils/busybox/scripts/init`` file.