I acquired a
RK3288 ARM Cortex A17 (arm hard float) based Chromebook: the
Asus C201 (or the shiny metal twin
Asus Flip C100PA) and I love it: long battery life, light and easy to carry around and has suspend and wifi working (yes I mean working).
This wiki describes the software customizations I did on this ultrabook. I recently transitioned to the RK3399 based Asus C100PA second generation (USBC) to which most of the below notes still applies.
You can refer to chromebook codenames
here, C201 RK3288 is speedy based on veyron board and C101PA RK3399 is bob based on gru board.
ChromeOS tips
- open a crosh terminal: CTRL-ALT-t and then launch a shell with
shell
command under crosh (more crosh options there)
Turn on developper mode
Follow only the specific step described here.
- hold jointly ESC+REFRESH+POWER
- get developper (this will wipe clean your device)
Note that at each boot you will need to hold CTRL-D keys.
Install debian chroot
What is nice on a linux machine is that you can install in a chroot in parallel of the ChromeOS a full debian: this is achieved using crouton
cd $HOME/Downloads
sudo sh ./crouton -r stretch -t xfce,xiwi,cli-extra,keyboard,audio,core,extension,xorg -p /media/removable/sdcard
sudo startxfce4 -X xiwi &
sudo startxfce4 -X xorg &
sudo enter-chroot exec env XMETHOD=xorg startxfce4
sudo enter-chroot exec env XMETHOD=xiwi startxfce4
In order to switch to the "debian desktop" you need to hold jointly CTRL+ALT+SHIFT+FORWARD keys (FORWARD is the key next to REFRESH on the top) when using the xorg XMETHOD otherwise the fullscreen key will do just fine.
Note that you can always delete your chroot via sudo delete-chroot stretch
if needed.
Crouton cheatsheet is there if you need to learn more.
Note that chroot filesystem location is stored there /usr/local/chroots/stretch
or /media/removable/sdcard/chroots/stretch
if you have used the prefix (-p) option.
You can define default XMETHOD in /etc/crouton/xmethod
.
Temporary netsurf-gtk installation issue with debian
Installation of crouton with debian target might fail because of a package netsurf-gtk not being available. The current workaround is to proceed following these steps:
sudo sh ./crouton -r stretch -t xiwi,cli-extra,keyboard,audio,core,extension,xorg -p /media/removable/sdcard
sudo enter-chroot
apt install xfce4 xfce4-session xfce4-goodies
exit
sudo sh ./crouton -r stretch -t xfce,xiwi,cli-extra,keyboard,audio,core,extension,xorg -p /media/removable/sdcard -u
sudo enter-chroot
I then manually the missing
netsurf-gtk and
netsurf-common packages from debian unstable (sid) downloading them following the highligted links and via a simple
sudo dpkg -i
command.
Debian customization
MYHOSTNAME=mark32
localectl set-locale LANG=fr_FR.UTF-8
timedatectl set-timezone Europe/Paris
hostnamectl set-hostname $MYHOSTNAME
hostname $MYHOSTNAME
vi /etc/hostname
mark32
EOF
vi /etc/hosts
127.0.0.1 localhost mark32
apt install sudo screen mutt irssi vim eclipse subversion-tools rsync mosh less unrar tig git openssh-server build-essential
python python-setuptools python-pip python-pip3 convmv sqlite urlview w3m par iceweasel metastore curl most ispell ifrench mtp-tools apg terminator xpdf mupdf metastore dnsutils retext zim epubcheck calibre openbox obconf meld rxvt-unicode apt-file octave maxima wxmaxima wmctrl comix locate tmux nmap catdoc wv elinks links lynx vim-gtk tidy libwmf-bin libreoffice inkscape gv ttm pmount mpc ncmpc mplayer epstool texmaker gnupg pinentry-tty pinentry-curses silversearcher-ag
setkbmap fr
apt install locales
locale-gen en_US en_US.UTF-8 en_US.ISO-8859-1 en_US.ISO-8859-15 fr_FR fr_FR.UTF-8 fr_FR.ISO-8859-15 fr_FR.ISO-8859-1
dpkg-reconfigure locales
Generating locales (this might take a while)...
en_US.ISO-8859-1... done
en_US.ISO-8859-15... done
en_US.UTF-8... done
fr_FR.UTF-8... done
fr_FR.UTF-8... done
fr_FR.ISO-8859-15@euro... done
update-locale LANG="fr_FR.UTF-8" LANGUAGE="fr:en"
Set different keyboard layout
Yes I am french and I use a french keyboard...
vi /etc/default/keyboard
XKBMODEL="chromebook"
XKBLAYOUT="fr"
sudo localectl set-x11-keymap fr chromebook
Sadly I was not able to modify xorg keyboard layout or getting xiwi to execute the $HOME/.xiwirc
without enforcing in .bashrc
the following:
[ `hostname` == "mark32" -a -n "$DISPLAY" ] && s
etxkbmap -model chromebook -layout fr
Enable services on chromebook
openssh server
In order to get traffic in you need to change iptables rules:
apt install openssh-server iptables
vi /etc/rc.local
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
full /etc/rc.local script
Note that the below script does include all the modifications explained on this web page:
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
/etc/init.d/ssh start
/etc/init.d/screen-cleanup start
/etc/init.d/hostname.sh start
/etc/init.d/keyboard-setup start
# no longer necessary since binfmt is compiled builtin in recent chromeos kernels
#insmod /agraver/git/kernel/fs/binfmt_misc.ko
/etc/init.d/binfmt-support start
/usr/local/bin/qemu-binfmt-conf.sh
#mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
service start exagear
mount --bind /agraver /opt/exagear/images/debian-8/agraver
/etc/init.d/cups start
exit 0
Simple sudo
cat /etc/sudoers
# Allow members of group sudo to execute any command
#%sudo
ALL=(ALL:ALL) ALL
%sudo
ALL=NOPASSWD: ALL
Freeing some storage space
More tips can be found
there but essentially you should from time to time issue:
To further expand storage space you can move the chroot on external microsd card preliminary ext4 formatted (note that this means that you need your sdcard to run crouton):
sudo edit-chroot -m /media/removable/debiansd/chroots/ stretch
Now to launch any crouton commands you need to append -c /media/removables/debiansd/chroots
option.
Alternatively you can ln -s /media/removable/debiansd/chroots/stretch /usr/local/chroot/stretch
Repair chroot after chromeos update
sudo sh -e ~/Downloads/crouton -u -n stretch
Reinstall or update crouton binaries
In the chromeos (crosh) domain:
sudo curl -L -# -o /usr/local/bin/crouton https://github.com/dnschneid/crouton/raw/master/installer/crouton && sudo chmod +x /usr/local/bin/crouton
sudo /usr/local/bin/crouton -b
Full screen or not full screen
sudo sh $HOME/Downloads/crouton -u -t xiwi -r stretch
- to launch temporarily full screen or embedded use the following
sudo startxfce4 -X xorg
sudo startxfce4 -X xiwi
Things to do at each boot
- login with your user
- open shell tab (CTRL-ALT-t) un chrome and launch
shell
- under the shell launch chroot via
cd;
sh ./gox.sh
following script
cat gox.sh
#!/bin/sh
sudo /usr/local/bin/startxfce4 -X xiwi > /dev/null 2>&1 &
Android tools
# Seems broken for now on debian stretch
#apt install abootimg android-libcutils android-libcutils-dev android-liblog android-liblog-dev android-libzipfile android-libzipfile-dev android-system-dev android-tools-adb android-tools-fastboot android-tools-fsutils androidsdk-ddms androidsdk-hierarchyviewer androidsdk-traceview androidsdk-uiautomatorviewer bc
apt install abootimg android-platform-tools-base android-platform-frameworks-native-headers android-platform-system-core-headers
apt install aapt android-libaapt adb
For some reasons adb, fastboot etc. are not available on stretch: you need to install manually via dpkg -i
the sid packages or prioritize the repositories to view sid packages. It is available here: adb fastboot fsutils. I tried to recompile the package manually but there are some issues not trivial to fix.
WARNING DO NOT DO THIS SINCE IT INTERFERES WITH CROUTON UPDATES!!! Another way to proceed is to add unstable debian packages into the apt source list with proper apt-pinning via
cat /etc/apt/sources.list
#deb http://httpredir.debian.org/debian/ stretch main non-free contrib
#deb-src http://httpredir.debian.org/debian/ stretch main non-free contrib
#Stable
deb http://httpredir.debian.org/debian/ stable main non-free contrib
deb-src http://httpredir.debian.org/debian/ stable main non-free contrib
#Testing
deb http://httpredir.debian.org/debian/ testing main non-free contrib
deb-src http://httpredir.debian.org/debian/ testing main non-free contrib
#Unstable
deb http://httpredir.debian.org/debian/ unstable main non-free contrib
deb-src http://httpredir.debian.org/debian/ unstable main non-free contrib
cat /etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 200
Package: *
Pin: release a=testing
Pin-Priority: 1000
Package: *
Pin: release a=unstable
Pin-Priority: 100
apt install adb fastboot android-libcutils
apktool
apktool is a nifty tool to modify/customize apk. In order to install it follow this steps:
wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool
chmod a+rx apktool
wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.0.2.jar
mv apktool_2.0.2.jar apktool.jar
chmod a+rx apktool.jar
cp apktool.jar apktool /usr/local/bin
Now you can apktool d/b.
Intel based installation
Some stuff you would need to run properly Android SDK command line tools on Intel based platforms (yes I know this is an ARM chromebook thus not relevant here):
Attempt to build Android SDK on ARM (WIP)
In order to compile Android applications on the chromebook, I started to build the Android SDK following the instructions detailed here and cloning the files there. Note that currently Android build system does not yet support arm host compilation. Here are the steps I followed:
- Get Android AOSP source following these instructions and get shallow git restricting pull to be of depth 1 to gain space on non infinite storage host
cd aosp
repo init --depth 1 -u https://android.googlesource.com/platform/manifest -b android-8.1.0_r18
cd ..
git clone https://github.com/skyleecm/android-build-tools-for-arm
cd android-build-tools-for-arm
find . -type d -name .git -prune -o -type f -print -exec cp {} ../aosp/{}.new \;
cd ../aosp
# MERGE differences with vimdiff blah blah.new
. build/envsetup.sh
lunch sdk-eng
make sdk
todo: create aosp/prebuilts/gcc/linux-arm
Overall to reduce size of the cloning of the repo you need to use the two following tricks, i) shallow clone and ii) sync only the current branch (note: it has limitations)
repo init --depth 1
repo sync -c
Have fun with programming
apt install geany-plugin-py geany-plugins geany-plugins-common geany python-pygame idle racket racket-doc scratch scala
apt install build-essential m4 autoconf automake
#wget http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.deb?_ga=1.243918213.1001792240.1435700391
#dpkg -i scala-2.11.7.deb
Screenshots with Android under linux
adb shell screencap -p | grep -v WARNING | perl -pe 's/\x0D\x0A/\x0A/g' > screenshot.png
MTP with a chromebook
Yes it work with the native chromebook filebrowser and you can enable write suppport with this trick: chrome://flags/#enable-mtp-write-support
screen needs some cleaning at startup
Users are getting permission denied when invoking screen: to get around this add in /etc/rc.local
vi /etc/rc.local
/etc/init.d/screen-cleanup start
Useful commands
sudo enter-chroot
xiwi -T terminator &
xiwi -T xpdf &
cat gox.sh
#!/bin/sh
sudo /usr/local/bin/startxfce4 -X xiwi > /dev/null 2>&1 &
#EOF
cat croutonupd.sh
sudo sh ~/Downloads/crouton -u -n jessie -t xiwi,xfce
#EOF
sudo unmount-chroot -f -a
Some interesting reading
Run i386 binaries on armhf architecture
If you need to run some i386 binaries because of the Intel supremacy and people not understanding that Linux is not only x86 you can use qemu (e.g. for k2pdfopt):
dpkg --add-architecture i386
apt install zlib1g:i386
apt install qemu-user-static
qemu-i386-static ./i386_binary_to_run
Debian upgrade process
- Jessie to stretch debian upgrade
cp /etc/apt/sources.list{,.jessie-bak}
sed -i -e 's/ \(stable\|jessie\)/ stretch/ig' /etc/apt/sources.list
apt upate
apt --download-only dist-upgrade
apt dist-upgrade
Then upgrade crouton: sudo sh ~/Downloads/crouton -u -n jessie -t xiwi,xfce
Browse network shares
There are two ways to mount SMB network shares with chrome:
Main issue is that cifs module is lacking in chrome kernel though fuse is indeed present.
To avoid kernel recompilation at each chrome update, I selected the userspace smbnetfs way.
Here are the steps that I followed:
vi /etc/fuse.conf
user_allow_other
- addgroup fuse and let the user access it
addgroup USER fuse
chgrp fuse /dev/fuse
apt install cifs-utils samba smbnetfs smbclient
- configure these files to match your network credentials, workgroup and hosts:
mkdir $HOME/.smb
cd .smb
cp /etc/smbnetfs.conf .
touch smbnetfs.host smbnetfs.auth
chmod go-rwx *
mkdir $HOME/Network
smbnetfs $HOME/Network
fusermount -u $HOME/Network
Explorations WIP not to be used:
ldd /usr/bin/smbnetfs | sed "s:^.*/usr/lib/arm-linux-gnueabihf/\([^ ]*\).*$:ln -s /usr/local/chroots/jessie/usr/lib/arm-linux-gnueabihf/\1 .:g" | grep ^ln > $HOME/Downloads/todo
mkdir /usr/local/lib
cd /usr/local/lib
sh /home/chronos/user/Downloads/todosh /home/chronos/user/Downloads/todo
sh /home/chronos/user/Downloads/todo
MTP under linux
Follow: hhttps://www.debian-fr.org/t/tuto-montage-auto-dun-appareil-mtp/56505
apt install libmtp-dev git golang go-mtpfs
#mkdir /tmp/go
#export GOPATH=/tmp/go
#go get github.com/hanwen/go-mtpfs
#mv /tmp/go/bin/go-mtpfs /usr/local/sbin/go-mtpfs
#chmod a+x /usr/local/sbin/go-mtpfs
Automatic mount and unmount via udev new rules and matching ID_MODEL and ID_MODEL_ID and MODEL_ID_ENC running udevadm monitor --environment --udev
apt install usbutils
lsusb
udevadm monitor --environment --udev
mkdir /media/motog4
chmod a+rwx /media/motog4
vi /etc/udev/rules.d/99-android.rules
# Google MotoG4 MTP mode : automatic mount when plugged (all android versions)
ENV{ID_MODEL}=="Moto_G__4_", ENV{ID_MODEL_ID}=="4e41", ACTION=="add", RUN+="/usr/bin/sudo -b -u marc /usr/local/sbin/go-mtpfs -allow-other=true /media/motog4"
ENV{ID_MODEL}=="Moto_G__4_", ENV{ID_MODEL_ID}=="2e76", ACTION=="add", RUN+="/usr/bin/sudo -b -u marc /usr/local/sbin/go-mtpfs -allow-other=true /media/motog4"
# Google MotoG4 MTP mode : automatic unmount when unplugged (all android versions)
ENV{ID_MODEL}=="Moto_G__4_", ENV{ID_MODEL_ID}=="2e76", ACTION=="remove", RUN+="/bin/umount /media/motog4"
#EOF
service udev restart
vi /etc/fstab
# use MODEL_ID_ENC
DeviceFs(Moto\x20G\x20\x284\x29) /media/motog4 fuse.DeviceFs(Moto\x20G\x20\x284\x29) allow_other,rw,users,noauto 0 0
#EOF
Recompile own kernel or specific kernel modules
git clone --depth 1 -b release-R56-9000.B-chromeos-3.14 https://chromium.googlesource.com/chromiumos/third_party/kernel
Practical example: binfmt_misc kernel module recompilation
First you must allow module loading following https://github.com/divx118/crouton-packages/blob/master/README.md i.e. under crosh shell do:
cd ~/Downloads
wget https://raw.githubusercontent.com/divx118/crouton-packages/master/change-kernel-flags
sudo sh ~/Downloads/change-kernel-flags
sudo reboot
NOTE that the example below is deprecated since now by default chromeos kernel has BINFMT_MISC=yes in the config file.
In order to build your own module detailed instructions are provided here https://github.com/dnschneid/crouton/wiki/Build-chrome-os-kernel-and-kernel-modules which translates when applying to the c201 chromebook device in:
sudo apt-get install git-core make kernel-package
git clone https://chromium.googlesource.com/chromiumos/third_party/kernel --depth 1 -b release-R56-9000.B-chromeos-3.14
cd kernel
vi chromeos/config/base.config
BINFMT_MISC=m
./chromeos/scripts/prepareconfig chromiumos-rockchip
ln -s include/linux/compiler-gcc5.h include/linux/compiler-gcc6.h
make fs/binfmt_misc.ko
x86 wine support on arm chromebook
Idea is to go chromos/armv7 -> crouton debian chroot/armv7 -> qemu-i386 -> wine32 i386 -> office.
The qemu way
First you need to have binfmt_misc kernel module (cf. previous section) then:
#insmod fs/binfmt_misc.ko
#mkdir -p /var/binfmt_misc
#mount -t binfmt_misc none /var/binfmt_misc
/etc/init.d/binfmt-support start
echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:' > /var/binfmt_misc/registe
r
echo ':DOSWin:M::MZ::/usr/local/bin/wine:' >/var/binfmt_misc/register
mv /usr/lib/i386-linux-gnu/wine/bin/wine-preloader /usr/lib/i386-linux-gnu/wine/bin/wine-preloader.renamed
apt install qemu-user
Now you can try wine on a x86 windows binary such has 7zip:
The exagear non free software way
In order to get better performance on armv7 machines and get a working solution, it is advised to use the non free exagear desktop software, some interesting configuration notes are found there http://forum.eltechs.com/viewtopic.php?t=58&p=109
I managed to have office 2007 working using exagear shell through the following steps:
insmod fs/binfmt_misc.ko
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
service start exagear
- as a user launch
exagear
desktop (uname -a
will tell you that you are i686 arch):
exagear
sudo apt install wine32
- then install office 2007
- after this in order not to crash office applications launch winecfg and go in Applications -> Wine -> Configure Wine -> Libraries, search for riched20 then click add and then modify it to choose "native Windows"
You can also add missing windows tools using winetricks following http://nithinaneeshsct06bt.blogspot.fr/2013/02/install-microsoft-office-2010-in-ubuntu.html or http://doc.ubuntu-fr.org/microsoft_office
sudo apt install cabextract
winetricks vcrun2008 dotnet20 dotnet40 msxml6 riched20 riched30 gdiplus
winetricks vb2run vb3run vb4run vb5run vb6run ie8 corefonts
Note that exagear is a bit overkill because it installs another i386 chroot inside the crouton arm chroot, there might be a way to use the original debian arm chroot with the i386 architecture added. It would result in a tremendous saving in disk space which matters on chromebooks. Question has been asked to exagear developper and the answer is negative :-(.
Printing
Only way I found is to install a cups server (http://localhost:631 to configure) and export as pdf and the print the resulting page through crouton with lp -o position=top,fit-to-page,scaling=100,media=a4 file.pdf
sudo apt install cups system-config-printer cups-client printer-driver-hpijs hpijs-ppds hplip printer-driver-pxljr printer-driver-hpcups
You need to add to one user lpadmin priviledges:
addgroup USER lpadmin
For a Konica Minolta bizhub 227, I used AppSocket socket://192.168.0.31:9100 and KO958FX.ppd from Konica web site.
For a HP Officejet Pro 8600 Plus, I used AppSocket socket://192.168.0.151:9100 and for the driver the the cups HP Officejet Pro 8600, hpcups 3.16.
Note that in order to use the localhost cups server from chromeos side I use the following chrome extension: IPP / CUPS printing from Chrome and Chromebook.
For HP printer there is a chrome extension that can be used too: HP print for Chrome.
xorg tweaks and experimentations
In order to get an accelerated xorg running you need either to recompile your armsoc video driver or use xorg XMETHOD with freon configuration but the safest remains to use xiwi XMETHOD.
video driver: the armsoc way
Since debian does not have xf86-video-armsoc driver package you need to recompile it through these steps on rockchip using this driver repository: https://github.com/mmind/xf86-video-armsoc/commits/devel/rockchip.
EGL can be extracted using either https://github.com/mmind/mali-driver or latest version found there: http://gsdview.appspot.com/chromeos-localmirror/distfiles/
apt install libudev-dev xserver-xorg-dev xutils-dev autoconf automake autogen libtool-bin m4
git clone https://github.com/mmind/xf86-video-armsoc -b devel/rockchip
./autogen.sh --prefix=/usr --with-drmmode=rockchip
make && make install
mkdir -p /etc/X11/xorg.conf.d
vi /etc/X11/xorg.conf.d/20-armsoc.conf
Section "Device"
Identifier "Mali FBDEV"
Driver "armsoc"
Option "fbdev" "/dev/fb0"
Option "Fimg2DExa" "false"
Option "DRI2" "true"
Option "DRI2_PAGE_FLIP" "false"
Option "DRI2_WAIT_VSYNC" "true"
Option "SWcursorLCD" "false"
EndSection
Section "Screen"
Identifier "DefaultScreen"
Device "Mali FBDEV"
DefaultDepth 24
EndSection
#EOF
wget
http://gsdview.appspot.com/chromeos-localmirror/distfiles/mali-drivers-veyron-x11-1.20-r26.run
sh
mali-drivers-veyron-x11-1.20-r26.run
cd /usr/lib
# check that there is no MESA software libs in the way...
cp libEGL.so* libGLESv*so* libmali.so* /usr/lib/arm-linux-gnueabihf/
#read https://github.com/dnschneid/crouton/issues/1938
sudo rm -f /dev/dri/card0
sudo mv /dev/dri/card{1,0}
XMETHOD=xorg startxfce4
# check performance
apt install mesa-utils-extra
es2_info
EGL_VERSION = 1.4 Midgard-"r5p0-14wk51"
EGL_VENDOR = ARM
es2gears
327.000 FPS
Flip xorg discussions At this point there is a remaining issue that xorg complains about "unable to load driver: rockchip_dri.so".
You can go back and forth from xorg to chrome through <CTRL>+<ALT>+<SHIFT>+<->> and for avoiding the white screen you can still get to the console with <CTRL>+<ALT>++<<-> from chromeos.
video driver: the freon way
Following flip xorg crouton discussions
https://github.com/dnschneid/crouton/issues/2426 it seems that modesetting driver should be used instead of fbdev and there is already some arm acceleration in freon, to enable it using xorg XMETHOD just use the following xorg.conf:
vi /etc/X11/xorg.conf.d/20-armsoc.conf
Section "Device"
Identifier "Mali"
Driver "modesetting"
Option "ShadowFB" "false"
EndSection
Section "Screen"
Identifier "DefaultScreen"
Device "Mali"
DefaultDepth 24
EndSection
Section "DRI"
Mode 0666
EndSection
Section "Module"
Disable "glamoregl"
Disable "fbdev"
EndSection
input driver: the synaptics way
In order to activate natural scrolling you need to go through the following steps:
apt install
xserver-xorg-input-synaptics
cp /usr/share/X11/xorg.conf.d/70-synaptics.conf /etc/X11/xorg.conf.d/
vi /etc/X11/xorg.conf.d/70-synaptics.conf
# natural scrolling
Option "VertScrollDelta" "-111"
Option "HorizScrollDelta" "-111"
In order to tune the various driver options do it through xinput:
Input driver: the cmt way
cmt was the xorg chromeos driver that can be recompiled:
git clone https://github.com/hugegreenbug/libevdevc
cd libevdevc
make &&
make install
cd ..
apt install libjsoncpp-dev
git clone https://github.com/hugegreenbug/libgestures
cd libgestures
vi include/gestures/include/finger_metrics.h
#include <cmath>
make && make install
cd ..
git clone https://github.com/hugegreenbug/xf86-input-cmt
cd xf86-input-cmt
chmod a+rx autogen.sh
./autogen.sh --prefix=/usr
make && make install
cd xorg-conf
cp 20-mouse.conf 40-touchpad-cmt.conf 60-touchpad-cmt-veyron_speedy.conf /usr/share/X11/xorg.conf.d/
cp 20-mouse.conf 40-touchpad-cmt.conf 60-touchpad-cmt-veyron_speedy.conf /usr/share/X11/xorg.conf.d/
cp 20-mouse.conf 40-touchpad-cmt.conf 60-touchpad-cmt-veyron_speedy.conf /etc/X11/xorg.conf.d/
The you need to blacklist synaptics driver in Module section
vi
/etc/X11/xorg.conf.d/20-armsoc.conf
Disable "synaptics"
Tuning of the driver various options can be achieved through xinput --list-props 7
Conclusion
I would stick with xorg XMETHOD with modesetting driver since it does have less strange susped/resume issues and chromeos<->xorg switch glitches and cmt driver for the Elan touchpad driver.
But I have issues after switching back from suspend to have xorg not freezing.
I thus now use xiwi because it simply works...
Accelerated video decoding
Disclaimer: please note that this section is still WIP and nothing works so far...
The best result I have so far to play videos is through xorg XMETHOD with modesetting driver and mplayer using x11 video output (not hardware accelerated) that is good enough for H264 1080p lite decoding.
vlc under chromeos is unstable.
I am eagerly waiting for Google Play support on the deivces to switch to Archos Video Player...
Rockchip linux source code
There is some code released by Rockchip here https://github.com/rockchip-linux
git clone https://github.com/rockchip-linux/libvdpau-rockchip
apt install libegl1-mesda-dev libgles2-mesa-dev libdrm-dev
sed -i -e "s:drm/drm_fourcc.h:drm_fourcc.h:g" presentation_queue.c
make
# FAILS -> missing librkdec-h264d and google does not know about it...
export VDPAU_DRIVER=rockchip
mpv --vo=vdpau --hwdec=vdpau --hwdec-codecs=all [filename]
It seems that there is another way to get hw acceleration through libhybris on top of archlinux using this with illustration of the method working.
mpv experimentations
This does crash:
mpv -fs -vo opengl:backend=x11egl:es=yes
gpg
In order to avoid the gtk or ncurses pintentry dialog you can do:
apt install pinentry-tty
vi .gnupg/gpg-agent.conf
#echo RELOADAGENT | gpg-connect-agent
pinentry-program /usr/bin/pinentry-tty
#EO
F
Misc issues
Xiwi not launching because of undefined symbol
I ran into the issue of xiwi not launching because of undefined symbol in xorg dummy_drv.so (ChangeWindowProperty). It was fixed in mergeboat branch and instead of waiting I just did:
sudo CROUTON_BRANCH=mergeboat sh $HOME/Downloads/crouton -u ...
but it did not help.
In order to solve the issue I had to download xf86-server-dummy source from debian stretch, apply the diff and then extract from crouton targets/xiwi script in mergeboat branch the patch and rebuild manually after applying the deb package.
Loss of sdcard after suspend
The utmost annoying problem with chromebooks and crouton is that there is no real solution for already more than 3 years to the problem of loss of sdcard/usb stick after suspend preventing running crouton from external storage. This is really a shame because of the limited storage size of the current chromebooks and lack of ssd upgrade on recent models.
In order to learn more about this problem you can refer to these long threads:
Please do star these issues so that they get proper notice and support.
Note that none of the previous fixes work now:
The problem happens on Toshiba Chromebook 2, Acer Chromebook R11, Asus C201 impacting ARM and Intel platforms.
I have been loosing countless time on this issue and I am very surprised that none of the Googlers that must be using croutong are not doing something about it.
And yes I know that the real answer is; you are welcome to submit a patch.
diff --git a/chromeos/disks/suspend_unmount_manager.cc b/chromeos/disks/suspend_unmount_manager.cc
index 795ac9d..2db0e77 100644
--- a/chromeos/disks/suspend_unmount_manager.cc
+++ b/chromeos/disks/suspend_unmount_manager.cc
@@ -36,8 +36,7 @@ void SuspendUnmountManager::SuspendImminent() {
return;
std::set<std::string> mount_paths;
for (const auto& pair : disk_mount_manager_->disks()) {
- if ((pair.second->device_type() == DEVICE_TYPE_USB ||
- pair.second->device_type() == DEVICE_TYPE_SD) &&
+ if ((pair.second->device_type() == DEVICE_TYPE_USB) &&
!pair.second->mount_path().empty()) {
mount_paths.insert(pair.second->mount_path());
}
For x86 architecture it will work on devices that are using a non USB based mmc sdcard reader (e.g. Acer R11) and will not with USB based mmc sdcard readers (e.g. Toshiba chromebook 2).
I believe that this suspend_umount_manager.cc should not be a generic code but more architecture or device dependent since many SoC having a direct mmc interface (e.g. ARM) can manage suspend by their own without force unmount.
Note to self: if a chromebook is to be bought check i) to have eMMC solution not soldered on the board (all new chromebooks do not fulfill this requirement unfortunately) to upgrade the internal storage capacity and, ii) if an intel is to be chosen make sure that the mmc controller is not on usb.
Get google play on your C201 (and others) before it is released
Yes this is possible (if there is a mention of ARC in chromeos settings/about version), you just need to fiddle with the chrome dev options and enable ARC:
sudo -i
cp /etc/chrome_dev.conf /usr/local
echo "–enable-arc" >> /usr/local/chrome_dev.conf
mount -o bind /usr/local/chrome_dev.conf /etc/chrome_dev.conf
Disconnect and reconnect and voilà!
Android studio running on ARM chromebook
Note that this section is still WIP. The current status is:
- android-studio can be launched and it is possible to build apps with SDK23 and SDK25
- native code i.e. android-ndk works sometimes (I get compiler internal error building libav)
Approach is to use a "Frankenstein" hybrid setup faking x86_64 architecture using qemu-x86_64 at the rescue but using ARM based Oracle JDK.
Note that exagear cannot be used since it only supports 32bits and Android SDK is only x86_64 (64bits) (but exagear is working on 64b support but this will be anticipated to be much slower than what is proposed here since what is proposed it to used an hybrid ARM/x86_64-qemued).
Compilation of "simple" java only apps (Android studio and gradle)
You thus need to rely on qemu-x86_64 and properly register x86_64 magic to binfmt for seamless detection and execution:
apt-install qemu-user binfmt-support
echo ':x86_64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-x86_64:P' > /proc/sys/fs/binfmt_misc/register
dpkg --add-architecture x86_64
apt install libc6:amd64
sudo apt install lib32stdc++6
sudo apt install libz1:amd64 libncurses5:amd64 zlib1g:amd64 libstdc++6:amd64
/etc/init.d/binfmt-support start
cd /usr/local/bin/
wget https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh
chmod a+rx qemu-binfmt-conf.sh /usr/local/bin/qemu-binfmt-conf.sh
After this just download and run android studio for linux x86_64 architecture.
Note that android-studio/jre/bin/java
fails to execute. In order to solve this issue and boost things up download Oracle ARM jdk, install it in /opt/jdk
and point android-studio/jre
to this directory /opt/jdk
:
/opt/android-studio/jre/bin/java.
Install android-sdk tools command line version:
mkdir /opt/android-sdk
cd /opt/android-sdk
unzip sdk-tools-linux-3859397.zip
cd tools/bin
touch ~/.android/repositories.cfg
./sdkmanager "build-tools;28.0.3"
./sdkmanager "ndk-bundle"
./sdkmanager "platforms;android-28"
./sdkmanager "platforms;android-27"
To make it work you really need to fix aapt (the best is for optimizations).
cd /opt/android-studio
mv jre jre-old
ln -s /opt/jdk /opt/android-studio/jre
cd /opt/android-sdk/build-tools/25.0.2
mv aapt aapt_
sudo apt install aapt
ln -s /usr/bin/aapt
for p in apksigner aidl dexdump zipalign split-select dx
do
sudo apt install $p
mv $p ${p}_
ln -s /usr/bin/$p
done
sudo apt install android-sdk-build-tools-common
sudo apt install dalvik-exchange
You need also to add a couple of i386 and x86_64 libraries to do some builds:
dpkg --add-architecture i386
sudo apt install libz1:i386 libncurses5:i386 zlib1g:i386 libstdc++6:i386 lib32z1 libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5
Can we go one step further and enable NDK support?
What follows is the WIP to support android-ndk which works sometimes. If you do not need it you can stop there.
Modify android NDK to force armv7l detected as x86_64 to use binfmt and qemu:
diff --git a/build/core/init.mk b/build/core/init.mk
index 56e5f300..328a81b6 100644
--- a/build/core/init.mk
+++ b/build/core/init.mk
@@ -242,6 +242,9 @@ ifndef HOST_ARCH
ifneq (,$(findstring Power,$(UNAME)))
HOST_ARCH := ppc
endif
+ ifneq (,$(findstring arm,$(UNAME)))
+ HOST_ARCH := x86_64
+ endif
ifeq ($(HOST_ARCH),)
$(call __ndk_info,Unsupported host architecture: $(UNAME))
$(call __ndk_error,Aborting)
@@ -363,7 +366,7 @@ $(call ndk_log,Host 'cmp' tool: $(HOST_CMP))
#
HOST_AWK := $(strip $(HOST_AWK))
ifndef HOST_AWK
- HOST_AWK := awk
+ HOST_AWK := gawk
endif
$(call ndk_log,Host 'awk' tool: $(HOST_AWK))
diff --git a/ndk-build b/ndk-build
index 62d6dc8c..dc353037 100755
--- a/ndk-build
+++ b/ndk-build
@@ -143,7 +143,7 @@ log "HOST_OS=$HOST_OS"
HOST_ARCH=$(uname -m)
case $HOST_ARCH in
i?86) HOST_ARCH=x86;;
- x86_64|amd64) HOST_ARCH=x86_64;;
+ x86_64|amd64|armv7l) HOST_ARCH=x86_64;;
*) echo "ERROR: Unknown host CPU architecture: $HOST_ARCH"
exit 1
esac
Some platform tools are complaining to be obsolete: instead of using x86_64 ones link them back to native ARM one with a boost in performance benefit:
cd android-ndk/prebuilt/linux-x86_64
for f in awk perl python2.7 yasm
do
mv $f "$f"_
ln -s /usr/bin/$f
done
mv sed sed_
ln -s /bin/sed
For some reasons a lot of x86_64 from NDK when run are not properly recognized by binfmt and qemu-x86_64 has to be forced.For this purpose I use following fixqemu.sh script
#!/bin/sh
p=`dirname $1`
f=`basename $1`
if [ -f qemu-"$f" ]
then
exit
fi
mv "$f" qemu-"$f"
cat > "$1" <<EOF
#!/bin/sh
p=\`dirname \$0\`
f=\`basename \$0\`
exec qemu-x86_64 "\$p"/qemu-"\$f" "\$@"
EOF
chmod a+rx "$1"
This needs to be applied to all the files identified by find . -type f -exec file {} \; | grep executable | grep ELF | grep -v qemu
I applied this to several binaries in the android NDK:
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/libexec/gcc/arm-linux-androideabi/4.9/
for f in cc1 cc1plus collect2 lto-wrapper lto1
do
fixqemu.sh $f
done
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin
find . -type f -exec /home/marc/fixqemu.sh {} \;
ln -s qemu-arm-linux-androideabi-gcc qemu-arm-linux-androideabi-gcc-4.9
ln -s qemu-arm-linux-androideabi-ld.gold qemu-arm-linux-androideabi-ld
ln -s qemu-arm-linux-androideabi-g++ qemu-arm-linux-androideabi-c++
ln -s ../../../../../toolchains/llvm-3.5/prebuilt/linux-x86_64/bin/qemu-ld.mcld qemu-arm-linux-androideabi-ld.mcld
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/
for f in *; do ln -s ../../bin/qemu-arm-linux-androideabi-$f qemu-$f ; done
rm qemu-ld
ln -s ../../bin/qemu-arm-linux-androideabi-ld.gold qemu-ld
rm qemu-ld.mcld
ln -s ../../../../../../toolchains/llvm-3.5/prebuilt/linux-x86_64/bin/ld.mcld qemu-ld.mcld
ln -s ../../../../../../toolchains/llvm-3.5/prebuilt/linux-x86_64/bin/qemu-ld.mcld qemu-ld.mcld
cd android-ndk/toolchains/llvm-3.5/prebuilt/linux-x86_64/bin
for f in clang ld.mcld llc llvm-ar llvm-as llvm-dis llvm-link ndk-bc2native ndk-link ndk-strip ndk-translate opt ; do $HOME/fixqemu.sh $f; done
ln -s qemu-clang qemu-clang++
or f in ndk-link ndk-strip ndk-translate; do ln -s qemu-$f qemu-le32-none-$f; ln -s qemu-$f qemu-le64-none-$f; done
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/libexec/gcc/arm-linux-androideabi/4.9/plugin
fixqemu.sh gengtype
Is there any binary that I missed that is not a shell script:
find -type f -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary' | grep -v qemu
Check that all links have been processed:
find . -type l -exec ls -l {} \;
Go full native instead?
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/libexec/gcc/arm-linux-androideabi/4.9
for f in cc1 cc1plus collect2 lto-wrapper lto1; do mv $f $f.orig ; ln -s /usr/lib/gcc/arm-linux-gnueabihf/6/$f; done
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin
for f in addr2line ar as c++filt cpp dwp elfedit g++ gcc ar nm ranlib gcc-ar gcc-ar gcc-nm gcc-ranlib gcov gcov-tool gdb gprof ld ld.bfd ld.gold nm objcopy objdump ranlib readelf size strings strip; do mv arm-linux-androideabi-$f arm-linux-androideabi-${f}.orig; ln -s /usr/bin/$f arm-linux-androideabi-$f; done
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin
for f in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip; do mv $f ${f}.orig; ln -s /usr/bin/$f ; done
sudo apt install llvm
Well for not it does not work.
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc
ln -s arm-linux-androideabi arm-linux-gnueabihf
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
ln -s arm-linux-androideabi arm-linux-gnueabihf
cd android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/libexec/gcc
ln -s arm-linux-androideabi arm-linux-gnueabihf
Check what is called with strace and do all symlinks...
Tedious work... and does not work.
mdns
In order to get multicast zeroconf service such as mdns you need to:
apt install avahi-daemon avahi-utils libnss-mdns
/etc/avahi/avahi-daemon.conf
hostname=mark32
disable-publishing=yes
Access local Android via adb on chromebook
In crosh domain:
# to be done once for all
sudo crossystem dev_boot_signed_only=0
sudo /usr/libexec/debugd/helpers/dev_features_rootfs_verification
sudo reboot
sudo /usr/libexec/debugd/helpers/dev_features_ssh
Go in chromebook settings->search for android->GooglePlay settings->android preferences->about->click 5 times on build to be a developer and then switch on adb under developer settings.
Connect to Android under chroot via (not using localhost:22 as advised https://developer.android.com/topic/arc/studio):
adb connect 100.115.92.2:5555
Afterwards you can install any application via adb that you have locally compiled and run it without an emulator: sweet!
If you experience issues and you cannot see any devices after connecting with adb devices try through Android settings to revoke all adb authentication tokens and cycle off/on adb.
END