[How To] Install run Manjaro ARM on Amlogic TV Boxes with S922X - S905X3 SOC

Thanks a lot spikerguy! I think I have now the right understanding. In the beginning I understood that the native uboot on the emmc was the cause of the probem. I will give the procedure above a try!
Could you once boot GTKingPro_Debian-xfce-buster_Linux-4.9_arm64_SD-USB_V0.8.4-20200513 (Your image from beelink forum) out of the emmc?

Hi GILL,

To avoid Kernel Panic on GT King or GT King Pro download this new u-boot.ext from this link for_linux-vim-5101.tar — Яндекс Диск. It so far works on my GT King Pro (Manjaro-ARM-VIM3-XFCE on linux-vim 5.10.1-1 kernel) without kernel panic on mainline kernel.

Replace the u-boot.ext from Manjaro-ARM-kde-plasma-vim3-22-11-2020.img with this new u-boot.ext you just downloaded. With this new u-boot.ext, hopefully, it resolved the kernel panic issue on your GT King, that is, if you want to continue to boot from SD Card (I have only tried it on USB Flash).

Thanks JFL!
I can boot from SD with no issues, but I failed to install Manjaro to the emmc.
I tried again with dd if=/image as described above, but GT King stuck during execution.

When you say your are stuck, do you mean your system freezes during the installation into emmc? If it freezes it most likely the kernel panic issue. With the linux mainline kernel on GT King or GT King Pro.

The new u-boot.ext might resolve the kernel panic issue so that you can complete your installation on emmc without the kernel panic/freeze.

Thanks! I will give it a try.

Finally I managed to boot and to condcut the dd command until the end
Now I need to modify the dtb file name in extlinux. When I try to mount
mount /dev/mmcblk0p1 /mnt
I get
mount: /mnt/: special device /dev/mmcblk0p1 does not exist
Even I can see the device with fdisk

Disk /dev/mmcblk0: 57.6 GiB, 61865984000 bytes, 120832000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa358f736

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 32768 524287 491520 240M b W95 FAT32
/dev/mmcblk0p2 524288 10084351 9560064 4.6G 83 Linux

I tried to refresh the drives table with sys/class/mmc_host
After reboot blach screen and reboot from SD card not possible. I still have no clue, why it does’t work out of the emmc.

Thanks a lot for your support JFL and Spikerguy!

1 Like

If you’re using kde then you should be able to see BOOT_MANJARO twice on the left bar inside dolphin file manager.

So the new u-boot.ext from LibreElec seems to resolve the kernel panic on GILL’s GT King too. Great,

GT King could not reboot after the dd has finished.GT King was broken and I had to open the box ,bridge the boot pins and reflash android on it.
In the moment I can not see how to install a bootable Linux on the emmc. I have tried a lot of things, but no success. In the past I managed to install debian on H96 Pro+ (Amlogics912) in few hours. When I repeat the same procedure on GT King it does’t work.

I could boot on GT King debian and manjaro out of the sd, when I copy the installation onto emmc (It does’t matter how), then GT does’t boot from emmc or does’t boot from emmc and sd anymore.
I installed CoreElec on emmc and all is fine. I guess CoreElec is overwriting the native bootloader of GT King with its own.
I guess it is related to the native bootloader, but I have no clue, why it is not working with emmc.

I have just found this explanation for the problem [Posts by darkstar - LibreELEC Forum]

I am sorry to hear that trying to install the image to emmc break your unit. In the Posts by darkstar - LibreELEC Forum, Chewitt wrote about the GT King Pro having “However there’s an issue when booting from vendor u-boot and the mainline kernel under high I/O load (e.g. when writing the image) where the kernel deadlocks” which I think he refers to what I call kernel panic during heavy I/O.

But based on what Chewitt had said, I am not sure whether he knows that with one of u-boot from LibreELEC the kernel panic issue on GT King Pro is resolved based on the last two days I have been using it. And from what I understand, with the same u-boot you were able to complete transferring the image to emmc (without kernel deadlock) but unfortunately it does boot after that.

Edit:
Spkikerguy, may be you can inform Chewitt that with the correct u-boot the kernel deadlock on GT KIng Pro can be avoided at least boot from SD or USB.

1 Like

Yes informed.

@GILL
I think you’re not flashing the image mainline uboot on emmc correctly.
If you’re saying that mainline uboot image is working fine on sd card then it should work fine on emmc.

I will try to make and image for emmc flashing soon.

1 Like

Happy 2021 to you all!!

Thanks for the update Spikerguy!
In the moment it is not clear to me, how the native boot process on GT King works and at which memory sector the bootloader resides.
I understood from your last post, that if I would clone the SD installation into an img and then flash the img via dd onto mmcblk0 of GT King, then it would boot from emmc!!

