Category:Amlogic

From postmarketOS Wiki
(Redirected from Amlogic)



Amlogic Incorporated
Amlogic
Amlogic
Name Amlogic Incorporated
Country USA / Worldwide
Industry ARM
Resources English homepage, Chinese homepage

Amlogic Incorporated, or Amlogic (sometimes AMLogic) is a chip maker company which has its headquarters in the USA. They mainly operate in China.

They mainly produce SoCs suitable for use in set top boxes running either AOSP or Android TV, but also produce SoCs used in televisions.

Discussion

There's an IRC channel hosted on the Libera.Chat IRC network by the linux-meson.com community:

  • Network: irc.libera.chat
  • Port: 6667 (plain) or 6697 (TLS, secure)
  • Channel: #linux-amlogic

For anything postmarketOS-related on Amlogic, please use the postmarketOS channels and ping either User:FerassElHafidi (nick: f_) or User:Exkc (@exxxxkc:matrix.org).

Devices with an Amlogic SoC

Generic device ports

These devices are combined into generic ports. Refer to chipset when looking for your device.

Device Architecture Mainline USB Net Flashing Screen Wifi FDE Battery 3D Audio Bluetooth HDMI/DP USB-OTG
Amlogic Generic TV Box aarch64 Y N - - - - Y Y - Y -

Non-generic device ports

Other devices that are not combined into generic ports.

Device Chipset Architecture Booting Mainline USB Net Flashing Screen Wifi FDE Battery 3D Audio Bluetooth HDMI/DP USB-OTG
Ainol Novo 10 Hero Amlogic AML8726-MX armv7 No
Amediatech x96 Air Amlogic S905X3 aarch64 Yes Y Y N - Y N N Y
Amediatech x96 Max Plus Amlogic S905X3 aarch64 Yes Y Y N - Y N N Y
Amediatech X96 Mini Amlogic S905W aarch64 Yes Y Y N - Y P N -
Beelink gt1 (Ultimate) Amlogic S912 aarch64 Yes Y - Y Y P - Y Y Y Y -
HomeX X1 Amlogic S905X aarch64 No -
HTV box HTV 3 Amlogic S805 armv7 No
Insignia Fire TV Edition (Full HD) Amlogic T950Z aarch64 No - -
LETV U2 Amlogic S812-H armv7 No
Libre Computer AML-S805X-AC-V1.0 Amlogic S805X aarch64 Yes Y - N - - - Y Y - Y -
Libre Computer AML-S905D3-CC-V0.2 Amlogic S905D3 aarch64 Yes Y - N - - - Y - Y -
Libre Computer AML-S905X-CC-V1.0 Amlogic S905X aarch64 Yes Y - N - - - Y Y - Y -
Mecool KM2 Plus Amlogic S905X4 aarch64 No N N -
ODROID N2+ Amlogic S922X (rev C) aarch64 Yes N - - Y - - - - - -
Onn uhd Amlogic S905X2 aarch64 Yes Y Y
Radxa Zero Amlogic S905Y2 aarch64 Yes Y Y P P - Y N Y Y
TrekStor SurfTab ventos 7.0 HD Amlogic AML8726-MX armv7 N
Vensmile M8S Amlogic S812 armv7 No
ZTE ZXV10 B860HV5 Amlogic S905X2 aarch64 Yes Y - N - N - - Y N Y Y

Supported SoCs

SoC Codenames Arch Year Mainline UART USB Storage Display CPU GPU Pinctrl I²C Audio Video Thermal WiFi BT Modem GPS Camera Suspend
Amlogic AML8726-MX Meson6 armv7f 2012 Yes P N N N P N N N N N N - - - - -
Amlogic S805 Meson8b armv7f 2014 Yes Y Y P P Y Y P Y N P Y - - - - -
Amlogic S812/S812-B/S812-S/S802 Meson8,Meson8m2 armv7f 2014 Yes Y Y P P Y Y P Y N P Y - - - - -
Amlogic S905 GXBB aarch64 2015 Yes Y Y P Y Y Y Y Y Y P Y - - - - - N
Amlogic S905D2/S905X2/S905Y2 G12A aarch64 2019 Yes Y Y P Y Y Y Y Y Y P Y - - - - -
Amlogic S905D3/S905X3/S905Y3 SM1 aarch64 2019 Yes Y Y P Y Y Y Y Y Y P Y - - - - -
Amlogic S905W/S905D/S905X/S905L/S805X/S805Y/S905Z GXL aarch64 2016 Yes Y Y P Y Y Y Y Y Y P Y - - - - -
Amlogic S905X4/S905C2 SC1 aarch64 2021 No <--- No encoding yet --> - - - - -
Amlogic S912 GXM aarch64 2016 Yes Y Y P Y Y Y Y Y Y P Y - - - - -
Amlogic S922X/A311D G12B aarch64 2019 Yes Y Y P Y Y Y Y Y Y P Y - - - - -

