Odroid XU-4 Hardware Configuration
Most of the hardware for the Odroid XU-4 is configured out of the box by Ubuntu, including the network adapter and storage devices. Some of the Cloudshell specifics do still need to be taken care of and we'll do that here.
In our ansible-playbook.yml file, add another include line just below the watch this space marker comment and have it include a file called odroid-xu4-cloudshell.yml. Then create that file with the following Ansible playbook content:
- name: Configure Odroid Cloudshell Kernel Modules template: src: ./templates/xu4-cloudshell/modules.j2 dest: /etc/modules owner: root group: root mode: 0644 - name: Configure Odroid CloudShell Kernel Module options template: src: ./templates/xu4-cloudshell/odroid-cloudshell.conf.j2 dest: /etc/modprobe.d/odroid-cloudshell.conf owner: root group: root mode: 0644 - name: Configure Odroid Cloudshell LCD Xorg Server template: src: ./templates/xu4-cloudshell/xorg.conf.j2 dest: /etc/X11/xorg.conf owner: root group: root mode: 0644
This contains three very similar playbook excerpts that take a local template file (more on those shortly) and performs some magic translation on them and writes specific configuration files with specific ownership/permissions as output on the destination XU-4. In the case of all of these template files, there is nothing to be translated -- they're literal copies of what will end up on the devices. The template module leaves the door open for us to easily do some clever things at a later point.
We'll place this template file in a suitable subdirectory and call it modules.j2, making sure that the path matches what's defined in the playbook. This template will contain a couple of lines to indicate kernel modules that should be loaded at boot time and it should look like this:
# Cloudshell LCD modules spi-s3c64xx fbtft_device # IR GPIO modules gpio-ir-recv gpioplug-ir-recv
Some of these kernel modules have some specific options we need to specify to get the most out of the hardware in the XU-4 Cloudshell configuration. The second playbook entry calls for a template file to do just that. We'll call ours odroid-cloudshell.conf.j2 and have it written as /etc/modprobe.d/odroid-cloudshell.conf on the devices. The content should look like this:
# Configure LCD display options fbtft_device name=hktft9340 busnum=1 rotate=270 speed=40000000 # Configure IR GPIO options gpioplug_ir_recv gpio_nr=24 active_low=1 # Avoid drivers for devices not present blacklist ina231_sensor
The final task in our playbook is to write an Xorg configuration file to point the X server at the LCD device instead of the HDMI interface. It's possible to configure dual-headed displays with both HDMI and the LCD display, but we never use the HDMI interface for the Cloudshell XU-4s.
Again, making sure that the paths match, we'll create the following content in our xorg.conf.j2 template example:
Section "Device" Identifier "ODROID" Driver "fbdev" Option "fbdev" "/dev/fb0" Option "Debug" "false" Option "DPMS" "false" EndSection Section "Screen" Identifier "Default Screen" Device "ODROID" EndSection Section "ServerLayout" Identifier "Default Layout" Option "BlankTime" "0" Option "StandbyTime" "0" Option "SuspendTime" "0" Option "OffTime" "0" EndSection Section "DRI" Mode 0666 EndSection