Amlogic TV box eMMC boot

@gausus has been successful in installing Manjaro to his X96 Max Plus (he’s not sure exactly which model it is) using the following method but, after trying several times on my X96 Max Plus 2 T, I was unable to get this method to work so I didn’t want to add this info to the wiki yet. Hopefully we can improve this into a script that works to install Manjaro onto most if not all Amlogic TV box eMMCs?

He has been using the Armbian installation script which is only slightly different to the (broken) emmc installation script included with Manjaro. One difference I’ve noted is that the Armbian script copies over and edits (with sed) boot.ini whilst the current Manjaro one omits it. Is it no longer needed by uboot?

The files required can be downloaded from here:

https://drive.google.com/drive/folders/1V0Cg8orsn80BB_eaWX2AllOePNwBJ1Pc?usp=sharing

Note that the chances are these instructions won’t work for you and you’ll have to reflash Android but if they do work let us know and maybe we can at least work out which

  1. Install Manjaro onto an SD card and update it, get it booting with the correct dtb.
  2. Download install-aml59.sh
  3. copy install-aml59.sh to Manjaro sdcard /boot
  4. copy u-boot-gsking-x.bin to /boot/u-boot.emmc on SD card
  5. BOOT FROM SDCARD

cd /boot
sudo su
./install-aml59.sh # IGNORE ERORRS

Mount EMMC partitions

sudo mount LABEL=ROOT_EMMC /mnt
sudo mkdir /mnt/boot
sudo mount LABEL=BOOT_EMMC /mnt/boot

FIX BOOT

Edit /mnt/boot/extlinux/extlinux.conf and change the root disk label like so:

APPEND root=LABEL=ROOT_EMMC

FIX FSTAB

Edit or create /mnt/etc/fstab so it has a line like:

LABEL=BOOT_EMMC /boot vfat defaults 0 0

SHUTDOWN
REMOVE SDCARD
BOOT AND TEST

I’m not sure if doing the multi-boot trick is required at the end here or not, @gausus? I tried doing that but never got Manjaro to boot of my eMMC.

1 Like

Has anyone got Manjaro to run on the X96 X6? Its a Rockchip RK3566 based TV box with 8GB RAM. If so, have you got 4K video playback working under mpv?

Are there any other TV boxes with 8 GB RAM yet?

Have testes this on 4 tvboxes.

Recommend y first test to install to EMMC from Balbes150 lates build focal kernel 5.9.

https://users.armbian.com/balbes150/arm-64/

INFO

sudo su
cd /root
./install-aml.sh

Shutdown
Power OFF
Take out sdcard.
Power ON

MANJARO (done like first post)
Able to boot from internal storage / EMMC

  • X96max+ (Android plus2 firmware) S905x3
  • X96S S905y2 (needs u-boot-gsking-x.bin to boot)
  • Magicsee N5 S905x

Not Able to boot Manjaro from EMMC , Balbes150 image boots from emmc

  • A95X F3 Air (S905x3)

All boxes was able to boot from sdcard after installing to EMMC.

A95X F3 Air able to boot root fra sdcard.
EMMC often faster then sdcard maybe a workaround if y cant boot directly from EMMC.

TO BOOT EMMC FROM SDCARD.
CHANGE on SDCARD

/boot/extlinux/extlinux.conf and change the root disk label like so:

APPEND root=LABEL=ROOT_EMMC …

Its possible to make backup of EMMC to sdcard before installing.
USE ddbr.sh taken form Balbes150 lates working ARMBIAN image kernel 5.9.

Download ddbr.sh from google link.

Boot Manjaro from sdcard
sudo su
mkdir /ddbr copy script to this folder
cd /ddbr
./ddbr.sh

The script comes with some questions.
Select backup / restore.
Select yes for compressed.

The backup / restore take a long time to complete.
Makes BACKUP-arm-64-emmc.img.gz on /ddbr.sh
Have successfully restored Android this way.

DTB used
X96max+ meson-sm1-x96maxplus-vim100m
X96S meson-g12a-sei510.dtb
Magicsee N5 meson-gxl-s905x-p212.dtb

OUTPUT ./install-aml59.sh

