You are viewing an old version of this page. Return to the latest version.
No categories assigned
Operating System installation
-
- Last edited 3 years ago by Bernhard Naegele
-
> Main Page > Piano Expander based on Pianoteq and Odroid-N2
Contents
- 1 Installation of the base-system
- 2 Rotating the Touch-Display
- 3 Enabling the On-Screen-Keyboard
- 4 Adding support for ARM 32-bit code execution
- 5 Enabling 31250 UART-Baud-Rate for Midi-Usage
- 6 Changing FDT (Flattened Device Tree) to support second UART-Interface for MIDI
- 7 Adding ADC (Audio-Input) to Odroid N2
Installation of the base-system
- The installation of the operating system is pretty easy when you are using the Linux distributions which are supported by "Hardkernel".
- The OS which I have used for doing my first experiences is UBUNTU MATE 18.04.4-4.9-mate-odroid-n2-20200224
- The new Operating-System which I have used is the ubuntu-20.04-4.9-mate-odroid-n2-20220228.img.xz . Download the Image from here
- A guideline for installing the Image (Hardkernel) can be found here
Enable Auto-Login
Rotating the Touch-Display
Articles regarding Display and Touch Rotation
- AskUbuntu: How to identify touchpad for xorg.conf modification?
- Odroid-Forum: C2 Ubuntu + VU7 rotated - touch calibration
- Odroid-Forum: Rotate Touch display 90 degree
- AskUbuntu: Rotate Touch Input with touchscreen and/or touchpad
- Odroid-Wiki:Tips for boot logo on ODROID-C4/N2
- GitHub: Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops., provides information about rotation options (ccw/cw/half/none)
Screen rotation
- Odroid-Forum: How to do N2 HDMI screen rotation - is working for the display, but the touch is still in original orientation
Touch rotation
Depending on how you want to rotate the display, you must enter the following values : 90°-Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1" 180°-Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1" 270°-Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"
Enabling the On-Screen-Keyboard
- In applications, where you don't want to use an external keyboard you have the possibility to use an "On-Screen-Keyboard" which could be controlled via the Touch-Screen.
Switch-On the On-Screen-Keyboard on Ubuntu-Mate
- On Ubuntu-Mate the On-Screen-Keyboard is already installed. You can find it in the ‘Universal Access’ menu. In this menu you find the application "Onboard" -> a click on this menu-point activates the On-Screen-Keyboard.
Adding support for ARM 32-bit code execution
- Pianoteq 6 for ARM architecture is unfortunatly only available as 32-bit code - by meaning we have to install first the 32-bit support on the Ubuntu-Mate distribution supplied by "Hardkernel".
- Here is an article about how much the 64-bit CPUs would benefit from the additional AARCH64 instructions: 64-bit ARM (Aarch64) Instructions Boost Performance by 15 to 30% Compared to 32-bit ARM (Aarch32) Instructions.
- Odroid-Forum article: 32 Bit executables in AARCH64 system
odroid64:$ sudo dpkg --add-architecture armhf odroid64:$ sudo apt-get update apt install libc6:armhf apt install libx11-6:armhf apt install libfreetype6:armhf apt install libxext6:armhf apt install libasound2:armhf
Enabling 31250 UART-Baud-Rate for Midi-Usage
- The baud-rate 31250 which is used for MIDI-traffic is normally NOT supported on standard UART drivers.
- We have to tweek the UART-Kernel-driver for supporting this baud rate. This sounds like a complicated action, but it isn't really complicated - take a look on this article in the Odroid-Magazine -> ODROID-N2 UART Custom Baud Rate for MIDI
Cross-Compiling or compiling the Kernel natively (on the Odroid-N2 itself)
- You have the possibility to compile the Kernel external (e.g. on your Desktop-PC/Laptop) where you have to install the Cross-Compiler-Toolchain and the other build utilities) or directly on the Odroid itself.
- I am a fan of doing it directly on the Odroid-N2 itself. Therefore I describe this procedure first.
compiling the Kernel natively on the Odroid-N2
getting the Kernel-Sources
- changing the user to be "root"
$ sudo su --> enter your root password
Attention: Be careful - the root-user can do really everything on the system - also damaging the running OS
- going to the directory where you want to build the kernel
$ cd /usr/src/
- install the source code version control system software "git":
$ apt install git
- going into the kernel-root-path
$ cd /usr/src/linux/
- getting the kernel-sources (cloning) from github:
$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidg12-4.9.y
configuring the kernel
- configuring the base configuration of the kernel
$ make odroidg12_defconfig
- edit the uart-driver with an editor of your choice - for me it's the editor "vi" -> $ vi /usr/src/linux/drivers/amlogic/uart/meson_uart.c
- alter there the function meson_uart_change_speed to the following:
static void meson_uart_change_speed(struct uart_port *port, unsigned long baud) { u32 val; struct meson_uart_port *mup = to_meson_port(port); struct platform_device *pdev = to_platform_device(port->dev); while (!(readl(port->membase + AML_UART_STATUS) & AML_UART_TX_EMPTY)) cpu_relax(); #ifdef UART_TEST_DEBUG if (port->line != 0) baud = 115200; #endif // this part is added. // trace_printk() is not neccesarry, it is just for debugging. trace_printk("Your baudrate: %ld\n", baud); if(baud == 38400) { baud = 31250; trace_printk("Change to %ld\n", baud); }
- save your file!
additional kernel-config
- if you want to add other stuff to the kernel config you can do this by using the command "make menuconfig"
- if "make menuconfig" could not be startet because auf missing curses-support you have to install the libncurses-dev package
$ apt install libncurses-dev $ make menuconfig
compiling the kernel
$ make -j7
install kernel-modules
$ make modules_install
install new kernel and the new flattened device tree
$ cp -f arch/arm64/boot/Image.gz arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtb /media/boot/ $ sync $ reboot
Changing FDT (Flattened Device Tree) to support second UART-Interface for MIDI
- Article on the Odroid-Wiki: UART Interface on the 40 Pin Header
Installation of the device tree compiler (dtc)
$ apt install device-tree-compiler
check if second UART is allready enabled
fdtget /media/boot/meson64_odroidn2.dtb /serial@ffd24000 status # returns disabled
- "disabled" means that the second native uart is disabled
enabling the second UART
$ fdtput -t s /media/boot/meson64_odroidn2.dtb /serial@ffd24000 status "okay" $ fdtget /media/boot/meson64_odroidn2.dtb /serial@ffd24000 status # returns okay reboot
- After the reboot you can list the available UARTs by typing the following command
ls -al /dev/ttyS? # returns crw--w---- 1 root tty 238, 0 May 28 18:36 /dev/ttyS0 crw-rw---- 1 root dialout 238, 1 Jan 29 2018 /dev/ttyS1
- Two UARTs are available - /dev/ttyS0 for console usage and /dev/ttyS1 which we will use for MIDI
make a MIDI device out of the ttyS1 by using ttyMIDI
- launchpad: ttymidi
- github/sexeight7/ttymidi with system exclusive data ->
- for compilation:
gcc ttymidi.c -o ttymidi -lasound -pthread
- Warning when compiling ttymidi out-of-the-box:
ttymidi.c:533:1: warning: return type defaults to ‘int’ [-Wimplicit-int] main(int argc, char** argv)
- you can avoid this "compiler-hint" just by adding an "int" bevor "main"
change line 533 to: int main(int argc, char** argv)
ttyMIDI Aufruf
$ ./ttymidi -s /dev/ttyS1 -b 38400
Adding ADC (Audio-Input) to Odroid N2
> Main Page > Piano Expander based on Pianoteq and Odroid-N2