I’ve assembled a network installer image to install Debian 7.0 “Wheezy” on the GK802 “Android TV” Mini PC. This is intended for people who want to run the GK802 headless or semi-headless, for server or robotics applications.

Zealz GK802Login console on my TV (my TV doesn't upscale 640x480 well.)

Last update: 24 May, see details

The GK802 is a 1GHz quad core ARM Cortex A9 computer that fits in your pocket. Built around the Freescale i.MX6 system-on-a-chip, it has 1Gb of RAM, two MMC (MicroSD) interfaces, a USB host interface, HDMI output and a LvTTL (3.3v) serial port and i2c bus available internally. I got mine for $69.99 on geekbuying.com, taking advantage of this coupon deal.

Quick Start

  • Download the installer image here (21Mb in Gzip or Zip format.)

  • Unzip and ‘dd’ the 43Mb installer image to a MicroSD card.

To do it in one step:

 zcat gk802_debian_installer.img.gz | sudo dd of=/dev/mmcblk0 bs=4M conv=fsync

(Replace /dev/mmcblk0 with whatever device your SD card shows up on. See below for Windows/OS X.)

  • Insert the MicroSD into the internal captive MicroSD slot on your GK802 (On the bottom, you have to open the case to get to it.)

  • Power on with a USB keyboard plugged in (or connect wires to the internal serial port, see below), then follow the prompts to install Debian to either a MicroSD card (internal or external) or a USB device.

If installing to a USB device, you’ll need to delete the contents of the installer partition from the MicroSD card before booting into Debian, or it will just boot the installer again. However you should still leave the MicroSD card in place, as it contains the bootloader. You can do this from the Installer Partitioner tool (use the erase or format option on the partition), or just remove the MicroSD and delete the files from your host OS.

If you’re not installing to a USB device, you shouldn’t have to do anything about the installer partition. If you install to the internal MMC slot “MMC 0″ then it will be overwritten, if you install to the external MMC slot “MMC 1″ then this slot has higher boot priority than the internal.

  • Once you get up and running I suggest immediately installing ntp (no onboard RTC, and running in 1970 is overrated.)

cat /proc/cpuinfo on my TV

Updates

OS X or Windows?

If you’re on OS X or Windows then here are some Raspberry Pi oriented instructions for writing out SD images from these OSes. Most of these should work with the unzipped installer image, even Pi Filler or Pi Writer I think (despite the Pi-centric titles, SD cards are SD cards and bytes are bytes…)

Things That Do Work

  • Wifi, you can even use it for the install. Post-install configuration info here.
  • USB host (can use a USB Ethernet device for the install if you have one.)
  • CPU Frequency Scaling and thermal throttling.
  • HDMI Output.
  • LVM, encrypted rootfs, fancy partition schemes, software RAID.

Things That Don’t Work

  • Bluetooth. GK802 Bluetooth support on GNU/Linux is a work-in-progress at time of writing.
  • CAAM hardware crypto module. Disabled as it caused kernel oopses when using LUKS disk encryption. Might work for IPSec as-is, I hope to fix it for LUKS as well and re-enable it.
  • GPU/VPU for accelerated desktop graphics or video decoding. See below for details.
  • USB Gadget (ie using the GK802 as a USB device.) Disabled due to a known issue.

Serial port?

The internal 3.3v LvTTL serial port is automatically enabled for kernel boot console (the boot console is simultaneously shown on the HDMI output.) The serial port also has a tty assigned to it (in addition to virtual terminal ttys on the HDMI output.)

By default the installer doesn’t receive input on the serial port, only via HDMI. Same for any early boot input (ie if Debian detects a problem it will drop you to a root shell shown on the HDMI output.) To swap this interactive behaviour to the serial port, hold down the Recovery button at power on. You can also enter recovery mode via serial, press a key at the uboot autoboot prompt and and then type:

setenv recovery 1; boot;

(To make this change permanent you can also edit the bootloader script, see the Bootloader section below.)

Kernel Updates

The installer provides a kernel package with this kernel and this config.

To change which kernel is booting, in /boot there are symlinks zImage & initrd pointing to the kernel used for normal booting, and zImage_recovery & initrd_recovery for recovery mode booting. Just change these to point to the new kernel.

If you want to build your own kernel package then you can use Debian’s make-kpkg tool, something like this:

DEB_HOST_ARCH=armhf fakeroot make-kpkg --arch arm --subarch gk802 --initrd --cross-compile arm-linux-gnueabihf kernel_image

(See the gk802-debian-installer Makefile if you want to create a kernel package with a matching revision scheme to the supplied one.)

Bootloader

On GK802 Uboot loads from MMC 0 (internal/captive) where it is installed before the first partition. The uboot provided with the installer looks for a /ubootcmd or /boot/ubootcmd script file on the first partition of MMC 1 (external), then MMC 0 (internal/captive) then USB devices 1 or 2.

The installer provides a suitable /boot/ubootcmd script, with accompanying source in /boot/ubootcmd.src. That script looks for a zImage kernel and initrd in the first partition of MMC 1, then MMC 0, then USB devices 1-5.

To regenerate the uboot /boot/ubootcmd from /boot/ubootcmd.src, run /boot/update_ubootcmd.sh.

If you need to reflash the Uboot binary to MMC 0 you can download it from here (/source) and flash it with

sudo dd if=u-boot.imx of=/dev/mmcblk0 bs=1k seek=1

Why distribute an installer?

Usually for these kind of devices people just provide a precanned OS image that boots directly up. I’m not a huge fan of this, it usually makes it hard to reproduce what the author did and inevitably there’ll be some extra stuff installed or lying around on the filesystem from when they were cleaning it up post-release.

I am guilty of all of these sins myself, but this time I wanted to make it so someone else could reproduce the results, or easily tweak the build process. Hence, github repo. It’s still hacky, but it’s better than nothing.

Also, for my GK802 I wanted to run an encrypted rootfs on top of a software RAID-1 device using both MicroSD slots. You can probably set this up by hand with Debootstrap and lots of file editing, but Debian-Installer does it neatly and automatically just by following some menu prompts.

Full Desktop OS?

The Debian Desktop option is available to choose in the installer (takes a fair while to install.) It may even work out-of-the-box if your screen doesn’t strike the kernel EDID bug and default to 640×480 (mine does.) However you’ll only get the plain unaccelerated framebuffer driver fbdev, this is not a good option for a full desktop OS.

The Vivante GPU is disabled in the Kernel config, because this saves 192Mb of RAM. Also no proprietary Vivante X11 drivers are installed.

If you want a ready-to-go desktop OS with video acceleration, check out Jasbir’s Ubuntu images for GK802.

NB: Freescale supplies binary xorg drivers that work with Ubuntu, which is what Jasbir uses. These may work with Wheezy but it’s unlikely – Ubuntu 12.04 uses Xorg 1.11 and Ubuntu 12.10 uses 1.13, but Wheezy uses 1.12, so the ABIs are probably different. Please post your findings if you experiment with this. :)