sudo su
cd /boot
./install-aml59.sh

    root@x96maxPluss boot]# ./install-aml59.sh 
    Start script create MBR and filesystem
    /dev/mmcblk2
    Start backup u-boot default
    4+0 records in
    4+0 records out
    4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0392178 s, 107 MB/s
    Start create MBR and partittion
    Start restore u-boot
    442+0 records in
    442+0 records out
    442 bytes copied, 0.00443497 s, 99.7 kB/s
    8191+0 records in
    8191+0 records out
    4193792 bytes (4.2 MB, 4.0 MiB) copied, 0.387935 s, 10.8 MB/s
    Done
    Start copy system for eMMC.
    Formatting BOOT partition...mkfs.fat 4.2 (2021-01-31)
    done.
    Cppying BOOT...done.
    Edit init config...done.
    done.
    Formatting ROOT partition...
    e2fsck 1.46.2 (28-Feb-2021)
    ROOT_EMMC: clean, 11/1818624 files, 158201/7264512 blocks
    done.
    Copying ROOTFS.
    Copy BIN
    Create DEV
    Copy ETC
    Copy HOME
    Copy LIB
    Copy LIB64
    tar: lib64: Cannot stat: No such file or directory
    tar: Exiting with failure status due to previous errors
    Create MEDIA
    Create MNT
    Copy OPT
    Create PROC
    Copy ROOT
    Create RUN
    Copy SBIN
    Copy SELINUX
    tar: selinux: Cannot stat: No such file or directory
    tar: Exiting with failure status due to previous errors
    Copy SRV
    Create SYS
    Create TMP
    Copy USR
    Copy VAR
    tar: var/lib/samba/private/msg.sock/836: socket ignored
    tar: var/lib/samba/private/msg.sock/810: socket ignored
    tar: var/lib/samba/private/msg.sock/813: socket ignored
    tar: var/lib/samba/private/msg.sock/796: socket ignored
    tar: var/lib/samba/private/msg.sock/843: socket ignored
    tar: var/lib/samba/private/msg.sock/837: socket ignored
    tar: var/lib/samba/private/msg.sock/811: socket ignored
    tar: var/lib/samba/private/msg.sock/772: socket ignored
    Copy fstab
    cp: cannot stat '/root/fstab': No such file or directory
    rm: cannot remove '/ddbr/install/root/install*.sh': No such file or directory
    rm: cannot remove '/ddbr/install/root/fstab': No such file or directory
    rm: cannot remove '/ddbr/install/usr/bin/ddbr': No such file or directory
    *******************************************
    Complete copy OS to eMMC 
    *******************************************
    
    inxi -D -S
    System:    Host: x96maxPluss Kernel: 5.12.9-1-MANJARO-ARM aarch64 bits: 64 Console: tty pts/0 Distro: Manjaro ARM 
    Drives:    Local Storage: total: 29.12 GiB used: 5.15 GiB (17.7%) 
               ID-1: /dev/mmcblk2 vendor: HP model: DF4032 size: 29.12 GiB 

     sudo blkid
    /dev/mmcblk2p2: LABEL="ROOT_EMMC" UUID="b4806da1-23a1-4284-9ebc-c5af73a0a864" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="6d650000-02"
    /dev/mmcblk2p1: SEC_TYPE="msdos" LABEL_FATBOOT="BOOT_EMMC" LABEL="BOOT_EMMC" UUID="4CF8-65D7" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="6d650000-01"
    /dev/zram0: LABEL="zram0" UUID="88e53230-285a-4cd5-8341-b62f15c1eb9c" TYPE="swap"
3 Likes

I created a new thread for the X96 X6, dunno why the admins moved that here. Its quite OT.

We need to know why your A95X F3 Air and my X96 MP won’t boot, will prob have to attach a serial header to our boards to find out.

I’m interested to hear if other users have success with this method.

Dont have a serial header.

First I think someone more skilled then me has to verify the boot prosess.
From Android start to u-boot.emmc gets loaded as it always does but cant always find emmc / internal storage

Then fine out where it failed.

If I am to guess we need new u-boot.

All my boxes can boot from emmc on kernel 5.9.

MANJARO kernel 5.12.x
X96max+ u-boot-s905x2-s922 and Magicsee N5 u-boot-s905x-s912 can boot from eMMC.

