This series is inspired by the “Maker Session” conducted at the WLAN Pros Conference last year in Budapest. During the Maker Session each one of the attendees was given an ODROID C2 single board computer along with a battery pack and various other accessories including an 8GB eMMC , eMMC reader, WLAN Adapter etc. The session went through the steps of installing a customised image of DietPi that included some very handy WLAN tools included in it. You can see a summary of the hardware, software, tools and the setup process that we followed here.
It was a hell of a lot of fun! AND I went home with some cool toys to play with.
Let’s fast forward 5 or 6 Months.
After spending some time playing with the device since the maker session I have come to realize that I don’t actually understand very much about how all of the magic inside this little beast fits together. My knowledge of the Unix/Linux command line is rudimentary and I don’t really know much about the underlying OS. I understand what the various bits and pieces do but I have no idea how to do this from scratch. I also want to be able to add some of my own tools to the mix and I want to be able to customize things a little. So I thought… well… I mean how hard can it be? Why don’t I build this up from scratch so I understand a little more, and maybe other folks can do this too?
So without further ado, I present part 1 of what I am guessing may be a long learning process littered with errata and edits:
Installing DietPi on your ODROID-C2
This part is actually extremely simple there is a great step by step guide on the DietPi website here.
I am using a Macbook Air running MacOS Sierra (10.12.3) and these are the steps I followed:
- Download the correct version of the DietPi OS
- Extract the Zip File into a Folder -> Inside the Folder is the .img file
- Connect your eMMC / SD Card
- Open Terminal
- Run the command: diskutil list
Host-Name:~ User$ diskutil list /dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *500.3 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 424.4 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3 4: Microsoft Basic Data BOOTCAMP 74.6 GB disk0s4 5: Windows Recovery 471.9 MB disk0s5 /dev/disk1 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *128.3 GB disk1 1: Windows_NTFS 128GBBaseQi 128.3 GB disk1s1 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *7.8 GB disk2 1: DOS_FAT_32 boot 134.2 MB disk2s1 2: Linux 7.7 GB disk2s2
- You can see that in this example, the 8GB eMMC Card is listed as /dev/disk2
- Before you proceed, make sure you have the right drive path… (any screw up here is gonna hurt)
- Run the command: diskutil unmountdisk /dev/disk2 (Make sure you use the correct path for YOUR drive)
Host-Name:~ User$ diskutil unmountdisk /dev/disk2 Unmount of all volumes on disk2 was successful
- Now go to the folder in which the .img file is kept using the cd / command
- Run the command: sudo dd if=DietPi_v145_OdroidC2-arm64-\(Jessie\).img of=/dev/rdisk2
- DON’T FORGET TO CHANGE THE DISK NUMBER!
- DON’T FORGET THE “r” in /dev/rdisk2
- Learn more about the dd command here.
- You can use Ctrl+t to view the progress of the copy process.
Host-Name:DietPi_OdroidC2-arm64-(Jessie) User$ sudo dd if=DietPi_v145_OdroidC2-arm64-\(Jessie\).img of=/dev/rdisk2 Password:
(I press Ctrl+t here…)
load: 2.85 cmd: dd 2687 uninterruptible 0.01u 0.42s 8984+0 records in 8983+0 records out 4599296 bytes transferred in 3.951183 secs (1164030 bytes/sec)
load: 2.70 cmd: dd 2687 uninterruptible 0.03u 0.87s 17842+0 records in 17841+0 records out 9134592 bytes transferred in 7.831405 secs (1166405 bytes/sec)
- Once the process is finished (around 5 Minutes), congratulations, you have installed DietPi onto your eMMC / SD-Card.
- Run the command: diskutil list
Two Useful Files
At this point you should have a SD Card / eMMC card mounted on your laptop with the title of “boot”. If you open up the drive you should see a folder structure similar to the below:
Host Name:/ User$ cd /Volumes Host Name:Volumes User$ ls 128GBBaseQi BOOTCAMP Macintosh HD boot Host Name:Volumes User$ cd boot HostName:boot User$ ls -l total 81558 -rwxrwxrwx 1 User staff 12952112 Feb 25 15:29 Image -rwxrwxrwx 1 User staff 5816 Feb 25 15:29 README.md -rwxrwxrwx 1 User staff 2912668 Feb 25 15:29 System.map-3.14.79+ -rwxrwxrwx 1 User staff 2316 Feb 25 15:29 boot.ini -rwxrwxrwx 1 User staff 111438 Feb 25 15:29 config-3.14.79+ -rwxrwxrwx 1 User staff 2027 Feb 25 15:29 config.txt drwxrwxrwx 1 User staff 3072 Feb 25 15:29 dietpi -rwxrwxrwx 1 User staff 7953 Feb 25 15:39 dietpi.txt -rwxrwxrwx 1 User staff 4258601 Feb 25 15:29 initrd.img-3.14.79+ -rwxrwxrwx 1 User staff 29280 Feb 25 15:29 meson64_odroidc2.dtb -rwxrwxrwx 1 User staff 4258667 Feb 25 15:29 uInitrd -rwxrwxrwx 1 User staff 4258667 Feb 25 15:29 uInitrd-3.14.79+ -rwxrwxrwx 1 User staff 12952112 Feb 25 15:29 vmlinuz-3.14.79+ Host Name:boot User$
There are two VERY useful files in this directory that we are going to discuss very briefly.
If you open this file up, you will see that it contains the settings for the HDMI display and other peripherals like Raspberry Pi Camera Module, the GPU RAM Split, maximum USB Current etc. At this point, you really shouldn’t need to edit this file at all.
This file contains settings that are used on the first boot of the device and can be very useful for the following:
- configuring networking settings & host name
- automated installation for DietPi software
- selection of software packages to provide specific services (SSH, File Server, Logging mode, Web Server)
- Language and Regional Settings
- Custom Scripts to be run after DietPi installation.
The file also contains OS configuration and Software configuration information that we will dig into at some point.
The first time you boot the ODROID with DietPi installed, it will require Internet connectivity to complete the installation and pull data from the repositories at http://ftp.debian.org/debian/. If you do not have a connection to the Internet you will be asked to change your network settings and try again. (So no fear if you get this part wrong! You will have an opportunity to fix it!)
Configuring the network connection settings for the first boot of the ODROID will be done by editing the dietpi.txt file. Right so, lets open that up with a normal text editor.
Ethernet Network Connection with DHCP
These are the default settings that should be in the dietpi.txt file already. Just to confirm, this is what should be in the file (important fields are in bold):
# >> Networking Options ----------------------------- #If both Ethernet and Wifi are enabled, Wifi will take priority and Ethernet will be disabled. # 1=enabled Ethernet_Enabled=1 Wifi_Enabled=0 #Enter your Wifi details below, if applicable (Case Sensitive). Wifi_SSID=FuzonWifi Wifi_KEY=MyAccessKey #Enter your Static Network details below, if applicable. Use_Static=0 Static_IP=192.168.0.100 Static_Mask=255.255.255.0 Static_Gateway=192.168.0.1 Static_DNS=22.214.171.124
You should be able to tell that at this point the settings have Ethernet enabled, Wi-Fi is disabled, and the network is configured to use DHCP.
Ethernet Network Connection with Static Addresses
If you plan on using a static IP address for the Ethernet connection, simply set the Use_Static flag to 1 and enter the necessary information for IP Address, Subnet Mask, Default Gateway and DNS Server.
# >> Networking Options ----------------------------- #If both Ethernet and Wifi are enabled, Wifi will take priority and Ethernet will be disabled. # 1=enabled Ethernet_Enabled=1 Wifi_Enabled=0 #Enter your Wifi details below, if applicable (Case Sensitive). Wifi_SSID=FuzonWifi Wifi_KEY=MyAccessKey #Enter your Static Network details below, if applicable. Use_Static=1 Static_IP=192.168.0.100 Static_Mask=255.255.255.0 Static_Gateway=192.168.0.1 Static_DNS=126.96.36.199
Wireless Network Connection
What if you don’t have easy access to a wired connection?
No problem! You CAN connect via Wi-Fi, however the ODROID-C2 board does not come with a built in Wi-Fi card and you will have to connect a Linux compatible USB Wi-Fi adapter. I strongly recommend using the 802.11n Wi-Fi Module 4 or 802.11ac Wi-Fi Module 5 for this project as they will work with linux operating systems out of the box with no additional effort and they are GREAT adapters. Obviously if you’re going to buy one, don’t mess about, just get the 802.11ac Wi-Fi Module 5.
# >> Networking Options ----------------------------- #If both Ethernet and Wifi are enabled, Wifi will take priority and Ethernet will be disabled. # 1=enabled Ethernet_Enabled=1 Wifi_Enabled=1 #Enter your Wifi details below, if applicable (Case Sensitive). Wifi_SSID=FuzonWifi Wifi_KEY=MyAccessKey #Enter your Static Network details below, if applicable. Use_Static=0 Static_IP=192.168.0.100 Static_Mask=255.255.255.0 Static_Gateway=192.168.0.1 Static_DNS=188.8.131.52
In my testing I have found that the USB Wi-Fi adapter will fail to associate if the network is using any other form of authentication & encryption apart from WPA-Personal / AES. WPA2-Personal with AES does not work. It looks like the scripts that use the dietpi.txt file for initial boot expect the WLAN to use WPA-personal with AES encryption. I have not found any way to configure other authentication and encryption types at this stage. I solved this problem by configuring my home WLAN to publish a second SSID using WPA/AES and the ODROID associated and got an IP on the WLAN with no problem.
If you know how to edit the dietpi.txt configuration file to allow other WLAN authentication / encryption types, please leave it in the comments!
So, to be clear: make sure your network is using WPA-personal with AES encryption and simply replace the Wifi_SSID and Wifi_Key with your network settings and off you go.
READY FOR LAUNCH!
At this point you are pretty much done, your ODROID should be able to get Internet connectivity somehow and you can go ahead and unmount the eMMC / SD Card from your laptop (eject) and go ahead and plug it into your ODROID C2. Don’t forget to plug in the USB WiFi adapter or Ethernet cable before you boot up!
For the next steps to continue the configuration, you will also require a screen with HDMI and a USB keyboard!