Setting Up Android on an Intel NUC
Today I managed to get Android running on an Intel NUC computer. This sounds easier than it was as there were multiple issues that had to be overcome.
Steps
Download Android-x86 ISO
I downloaded Android-x86 from here, and made sure to get the x86_64
ISO file version to have 64 bit support.
Create USB Stick Installer
At first, I used unetbootin to set up a USB stick installer. It's pretty straightforward and will work.
I also later used a special device that emulated a CD drive which also worked, but I had to enable booting from "optical drive" for this to work.
Installing - Black Screen of Death Fix
- Boot up the NUC with the USB stick plugged in.
- Ensure booting from the USB stick is enabled in the BIOS.
- When booting from the USB stick the GRUB menu will default to running in "live mode", which runs okay, but when I wanted to install to the local hard disk, it would always give me a black screen.
- The solution to this was to disable UEFI boot options in the BIOS, so we would always boot from legacy.
Don't Use Auto/Fast Install - Allows Us To Edit Config Files Later
We need to install by using the normal, manual installation method from the GRUB menu, rather than using the automatic/fast installation method.
At some point during this installation method, it will ask us if we wish to install /system
as a read/write partition. It is cricitical that we do this so that we can edit some of the configuration files later.
No Touchscreen Fix
At one point, I thought that the touchscreen wouldn't work. Luckily, solving this is as easy as turning off the computer, unplugging the mouse and keyboard, and booting back up.
Screen Rotation Fix
There is no gyroscope in the NUC, so it will default to the default screen orientation. Unfortunately, we are setting up a portrait unit so everything was 90 degrees off. Using the built-in rotation settings didn't work. Neither did installing and using any of the rotation apps from the play store. We also hunted through the monitor settings to see if we could change it through that, but alas no.
We found a solution was to install the termux app, and use it to run the following commands (you could use the built-in emulator, but we need termux for a specific reason later):
su
setprop config.override_forced_orient true
stop;start
When combined with this screen rotation app, it worked for the next reboot, but we lost internet access for some reason.
Making Rotation Permanent
Make sure the screen rotation app is set to boot up on start, and set it to have a rotated image.
Open up the termux app, and install vim:
pkg install vim
Then make two copies of the /etc/init.sh
configuration file, one should act as a backup and I labelled it as /etc/init.sh.bak
. Use this if stuff goes horribly wrong.
Edit the other copy of the file and find the line that sets has_sensors
to false. It should be at the end of a switch statement. Change it to true
.
Overwrite the /etc/init.sh
file with this modified version, and set its permissions with the following command as the su
user (by having run the su
command earlier):
chmod 744 /etc/init.sh
This makes the file only editable by root, but all other users have the read permission.
Reboot
Now reboot and you have a fully working system with the screen rotated how you want. The screen rotation app can be used to set the orientation you like.
References
First published: 6th June 2019