-H variant

There's also a -H variant of some Amlogic SoCs (like the S905X, S812, etc), which merely include Dolby licenses, but otherwise they're the same as the non-H counterparts.

Boot process

Generally, the boot ROM (=BL1) of Amlogic-based devices either boot to:

  • SPI NOR
  • eMMC
  • NAND
  • an SD card
  • USB (via a custom protocol, please note that BL1 cannot boot from a USB stick)

Order depends on POC.

You can force them to boot from an SD card or USB (via Amlogic's in-house protocol) by using a HDMI dongle(There are seem a lot of clone of it for booting via USB in china). This is a suitable alternative for those who want to boot to an SD card without wiping everything else, and for devices that have a locked flash mode that would be bricked if the eMMC is wiped. Some devices e.g. Libre Computer AML-S905X-CC-V1.0 (librecomputer-lepotato) also have a button to enter USB mode or, in the case of the Libre Computer AML-S905D3-CC-V0.2 (librecomputer-solitude), have a switch to force eMMC/SD boot.

BL1 looks for an @AML header which contains multiple entries for BL2. The header roughly looks like this:

struct aml_hdr {
    /* before magic word: random bytes ignored by BL1 */
	uint32_t magic; /* "@AML" */
	uint32_t total_size; /* header+binary size */
	uint8_t header_size; /* header size */
	uint8_t root_key_index; /* amlogic secureboot-related */
	
    /* version */
    uint8_t version_major;
	uint8_t version_minor;
	uint32_t padding1;

    /* checksum */
	uint32_t digest_type;
	uint32_t digest_offset;
	uint32_t digest_size;

	uint32_t data_offset;

    /*
     * signing the BL2 image, 
     * this is completly ignored if secureboot isn't enabled
     */
	uint32_t key_type;
	uint32_t key_offset;
	uint32_t key_size;
	
    uint32_t data_size;
	uint32_t payload_type;
	uint32_t payload_offset;
	uint32_t payload_size;
	uint32_t padding2;
} __packed;

Depending on the SoC family, what happens before U-Boot runs may differ; refer to their respective SoC page.

U-Boot quirk in some set-top boxes

Most set-top boxes have U-Boot on the eMMC, which then (for some reason) looks for the following U-Boot scripts if a "multiboot" mode is triggered on either an SD card or a USB device (FAT32 boot partition!):

  • aml_autoscript
  • s905_autoscript
  • s805_autoscript (if using an Amlogic S8XX SoC. Not packaged.)

If it doesn't find either ones, it'll boot to Android.

This is believed to be a quirk enabled by Amlogic themselves for their reference boards and since box manufacturers usually base their box on reference boards, including u-boot, it's possible that it has been unintentionally retained.

Triggering "multiboot" mode depends on the set-top box, but they generally have a button at the bottom or hidden inside the AV port. Press it while plugging in your power supply and it should work.

We use this quirk to load a mainline U-Boot and then boot postmarketOS (see soc-amlogic-s905PMOS).

Sometimes, however, the "multiboot" mode isn't available on some devices or after some Android TV upgrades; that is the case for the Xiaomi Mi Box 3 (xiaomi-once), which doesn't have this feature unless you manually implement it in the U-Boot environment via the U-Boot shell (some devices might disable the U-Boot shell as well).

Flashing

Amlogic USB Burning tool

The Amlogic USB Burning tool is Amlogic's proprietary flashing software. It's used to flash Amlogic devices by using Amlogic's in-house protocol. It only works on Microsoft Windows.

There's also another proprietary CLI tool from Amlogic called update. It allows you to read the Amlogic SoC info, flash the firmware, temporarily boot firmware (u-boot) (just like fastboot boot boot.img), extract the firmware and lock the flash mode with a password in the flash mode. It has a Microsoft Windows version and a GNU+Linux version.

Note That software is built with an old toolchain and most binaries are x86-only.

Some other software is built around this CLI tool such as aml-linux-usb-burn, aml-usb-load-uboot and aml-flash-tool

Note aml-flash-tool bundles an ARM build of the CLI tool.

pyamlboot

pyamlboot is an effort to reverse-engineer Amlogic's custom USB boot protocol. It allows you to boot any binary you want (depending on the device). Instructions on how to use it can be found on the GitHub page linked below.

See also