Source?

The “source” build process that preprocesses a Debian netinst image to produce a GK802 installer is on github here if you want to do anything with it.

Resources

19 thoughts on “Debian Installer for Zealz GK802 “Android TV” quad core ARM MiniPC

  1. Thanks for the work! I’m trying to use this in a robotics project but I have two problems (last one is the important one):

    Spanish locale doesn’t work, shows lots of “ERR” messages at every installation step.

    If I try to install it in english it fails downloading dpkg and so on packages (but network, DHCP, ect seems to work fine!).

    What could I be doing wrong?

    Thanks.

    • Hi Oscar,

      Glad to hear you got it working. It’s a little annoying locales are broken, I imagine that must be something with the modified installer image. My first GK802 is now in permanent usage as a personal server, but I’ve ordered a second one – when it shows up I’ll do some tests.

      I didn’t realise the armhf packages were missing from some Debian primary mirrors (according to http://www.debian.org/mirror/list it seems like only Spain & Hong Kong are missing supported architectures!) Funny that there are other secondary mirrors in Spain that do have all the architectures!

      – Angus

  2. Great stuff. I’m trying it out, and have come as far as to having a busybox init going with C-A-F2 & C-A-F3 giving me two tiny shells. I suppose I need to configure the wlan here in order to do the installation, and maybe you could advice me on this?

    To recap: I dd-ed the gz onto a 4Gb card, and replaced the internal card with this. Pressed reset while turing on, and waited ~10 sec. Then the screen stopped afterdetecting the usb keyboard and mouse. Now I have the two shells and (I think) the dmesg log on C-A-F4.

    Probably I need to configure the wlan now….

    Ralph.

    • Glad it’s working Ralph. I’m not sure why it dropped you to the busybox console at all, but I’m glad the reboot sorted it out!

  3. Thanks a lot for this! A full-blown Ubuntu desktop installation was too much for my needs, but your Debian installer fit the bill for an always-on server.

    Flawless installation process. My GK802 is now 100% more useful! :-)

  4. Hi.

    Thanks for the image. I just skimmed through your github repository and I didn’t understand what layout the SD card should have for it to boot. For the effect of this, I just removed the original SD card to preserve it and bought a blank 4GB SD card.

    I dd’ed it with /dev/zero and I would like to start from there. Skimming (really briefly, I may have missed a lot of things, please correct me if I am wrong), your Makefile, I noticed that:

    * You put create the partition table starting in the MBR with sfdisk. Is that right?
    * You put uboot starting at 1KB from the beginning of the card, in an unpartitioned area before the beginning of the first partition. Is that right?
    * You create the first partition starting at 1MB from the beginning of the card. Is that right?

    Regarding this layout, is the GK802 programmed to load uboot from that unpartitioned area? I understand that once uboot is loaded, then we have almost all the control that we want, since it is flexible with scripting and so on.

    I would love it if you could confirm these, as I am planning on writing a blog post about this and getting my hands dirty with my new toy.

    Thanks.

    • Hi Rogério,

      Glad it’s of some us to you. You pretty much have it all correct:

      – The installer creator just makes a standard DOS partition table (using sfdisk) with a single partition starting at 1Mb offset.

      – The GK802 will load uboot from a 1k offset on the SD card. You could (I assume) map a partition at that offset, but the common approach seems to be to just leave a gap before the first partition on the SD card. There’s some more description here: https://github.com/imx6-dongle/wiki/wiki/U-Boot-basics (that wiki is useful in general.)

      If you do a lot of tinkering then the imxboot tool (also mentioned on the wiki link) is worth a look as well – if you remove the SD card then you can connect the GK802 as a USB device and then pass the boot image in over USB. Very handy for development!

      Hope you enjoy your GK802 hacking. :)

      – Angus

      • Dear Angus,

        Thank you very much for the confirmation and, especially, for the valuable pointer to that wiki.

        I guess that I will start looking at what the project needs and, depending on the progress, have an installer for the GK802 for the next Debian release (it will be extra cool if we can get the video decoding/vivante drivers in time).

        So far, excluding the mainstream i386 and amd64 arches, I only have experience with powerpc, which is the reason why these ARM toys look so alien to me.

        Again, thanks a lot for the information!

  5. I’ve just picked up one of these and am having the damndest time getting Debian to connect to a network. Install to the microSD card went fine, it boots fine and the installation script works fine, right up to the part where it connects to the network. The internal wifi can see all the APs in the neighborhood just fine, but can’t connect to any of ‘em. (Works fine in the stock Android install.) The part where it wants to configure via DHCP lasts about a minute, and then it throws up an error. I figured okay, maybe it’s some kind of bug, so I hauled out some network cables and a USB->Ethernet adapter, and… same thing over a wired network. Borrowed another USB-> Ethernet adapter, same thing again. And even if I manually configure the network, it still can’t reach the ‘net.

    Any thoughts? This seems like it’d make a great upgrade to my old A10-based Debian stick, if I could just get it to work…

    • All I can think of is that maybe debian-installer’s network support doesn’t like something about your DHCP server. Can you try setting a static IP in the installer, see if you get any further? How about if you boot a full-sized PC with a Debian Wheezy x86 network installer?

      – Angus

      • Regular x86 box connects just fine with the network installer, alas. The GK802 just won’t connect via Debian no matter what I do. I’ve now tried three USB hubs, three ethernet adapters, and two USB wifi adapters, and no combination of any of the above work. (It doesn’t even recognize the wifi adapters, irritatingly.) I can set a static network config just fine, and can even ping the outside world with one of the ethernet adapters (albeit at 10mbit half-duplex, WTF), but it then barfs when trying to download the packages from… anywhere.

        I’m going to try attaching a hardware serial console so I can try wifi or wired ethernet directly to the USB port, without using a hub, but I don’t have much hope at the moment.

  6. Hello Angus,

    thanks a lot for this installer. It is so much more flexible than having to use a pre-installed system.
    I also tried Jasbir’s Ubuntu images. While I honestly admire his work, it seems that the Debian system is more reliable and has a better performance (this may be due to the armhf architecture on Debian vs armel on Ubuntu). The availability of the GPU/VPU acceleration is hardly noticeable when doing regular “desktop work”. I’m currently using Gnome3 on Debian and find it just as responsive as Ubuntu’s Unity with acceleration. Actually, Gnome and KDE did not work with hardware acceleration on Jasbir’s images (moving windows messed up the screen).

    I was also struck by the EDID bug and ended up with 640×480. However, I was able to resolve this issue by adding some modelines to my xorg.conf:

    Section “Device”
    Identifier “Configured Video Device”
    Driver “fbdev”
    EndSection

    Section “Monitor”
    Identifier “Configured Monitor”
    Modeline “1024×768″ 60.80 1024 1056 1128 1272 768 768 770 796
    Modeline “800×600″ 38.21 800 832 976 1008 600 612 618 631
    Modeline “640×480″ 24.11 640 672 760 792 480 490 495 50
    Modeline “1280×1024″ 108.00 1280 1328 1440 1688 1024 1025 1028 1066
    HorizSync 30.0 – 81.0
    VertRefresh 56.0 – 75.0
    EndSection

    Section “Screen”
    Identifier “Default Screen”
    Monitor “Configured Monitor”
    Device “Configured Video Device”
    DefaultDepth 24
    Subsection “Display”
    Depth 24
    Modes “1280×1024″ “1024×768″ “800×600″ “640×480″
    EndSubsection
    EndSection

    You can find modelines for nearly all resolution by searching the net. Google is your friend (well…at least for this problem ;-).

    Another issue I was able to resolve was that gdm would not start automatically. A flashing cursor was shown instead of the login screen. Switching to console 8 manually started the greeter. So I added the following lines to rc.local:

    switch_to_X() {
    sleep 5
    chvt 8
    }

    switch_to_X &

  7. Hi All Im pretty new to linux, Thanks for the installer.
    I have this up and running but I am attempting to get a tronsmart usb to fast ethernet dongle working and I have had no luck. I have downloaded the appropriate driver and which has the following files inside

    ax88172a.c ax88172a.h ax88172a_ioctl.h ioctl.c ioctl.h Makefile readme

    When i try to run the make command per the instructions I get this

    root@debian:/drivers/AX88172A_Linux_3.8.0_Driver_v1.4.0_Source# make
    make -C /lib/modules/3.0.35-48d9718-2-gk802/build SUBDIRS=/drivers/AX88172A_Linux_3.8.0_Driver_v1.4.0_Source modules
    make: *** /lib/modules/3.0.35-48d9718-2-gk802/build: No such file or directory. Stop.
    make: *** [default] Error 2

    Im not sure how to proceed the readme states I need the kernel headers so I tried

    root@debian:~# apt-get install linux-headers-$(uname -r)
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package linux-headers-3.0.35-48d9718-2-gk802
    E: Couldn’t find any package by regex ‘linux-headers-3.0.35-48d9718-2-gk802′

    No luck. Any guidance would be greatly appreciated.

  8. hi..i have bigggg problem :( :( :(
    i bought a Gk 802 , and i install debian on it .. then i has problem for wireless driver .. after i learned its wireless drive is realtek .. i downloaded it then when i turned on my computer. by connect to power .. it turned on for 1 second then turned off ..I think هit is burnt ..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>