Ubuntu for Android/Mini PCs
Ubuntu Mini is lean and mean Ubuntu for ARM based Mini PCs. I started off like a lot of others by using PicUntu, but I wanted granular control of what packages were installed. You can use the pre-built kernels, build your own or get a kernel elsewhere. This will give you a lot more flexibility for creating customized distributions.
You will need to identify your hardware since even the same brand names may have different chipsets. To be safe ask the vendor before buying if possible (a lot of newer RK3188 devices really have RK3188T CPUs which have problems with various kernels available). I've personally only tested the MK808, MK-802IV with 8188eu/AP6210 and ODROID C1/C1+. In theory, this should work on any ARM device that can boot a Linux kernel and mount the root file system.
You assume all the risks that come with flashing an Android device. It's very painless and hard to screw up, but if you do brick your Mini PC you are on your own!
Device Name | Manufacturer | Released | NAND flash | Wifi Chipset | Bluetooth Chipset | Special notes |
---|---|---|---|---|---|---|
UG802 | Ugoos | May, 2012 | 4 GB | Realtek 8188eus | none | Officially supported |
MK808 | OEM | Sep, 2012 | 4-8 GB | Broadcom 4329 | none | Officially supported |
MK802 III | RikoMagic | Oct, 2012 | 4-8 GB | Realtek 8188eus | none | Officially supported |
Neo G4 | Minix | Nov, 2012 | 8 GB | Realtek 8188eus | none | Not officially supported, but wifi chipset is supported |
MK808-B | OEM | Dec, 2012 | 8 GB | Broadcom 4330 | Broadcom 4330 | |
MK808-B clone | OEM | Dec, 2012 | 8 GB | Mediatek MT5931 | Mediatek MT6622 | |
MK808-B Sunvel | OEM | Jan, 2013 | 8 GB | Mediatek MT5931 | Mediatek MT6622 | |
MK802 IIIB | RikoMagic | Jan, 2013 | 4-8 GB | Mediatek MT5931 | Mediatek MT6622 | |
UG007 | Ugoos | Oct, 2012 | 8 GB | Mediatek MT5931 | Mediatek MT6622 | |
MX1/MX2 | Imito | Oct, 2012 | 8 GB | Mediatek MT5931 | Mediatek MT6622 | |
Neo X5 | Minix | Nov, 2012 | 16 GB | Broadcom 4330 | Broadcom 4330 | |
MK809 II | Kimdescent | Dec, 2012 | 8 GB | Mediatek MT5931 | Mediatek MT6622 | |
B12 | Kimdescent | Jan, 2013 | 8 GB | Mediatek MT5931 | Mediatek MT6622 | Onboard cam |
This is based on Alok Sihna's 3.0.8 kernel
Device Name | Manufacturer | Released | NAND flash | Wifi Chipset | Bluetooth Chipset | Special notes |
---|---|---|---|---|---|---|
MK802IV | RikoMagic | May, 2013 | 8 GB | Realtek 8188eus or Broadcom AP6210 | Mediatek MT6622 | Officially supported |
CX919 | OEM | Feb, 2013 | 8 GB | Broadcom AP6330 | Broadcom 4330 | Officially supported |
MK908 | Tronsmart | May, 2013 | 8 GB | Broadcom AP6210 | Broadcom 4330 | Officially supported |
QX1 | iMito | May, 2013 | 8 GB | Realtek 8189ES | RDA5876A | Officially supported |
T428 | Tronsmart | May, 2013 | 8 GB | Broadcom AP6330 | Broadcom 4330 | Officially supported |
This is based on Marvin the Paranoid Android Kernel Builder
Note: You will need to look up the adapter you intend to use and see which chipset it is using. Then look at the list below to see if the chipset is included.
This is based on Alok Sihna's 3.0.8 kernel
sudo su -
apt-get -y install qemu-user-static binfmt-support debootstrap
sfdisk -s
(note 8 GB device is /dev/sdb)fdisk /dev/sdb
mkfs.ext4 -O ^metadata_csum -L linuxroot /dev/sdb1
mkdir /mnt/tmp
mount /dev/sdb1 /mnt/tmp
rm -rf /mnt/tmp/lost+found
qemu-debootstrap --verbose --variant=minbase --arch=armhf --include=nano trusty /mnt/tmp http://ports.ubuntu.com/ubuntu-ports > install.log 2>&1
tail install.log
tar -pzcf minbase.tar.gz -C /mnt/tmp .
mount -t proc proc /mnt/tmp/proc
mount -t sysfs sysfs /mnt/tmp/sys
mount -o bind /dev /mnt/tmp/dev
mount -t devpts devpts /mnt/tmp/dev/pts
chroot /mnt/tmp
nano /etc/apt/sources.list
apt-get update
apt-get -y install language-pack-en-base
dpkg-reconfigure tzdata
apt-get -y install sudo isc-dhcp-client udev netbase ifupdown iproute openssh-server iputils-ping wget net-tools wireless-tools wpasupplicant ntpdate ntp less tzdata console-common module-init-tools
apt-get -y upgrade
echo "bcm40181" >> /etc/modules
echo "rkwifi" >> /etc/modules
echo "ubuntu" > /etc/hostname
nano /etc/network/interfaces
(note device may show up as wlan0)
nano /etc/hosts
nano /etc/resolv.conf
adduser test
gpasswd -a test sudo
exit
umount /mnt/tmp/{proc,sys,dev/pts,dev,}
(This may fail, just reboot)rm -rf /mnt/tmp
mkdir /media/linuxroot
mount /dev/sdb1 /media/linuxroot
tar -pzcf linuxroot.tar.gz -C /media/linuxroot .
umount /media/linuxroot
rm -rf /media/linuxroot
exit
sudo mkfs.ext4 -F -O ^metadata_csum -L linuxroot /dev/sdg
(assumes SD device is /dev/sdg, always check first)sudo tar -pzxf linuxroot.tar.gz -C /media/linuxroot
sudo tar -zxf kernel.tar.gz
sudo rm -Rf /media/linuxroot/lib/firmware
sudo rm -Rf /media/linuxroot/lib/modules
sudo tar -pzxf mod-fw.tar.gz -C /
sudo chown root:root -R /media/linuxroot/lib/firmware
sudo chown root:root -R /media/linuxroot/lib/modules
sudo chown root:root -R /media/linuxroot/system
sync
tar -zxvf kernel.tar.gz
git clone https://github.com/linuxerwang/rkflashkit.git
cd rkflashkit
./waf debian
sudo apt-get install python-gtk2
sudo dpkg -i binaries/rkflashkit_0.1.1_all.deb
sudo rkflashkit
reboot recovery
sudo depmod -a
sudo reboot
su
mount -o rw,remount /system
ls /dev/block
mmcblk0
/dev/block/mmcblk0
with actual block device)
cd /etc/init.d
touch 99boot_linux
echo "#!/system/bin/sh" >> 99boot_linux
echo "if [ -b /dev/block/mmcblk0 ]; then" >> 99boot_linux
echo "reboot recovery" >> 99boot_linux
echo "fi" >> 99boot_linux
cat 99boot_linux
chmod 777 99boot_linux
reboot
I automated much of Ubuntu Minimal Image by using three scripts. My scripts also configure language, timezone and wireless support (disabled by default). Tested on 01/19/2016.
wget https://raw.githubusercontent.com/sgjava/ubuntu-mini/master/odroid-c1/image.sh
wget https://raw.githubusercontent.com/sgjava/ubuntu-mini/master/odroid-c1/minimal.sh
wget https://raw.githubusercontent.com/sgjava/ubuntu-mini/master/odroid-c1/finish.sh
chmod a+x *.sh
export ubuntu=`pwd`
sudo ./image.sh
apt-get -y install language-pack-en-base
in minimal.sh and change to desired language packsudo cp minimal.sh /home/<username>/ubuntu/target/root/.
cd ubuntu
sudo chroot target
cd /root
chmod a+x minimal.sh
./minimal.sh
exit
cd ..
sudo ./finish.sh
device is busy
error try the following:
sudo reboot
sudo fdisk -l
Find your SD cardsudo dd if=image.img of=/dev/sdX bs=1M
nano /etc/network/interfaces.d/wlan0
nano /etc/hosts
nano /etc/resolv.conf
Skipping mounting / since Plymouth is not available
on RK3066 or RK3188sudo mount -o remount,rw /
sudo reboot
cat /sys/module/tsadc/parameters/temp* | cut -d " " -f1,2
cat /sys/devices/virtual/thermal/thermal_zone0/temp
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
sudo apt-get install cpufrequtils
cpufreq-info -o
current settingscpufreq-info -s
list of speeds you can setsudo cpufreq-info -w
current speedsudo cpufreq-set -r --max 1.2GHz
maximum frequencysudo cpufreq-set -r --min 1.2GHz
minimum frequencysudo update-rc.d ondemand disable
sudo nano /etc/default/cpufrequtils
settings on start up (this is for ODROID C1 for example)
ENABLE="true"
GOVERNOR="conservative"
MAX_SPEED=1632000
MIN_SPEED=96000
sudo nano /etc/default/rcS
sudo nano /etc/init/failsafe.conf
sleep
commandsI had issues with the MK808 and internal wireless network building my own kernels. From various forum postings it looks like others have had success, so all I can say is good luck.
sudo apt-get -y install git-core flex bison build-essential gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi libncurses5-dev zlib1g-dev lib32z1 lib32ncurses5 sharutils lzop
sudo apt-get -y install git-core flex bison build-essential gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi libncurses5-dev zlib1g-dev sharutils lzop
mkdir -p $HOME/src/rk3066/mod_fw
cd $HOME/src/rk3066
git clone https://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
git clone https://github.com/olegk0/tools.git
git clone https://github.com/Galland/rk30_linux_initramfs.git initramfs
cd initramfs
gzip -dc debian-3.0.8+fkubi.cpio.gz > initramfs.cpio
cd ..
git clone https://github.com/aloksinha2001/picuntu-3.0.8-alok.git
cd picuntu-3.0.8-alok
nano ../initramfs/config
CONFIG_BOX_FB
and comment out CONFIG_BOX_FB_720P=y
uncomment # CONFIG_BOX_FB_480P is not set
and change to CONFIG_BOX_FB_480P=y
for instancemake menuconfig
if you want to go the more hard core routecp ../initramfs/config .config
export ARCH=arm
export CROSS_COMPILE=$HOME/src/rk3066/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
make -j$(getconf _NPROCESSORS_ONLN)
cd ..
tools/mkbootimg --kernel picuntu-3.0.8-alok/arch/arm/boot/Image --ramdisk initramfs/fakeramdisk.gz --base 60400000 --pagesize 16384 --ramdiskaddr 62000000 -o recovery.img
cd picuntu-3.0.8-alok
make modules_install INSTALL_MOD_PATH=$HOME/src/rk3066/mod_fw
cd ..
wget http://cdn02.arctablet.com/mirrors/picuntu/picuntu-linuxroot-0.9-RC2.2.tgz
tar -zxvf picuntu-linuxroot-0.9-RC2.2.tgz -C mod_fw ./lib/firmware
mkdir -p $HOME/src/rk3066/mod_fw
cd $HOME/src/rk3066
git clone https://github.com/olegk0/tools.git
git clone https://github.com/Galland/rk30_linux_initramfs.git initramfs
cd initramfs
gzip -dc debian-3.0.8+fkubi.cpio.gz > initramfs.cpio
cd ..
git clone --depth 1 https://github.com/Galland/rk3x_kernel_3.0.36.git
cd rk3x_kernel_3.0.36
nano config.galland
CONFIG_BOX_FB
and comment out CONFIG_BOX_FB_720P=y
uncomment # CONFIG_BOX_FB_480P is not set
and change to CONFIG_BOX_FB_480P=y
for instancemake menuconfig
if you want to go the more hard core routenano build_rk3066
chmod +x build_rk3066
./build_rk3066
cd ..
tools/mkbootimg --kernel rk3x_kernel_3.0.36/arch/arm/boot/Image --ramdisk initramfs/fakeramdisk.gz --base 60400000 --pagesize 16384 --ramdiskaddr 62000000 -o recovery.img
mkdir android
cd android
git clone https://github.com/phjanderson/marvin.git
git clone https://github.com/phjanderson/Kernel-3188.git
git clone https://github.com/phjanderson/Kernel-3188-X7.git
git clone https://github.com/phjanderson/Linux3188.git
(this is what I'll select)HDMI_VIDEO_DEFAULT_MODE
to HDMI_720x480p_60HZ_4_3
instead of HDMI_1920x1080p_60HZ
size_t get_fb_size(void)
{
size_t size = 0;
#if defined(CONFIG_THREE_FB_BUFFER)
size = ((H_VD)*(V_VD)<<2)* 3; //three buffer
#else
size = ((H_VD)*(V_VD)<<2)<<1; //two buffer
#endif
return ALIGN(size,SZ_1M);
}
git clone https://github.com/phjanderson/3188-SRC-AP6210.git
git clone https://github.com/Galland/rk30_linux_initramfs.git initramfs
git clone https://github.com/olegk0/tools.git
cd marvin
./marvin install_builddep
./marvin platform
(to see platforms)./marvin platform picuntu3188
(I'm going to build with PicUntu kernel)./marvin config
(to see options)./marvin config mk802iv_rtl8188eu cpu1608h 720p
./marvin build_modules
cd ..
tools/mkbootimg --kernel marvin/platform/picuntu3188/output/kernel_marvin_mk802iv_rtl8188eu/kernel_marvin_mk802iv_rtl8188eu_cpu1608h_720p.img --ramdisk initramfs/fakeramdisk.gz --base 60400000 --pagesize 16384 --ramdiskaddr 62000000 -o recovery.img
mkdir -p $HOME/src/rk3066/mod_fw
cd $HOME/src/rk3066
git clone https://github.com/omegamoon/rockchip-rk30xx-mk808.git
cd rockchip-rk30xx-mk808
./build_mk808_omegamoon_hdmi_720p
(or other build script)./flash_mk808_omegamoon
Copyright (c) Steven P. Goldsmith
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.