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

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

Thanks for you hint, but I do not understand, what is the gian of those actions!

you mount and change img file before dd write emmc. Want you edit extlinux.conf in img file? if i right understand you

I did not get , what would be changed and why that would solve the problem!
It is not clear to my why it does’nt boot from the linux installed on emmc by dd command!
I have even created an img out of the running linux on sd card with dd if=/dev/sda of=/running.img
Then I did dd if=/running.img of=/dev/mmcblk0 (emmc of GT King). Did not work :frowning:
Please explain your idea with more details, as I did not understand the actions you are recommending

change extlinux.conf in mainline img

Thanks! But I have overcome this problem. I could install Linux onto emmc and all partitions were OK.
Nevertheless it does’nt boot from emmc. I guess it is a problem of the bootloader, but I do know, what kind of problem it is. CorELEC can intsall the img with the command ceemmc and afterward run it out of the emmc. I did not find any information about, what ceemmc exactly does!

If you try with non mainline you it won’t but if you use mainline then it does.

Kpartx is not easy for normal users. So I don’t think this will be useful, that is the reason I try to give ready to use images.

What I see from the conversation is that you’re either not following the steps or you’re getting confused with so many options shared by the users.

What I have been saying from the beginning.

  1. Install script will not work, reason it will kernel panic. And as JFL advised to use new u-boot.ext then still it will lead to dead emmc os coz the .ext gets deleted to be replaced by u-boot.ext. So please forget install script option.
  2. The install script you have been using is wrong one anyways as per point 1 even if you use the right one still it will be kernel panic.
  3. Use MAINLINE GT KING PRO image on sd and flash the exact same image on emmc. You don’t have to change dtb in extlinux using gt king pro image as from my understanding GT KING should just work fine with the same dtb.

Only if you have had followed the steps carefully which Ive written on Beelink forum for GT-KING PRO device you would have had os on emmc by now.

Let me break down the steps for you.
Do these steps.

  1. Erase emmc.
  2. Flash Mainline image on sd card.
  3. Boot from sd card using Mainline image.
  4. Reply here once you have Mainline image running on sd card.

Will tell you the next step once you achieve this.

Good luck once again. :stuck_out_tongue_closed_eyes:

This is no way comparable to Linux os using non legacy kernel. Anyways try the above steps and let me know.

OH Wait!!! I have asked Beelink team if GT King and GT King Pro will work with the same mainline u-boot. If it have something different then you’re right it might not work with Mainline uboot as I have never worked on GT King device.

I will try to update the install script but this will need sometime. Till then enjoy the OS on sd card :stuck_out_tongue:

Thanks SpikerGuy!

I mentioned many times in my posts, I have got "Manjaro-ARM-kde-plasma-vim3-22-11-2020.img” running on sd and I am assuming this is a mainline release!
I have followed the steps above without success :frowning_face:
I will wait for further updates!

T

Ah my dear I meantioned MAINLINE UBOOT as per the tutorial I linked in the Beelink Forum, I assumed that you will end up getting confused with so many forum members trying to help you :smiley:
We have created a wonderful community on Manjaro for AMlogic devices, I am loving it :wink:

The best thing I can recommend for now is join me on Beelink forum for time being so Beelink tech team can advice if GT King Pro Uboot will work on GT King or not Technically it should work.

Follow every single step mentioned in this tutorial, for time being forget all that you have understood about VIm3 and gt king from this forum.

My first advice to you in get the Manjaro-ARM-kde-plasma-gtking-pro-Mainline.img.xz to run on sd card first if that works then it will work on emmc too.
Reply to me on the tutorial post once you get Manjaro running on SD Card.

Good luck.

Hi Spikerguy!
This time I could boot from sd card with the MAINLINE UBOOT. I am wondering, since it did not work in the past.
Now I could flash to emmc and I can boot now from emmc.
Just one remark: After login I get a black screen.
For me it is not a problem since, I do not need it!
Thanks for your support and passions