Armbian + KODI (Ubuntu\Debian) for SD & USB & eMMC

In my experience, these options do not perform a full wipe of all data in eMMC. Only manual execution of the command DD capture all the cells with zeros and subsequent real clean install.

The latest images contain the latest scripts.

Thx! I hope this is enough before I do everything from the start.

$ sudo dd if=/dev/zero of=/dev/mmcblk2
dd: writing to ‘/dev/mmcblk2’: No space left on device
61071361+0 records in
61071360+0 records out
31268536320 bytes (31 GB, 29 GiB) copied, 1132.26 s, 27.6 MB/s

So this is the procedure I’ll go with.

  1. Burn latest Android to eMMC with USB burning tool (full erase of flash and bootloader)
  2. Burn latest Armbian to mSD card with Etcher
  3. Change dtb filename in both /extlinux/extlinux.conf and uEnv.ini to meson-g12b-a311d-khadas-vim3.dtb
  4. Boot into Android while mSD card / USB is unplugged.
  5. Plug in mSD card / USB
  6. Activate multi-boot by
    6.1 Select Droid SettingsMore settingsDevice PreferencesAboutUPDATE
    6.2 Choose Select under UpdateLocale and BOOT/aml_autoscript.zip
    6.3 Select Update and Update again.
  7. Log in with root, change root password and add new user
  8. Run ./install with root and shutdown after successful installation to eMMC
  9. Unplug power and mSD card / USB before powering on again

Try after installing to eMMC Armbian (after using Scripta “install.sh”), does not disable external media Armbian, and perform again the activation of the multi-boot (using the buttons “Power” + “Reset”). Perhaps the latest firmware versions have a bug that causes deactivation of multi-boot.

From step 6.3 above, I get the following error after pressing Update two times:

Supported API: 3
charge_status 2, charge 1, status SUCCESS, capacity 100
Finding update package…
Opening update package…
Verifying update package…
E: footer is wrong
Update package verification took 0.0 s (result 1).
E: Signature verification failed
E:error 21
Installation aborted.

From here, what should I do? Is this really necessary? Is the Keys Mode (U-Boot is Running Normally) - using Power + Reset buttons - equivalent to the old method in regard of activating multi-boot? Which means that step 6.1-6.3 is equivalent to booting into external media with Keys Mode?

I do not know what broke in update mode through the U&B app, use to activate the multi-boot button (Power+Reset). Buttons should work on all firmware.

I still can’t get it to boot to Armbian from eMMC. The last step I’ve done is to run ./install.sh with the following output:

./install.sh output

root@aml : ~ # ./install.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.0678512 s, 61.8 MB/s

Start create MBR and partittion

./install.sh: 55: ./install.sh: parted: not found

./install.sh: 56: ./install.sh: parted: not found

./install.sh: 57: ./install.sh: parted: not found

Start restore u-boot

442+0 records in

442+0 records out

442 bytes copied, 0.00463437 s, 95.4 kB/s

8191+0 records in

8191+0 records out

4193792 bytes (4.2 MB, 4.0 MiB) copied, 0.257218 s, 16.3 MB/s

Done

Start copy system for eMMC.

Formatting BOOT partition..../install.sh: 87: ./install.sh: mkfs.vfat: not found

done.

mount: /ddbr/install: special device /dev/mmcblk2p1 does not exist.

Cppying BOOT...done.

Edit init config...done.

umount: /ddbr/install: not mounted.

Formatting ROOT partition...

./install.sh: 112: ./install.sh: mke2fs: not found

./install.sh: 113: ./install.sh: e2fsck: not found

done.

Copying ROOTFS.

mount: /ddbr/install: special device /dev/mmcblk2p2 does not exist.

Copy BIN

Create DEV

Copy ETC

Copy HOME

Copy LIB

Create MEDIA

Create MNT

Copy OPT

Create PROC

Copy ROOT

Create RUN

Copy SBIN

Copy SELINUX

Copy SRV

Create SYS

Create TMP

Copy USR

Copy VAR

Copy fstab

umount: /ddbr/install: not mounted.

*******************************************

Complete copy OS to eMMC 

*******************************************

After installing to eMMC and unplugging my mSD card my VIM3 always boots to Android. I’ve tried to activate multi-boot again with the keys mode (power+reset buttons) and it boots to Armbian from mSD when mSD card is inserted, otherwise it boots to Android Recovery.

parted package ia not present. Install it first.
sudo apt install parted

The package parted is installed as seen below

$ sudo apt-cache policy parted
parted:
Installed: 3.2-25
Candidate: 3.2-25
Version table:
*** 3.2-25 500
500 Index of /debian buster/main arm64 Packages
100 /var/lib/dpkg/status

The log above shows that parted was not found and due to that it was not able make partition and thats why mmcblk1p1 was not found.

So Need to find why it is not able to find parted.

Run the script only as root.

I did. You can’t access the folder /root without… :slight_smile: The output below is the exact from above, I just changed the first line as I used a personal hostname.

root@aml : ~ # ./install.sh
Start script create MBR and filesystem

/dev/mmcblk2

Only show the full output from run command (skript) input until the end of the script.

The output is in the post above: Armbian + KODI (Ubuntu\Debian) for SD & USB & eMMC