What I have done in my last attempt, is to flash the img “Manjaro-ARM-kde-plasma-vim3-22-11-2020.img” via dd as its. Problem: After a completed dd operation with this img, the new partitions (fat and ext) on mmcblk0 were not accesible (as I mentioned in my previous post). BUT you need to access the fat partition before the next boot in order to change the dtb file setting in extlinux.conf. With the mentioned img you end up in a deadlock.
You may avoid this problem, if you would prepare a dedicated img with the right dtb for GT King versions in order to make emmc boot feasible. Is that your idea?

No. Maybe you didn’t read the tutorial I wrote for GT King Pro.

You don’t have to do any manual changes.
Just use the mainline image of gt king pro. Don’t forget the keyword here Mainline and GT king Pro

Flash it to sd card and boot in it but before that you will need to erase the emmc which i mentioned the steps in my tutorial.
Once you boot into the sd card then use the exact same image which you flashed on sd card and flash it to emmc.

I think the steps in this link is much easier to understand.
The only additional step here is to dd the same image to emmc manually.

I hope this is much clear to you.

I have tried it and that did not work for me. Eather it doesn’t boot at all from any source, or it stuck with black screen. Did you try it yourself with GT King, or with another beelink device?

Yes i have tried it with gt king pro multiple times before releasing that image.

I can’t test it now as I use the gt king pro as my build device.

Can you document steps that you followed with details?

Can you please tell, why the script below is not doing the same as your procedure?
It does backup the uboot from android, delete the emmc and create the partitions and then copy content of sd card partitions to the emmc:

echo "Start script create MBR and filesystem"

DEV_EMMC=/dev/mmcblk0

echo "Start backup u-boot default"

dd if="${DEV_EMMC}" of=/boot/u-boot-default.img bs=1M count=4

echo "Start create MBR and partittion"

parted -s "${DEV_EMMC}" mklabel msdos
parted -s "${DEV_EMMC}" mkpart primary fat32 4M 240M
parted -s "${DEV_EMMC}" mkpart primary ext4 241M 100%

echo "Start restore u-boot"

dd if=/boot/uboot.img of="${DEV_EMMC}" conv=fsync bs=1 count=442
dd if=/boot/uboot.img of="${DEV_EMMC}" conv=fsync bs=512 skip=1 seek=1
sync

echo "Done"

echo "Start copy system for eMMC."

mkdir -p /ddbr
chmod 777 /ddbr
PART_BOOT="/dev/mmcblk1p1"
PART_ROOT="/dev/mmcblk1p2"
DIR_INSTALL="/ddbr/install"

if [ -d $DIR_INSTALL ] ; then
    rm -rf $DIR_INSTALL
fi
mkdir -p $DIR_INSTALL

if grep -q $PART_BOOT /proc/mounts ; then
    echo "Unmounting BOOT partiton."
    umount -f $PART_BOOT
fi
echo -n "Formatting BOOT partition..."
mkfs.vfat -n "BOOT_EMMC" $PART_BOOT
echo "done."

mount -o rw $PART_BOOT $DIR_INSTALL