X96S need u-boot-gsking-x.bin to boot from emmc.
Manual renamed to u-boot.emmc

A96X F3 Air cant boot from emmc Manjaro (5.9 kernel works from emmc)

The script renames u-boot.ext to u-boot.emmc

I think uboot that supports booting kernel after 5.9 lacks as good support as old uboots for emmc.

Or Android need some special startup environment to support booting kernel after 5.9.

I have proved that it is possible to boot kernel 5.12, hope someone with more experience can take this further.

I’m just a tester.

1 Like

I’ve answered half of my questions about the X96 X6. It uses the same chipset as a Pine board called the Quartz64. HW video decoding is not supported yet according to this page:

https://wiki.pine64.org/wiki/Quartz64_Development

Rockchip RK3566 SoC with Android 11 and up to 8GB of RAM in the new H96 MAX & REVIEW: X88 PRO 20 a low-cost Android TV-Box with SoC Rockchip RK3566 | AndroidPCtv.

1 Like

Thanks JFL! Sounds like I’ll be giving these rk3566 boxes a miss.

Just curious, any particular reason(s)? 8GB RAM & G52 GPU should be suitable for Linux ops but read that video and audio support are not so good according to the reviews.

If the Hantro VPU driver evolves to support the rk3566 and allow 4K playback, I may become interested but as it is it offers no real advantages over my Jetson Nano or X96 Air, apart from the extra RAM plus I’ve already got a RPi 4 with 8 GB RAM.

1 Like

Yes on quartz64

No, coz hdmi is not yet ready on mainline kernel. It is being worked on. Vpu support will also take time.

Only possible on rk3566/3568

1 Like

Yes it is possible on older soc.

Not working on new soc like s922x

Coz the chainloader fails to see emmc drive due to many reason unknown to developers.

I had given it sometime but still couldnt get the chainloader to detect emmc in uboot. It is something to do with bsp uboot and mainline chainloader conflict. Even neil had given it a shot.

Coz the cpu used is slower but should handle vpu and gpu well once drivers mature.

I will look into emmc boot again once I am back from my vacation.

Thanks Spikerguy for your excellent work.
Which makes it possible to run Manjaro on TV- boxes.

Think install-aml-emmc.sh is broken.
I have made a new version based on Balbe’s 150 script for ARMBIAN kernel 5.9.

LINK…

Have tested the script on several of my TV boxes S905x-x3.

You can possibly include this to the VIM3 image.
If you want to change the script, that’s fine.
Scripts are now fully automated, do not require manual customization after install.

1 Like

I have tried this some time back but it doesn’t work on s922x devices. I will try it again once I am back from vacation. It will be great if it works.

Thanks

Hi @gausus

Sorry about the delay but tonight I finally tried your automated installer. Sadly it didn’t work on my X96 Air nor on my X96 Max Plus 2T, well it didn’t boot after installing.

Sorry about that , the automated installer dont change any thing.
The script updates files you previously had to manually edit.

Can y share some more details.
Only black screen , … error loading emmc …

Can y boot eMMc from sdcard (root on internal storage)?
Can y boot y box from SDCARD after installing to emmc(root on sdcard) ?

Have y tested to boot ARMBIAN 5.9 from internal storage.

Think we need to test all this so maybe Spikerguy can find out some way to fix this.

Thz for testing :grinning:

1 Like

Some useful info her on booting emmc ?
http://redmike.unaux.com/doku.php?id=android:boot_linux_on_amlogic_tv_box&i=2

I’m looking forward to install manjaro to emmc on my gxbb s905 p201 Tv box .(Similar to MXQ 4k Pro P201 as I could use the same android firmware) Early this year I tested with Ambian 20.10 Focal from Balbes150 (5.9 kernel) but it seems that u-boot could not load file system from emmc. Will test manjaro later.

Currently I’m running Manjaro-ARM-minimal-vim2-21.08 (with latest mainline kernel )from SD card with no problem.

pista on Armbian forum claims to have successfully boot from emmc with blkdevparts method, which could be read in this post: S905 failed to boot from emmc

Could someone familiar with u-boot stuff ceate a more detailed step-by-step procedure for newbies to follow? It would be great to run Manjaro from emmc without SD card.