I can run ./install.sh again if you want? (second time)

@Spikerguy, have you also given this a try on your VIM3 with latest VIM3 Android Pie V190907?

Not on vim3 but on vim1 with latest android version and also with manjaro linux and not armbian.

I will try it tonight.

I ran the script again, but this time with sudo in front.

sudo ./install.sh output second time

root@aml : ~ # sudo ./install.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.0546335 s, 76.8 MB/s

Start create MBR and partittion

Start restore u-boot

442+0 records in

442+0 records out

442 bytes copied, 0.00148496 s, 298 kB/s

8191+0 records in

8191+0 records out

4193792 bytes (4.2 MB, 4.0 MiB) copied, 0.247898 s, 16.9 MB/s

Done

Start copy system for eMMC.

Formatting BOOT partition...mkfs.fat 4.1 (2017-01-24)

done.

Cppying BOOT...done.

Edit init config...done.

Formatting ROOT partition...

e2fsck 1.44.5 (15-Dec-2018)

ROOT_EMMC: clean, 11/1859584 files, 160771/7431424 blocks

done.

Copying ROOTFS.

Copy BIN

Create DEV

Copy ETC

Copy HOME

Copy LIB

Create MEDIA

Create MNT

Copy OPT

Create PROC

Copy ROOT

Create RUN

Copy SBIN

Copy SELINUX

Copy SRV

Create SYS

Create TMP

Copy USR

Copy VAR

Copy fstab

*******************************************

Complete copy OS to eMMC 

*******************************************

I finally got everything to work. Thanks for the great help and feedback, @balbes150! :slight_smile: This is the complete step-by-step guide:

  1. Burn latest Android to eMMC with USB burning tool (full erase of flash and bootloader) *
  2. Burn latest Armbian to mSD card / USB with Etcher
  3. Change dtb filename in both /extlinux/extlinux.conf and uEnv.ini to meson-g12b-a311d-khadas-vim3.dtb
  4. Insert mSD card / USB and boot into Android
  5. Activate multi-boot by using

Keys Mode (U-Boot is Running Normally) (Link)

  1. Power on VIM3.
  2. Long press the POWER key without releasing it.
  3. Short press the ‘Reset’ key and release it.
  4. Count for 2 to 3 seconds, then release the POWER key to enter into Upgrade Mode. You will see the sys-led turn ON when you’ve entered Upgrade Mode.
  1. Log in with root, change root password and add new user
  2. Run sudo ./install.sh with root and shutdown after successful installation to eMMC
  3. Activate multi-boot again by using Keys Mode (see step 5) (Remember to have mSD card / USB inserted)
  4. Shutdown, unplug your mSD card / USB and power on. You should now be running Armbian from eMMC :slight_smile:
  • If you have preinstalled any other OS than Android on eMMC, wipe eMMC before burning Android on it by running dd if=/dev/zero of=/dev/mmcblk<number_eMMC> from an OS on mSD/USB.
1 Like

I also got it to work. Just think which was missing is that it has to have multiboot active.
And armbian does that on its first boot.

That’s great work by balbes
EDIT: I can confirm this works completely fine with armbian but failed with other os like I tried for Manjaro. I will get a new UART cable and check the reason for no boot even after the script runs successfully. I am still able to boot from usb with multiboot active.

Is anyone else getting “Input/output error” when transferring data between two external drives? I’ve hoped the issues regarding IO errors were fixed in kernel 5.3 for Amlogic devices… I’m on 5.3.0-rc6-aml-g12 so perhaps I should give the final version a try.

To Khadas devs: Have other with VIM3 reported Input/output error? Especially those using khadas-vims-4.9.y which you maintain on GH, @numbqq. This was one of the main reasons for why I bought a VIM3 instead of the cheaper ODROID-N2 as Hardkernel have had massive issues regarding this (https://forum.odroid.com/viewtopic.php?f=181&t=35031).

Update:
Changing /sys/class/block/?d?/queue/max_sectors_kb from the value of 1024 to 32 still trigger the error.

My setup is as follows: A VIM3 with a ORICO Mini USB 3.0 HUB 4 Port connected to a Rocketek usb 3.0 multi Smart memory card reader with a mSD card inserted and a Seagate Expansion Desktop. Both the ORICO USB HUB and Seagate HDD are powered with an external power supply.

Update 2:
This is the patch I need which Amlogic worked out for g12 devices:
dwc3/core: xHCI host not responding to stop endpoint command

I can’t seem to find the patch in Kernel 5.3 patch notes… So I suppose it isn’t merged yet. I’ve asked balbes if he can include the patch into the next build with Armbian. I highly advice the Khadas team to look into this as it should also affect others using kernel 4.9.

@Frank Please follow up.

@Z11ntal33r
Hello , I use a hub and two usb drivers .
First I mount two usb drivers in /mnt

khadas@Khadas:/mnt$ sudo mount /dev/sda2 usb1/
khadas@Khadas:/mnt$ sudo mount /dev/sdb1 usb2/

Then I cp a file to USB1 from USB2

khadas@Khadas:/mnt/usb2$ sudo cp ldlinux.sys ../usb1/
khadas@Khadas:/mnt/usb2$

I don’t find any error.Can you tell me how to reproduce ?