echo -n "Cppying BOOT..."
cp -r /boot/* $DIR_INSTALL && sync
echo "done."
echo "Start copy system for eMMC."

mkdir -p /ddbr
chmod 777 /ddbr
PART_BOOT="/dev/mmcblk1p1"
PART_ROOT="/dev/mmcblk1p2"
DIR_INSTALL="/ddbr/install"

if [ -d $DIR_INSTALL ] ; then
    rm -rf $DIR_INSTALL
fi
mkdir -p $DIR_INSTALL

if grep -q $PART_BOOT /proc/mounts ; then
    echo "Unmounting BOOT partiton."
    umount -f $PART_BOOT
fi
echo -n "Formatting BOOT partition..."
mkfs.vfat -n "BOOT_EMMC" $PART_BOOT
echo "done."

mount -o rw $PART_BOOT $DIR_INSTALL

echo -n "Cppying BOOT..."
cp -r /boot/* $DIR_INSTALL && sync
echo "done."

echo -n "Edit init config..."
sed -e "s/ROOTFS/ROOT_EMMC/g" \
 -i "$DIR_INSTALL/extlinux/extlinux.conf"
echo "done."

umount $DIR_INSTALL

if grep -q $PART_ROOT /proc/mounts ; then
    echo "Unmounting ROOT partiton."
    umount -f $PART_ROOT
fi

echo "Formatting ROOT partition..."
mke2fs -F -q -t ext4 -L ROOT_EMMC -m 0 $PART_ROOT
e2fsck -n $PART_ROOT
echo "done."

echo "Copying ROOTFS."

mount -o rw $PART_ROOT $DIR_INSTALL

cd /
echo "Copy BIN"
tar -cf - bin | (cd $DIR_INSTALL; tar -xpf -)
#echo "Copy BOOT"
#mkdir -p $DIR_INSTALL/boot
#tar -cf - boot | (cd $DIR_INSTALL; tar -xpf -)
echo "Create DEV"
mkdir -p $DIR_INSTALL/dev
#tar -cf - dev | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy ETC"
tar -cf - etc | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy HOME"
tar -cf - home | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy LIB"
tar -cf - lib | (cd $DIR_INSTALL; tar -xpf -)
echo "Create MEDIA"
mkdir -p $DIR_INSTALL/media
#tar -cf - media | (cd $DIR_INSTALL; tar -xpf -)
echo "Create MNT"
mkdir -p $DIR_INSTALL/mnt
#tar -cf - mnt | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy OPT"
tar -cf - opt | (cd $DIR_INSTALL; tar -xpf -)
echo "Create PROC"
mkdir -p $DIR_INSTALL/proc
echo "Copy ROOT"
tar -cf - root | (cd $DIR_INSTALL; tar -xpf -)
echo "Create RUN"
mkdir -p $DIR_INSTALL/run
echo "Copy SBIN"
tar -cf - sbin | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy SELINUX"
tar -cf - selinux | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy SRV"
tar -cf - srv | (cd $DIR_INSTALL; tar -xpf -)
echo "Create SYS"
mkdir -p $DIR_INSTALL/sys
echo "Create TMP"
mkdir -p $DIR_INSTALL/tmp
echo "Copy USR"
tar -cf - usr | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy VAR"
tar -cf - var | (cd $DIR_INSTALL; tar -xpf -)

echo "Copy fstab"

rm $DIR_INSTALL/etc/fstab
cp -a /root/fstab $DIR_INSTALL/etc/fstab

rm $DIR_INSTALL/root/install.sh
rm $DIR_INSTALL/root/fstab
rm $DIR_INSTALL/usr/bin/ddbr
rm $DIR_INSTALL/usr/bin/ddbr_backup_nand
rm $DIR_INSTALL/usr/bin/ddbr_backup_nand_full
rm $DIR_INSTALL/usr/bin/ddbr_restore_nand

sync
umount $DIR_INSTALL

echo "*******************************************"
echo "Completed copy OS to eMMC "
echo "*******************************************"

With this script you will definately have a dead os, I don’t know where you get this file, this is either a very old script or a broken script.

My script does not have this and as Ive informed you multiple times do not use this as you will reach kernel panic on GT king device.

I’ve asked you multiple times to use mainline uboot for Gt king but you seem to have not tried those steps very carefully.

I’d request you to try the mainline image for GT King Pro and the steps I mentioned in the above post.

Good luck.

Spikerguy! I guess, you did not get my problem yet!
I have followed all the steps:
When I do dd of the mainline image, then both partitions mmcblk0p1 and mmcblk0p2 are set up -> Fine.
Next step is to change the dtb setting (exlinux.conf):
This is not possible, since you can’t mount the mmcblk0p1 partition at this stage
If you reboot, GT King boots with the wrong dtb file (given by the mainline img) , then it stuck with black screen because it boots with wrong dtb, I guess!
This is the deadlock I have been trying to explain
I hope now, I could make the problem clear!

I have redone everything.
If I interrupt USB_Burning_tool at 15%. I can not boot eather from emmc or sc card. This does’nt work!!
I reflashed android. I booted android and then switched off and on. Now I could boot Manjaro from sd.
I performed dd if=/mnt/manj… of=/dev/mmcblk0 …The process crashes at 923Mb. This does’nt work. I had to unbrick GT King with USB_Burning_tool again.
I booted Debian (GTKingPro_Debian-xfce-buster_Linux-4.9_arm64_SD-USB_V0.8.4-20200513) from sd card and then I could flash Manjaro img via dd onto emmc as above. I have checked emmc partitions (mmcblk0p1 and mmcblk0p2) all data are in and patitions formats and flags are OK. I mad the right setting in exlinux.conf.
After reboot I get only black screen if I try to reboot from sd card -> black screen again. This does’nt work eather.
Now I need to unbrick my GT King again.
It simply does’nt work the described way. Now I can not imagine, how you could make Manjaro run out of emmc!!! FYI: I am working with GT King B922HQ.

install multipath-tools
sudo kpartx -av <yours.img>
you may see in filemanager 2toms
edit extlinux.conf with sudo
umont in filemanager this 2 toms
sudo kpartx -dv <yours.img>
Then use dd
may be it help you