Complete guide to getting started with the Intellipi

atom2626 edited this page Feb 2, 2016 · 21 revisions

Getting started

Assuming you have the following hardware:

  • RaspberryPi B+/A+
  • Micro-SDcard (4GB is cheap and readily available)
  • Adafruit i2c 16x2 RGB LCP Pi Plate (with display and 5 buttons on plate, optional)

Setup system and packages

Assuming you are using recent Ubuntu-based Linux distribution (natively is preferred over VM if development will be long-term), the following steps in this section prepare the host system for cross-architecture development - in other words, for cross-compiling.

sudo apt-get update -y;sudo apt-get upgrade -y; sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex mercurial automake manpages-posix manpages-posix-dev locate libevent-dev libssl-dev libpcap-dev minicom bluez bluez-tools libbluetooth* libglib2.0-dev;

While this list is complete, I noticed some package don't get installed when launching this command. Be advised that you might have to install some of them one at a time.

The following are OPTIONAL, but help with many tasks related to development.

sudo apt-get install ghex meld geany geany-plugins* gdb valgrind;

Checkout intelliroot

As your system is only "prepared" by means of having pre-requisite software packages installed, the "buildroot" must be downloaded or "checked-out".

git clone https://github.com/AtlantsEmbedded/IntelliPi.git intelli_git
cd intelli_git/intelliroot

The buildroot is downloaded, but the default package and software configurations to be used by the build process need to be specified.

cp ../configs/Dev-fullenv .config

Assuming that the system has Internet connectivity OR the packages are already present (i.e. the buildprocess has already been completed), the "OpenWRT feeds" will need to be updated and installed. This is performed through the following two commands:

./scripts/feeds update -a
./scripts/feeds install -a

If you wish to add your own feeds or modify existing ones, edit the entries in intelliroot/feeds.conf.default

Building and Installing the Image

OpenWRT which is the platform that Intellipi is built upon uses a generic, centralized menu for most items such as selecting packages etc... It is NCURSES and can accessed by running the command:

make menuconfig

Alternatively, the Linux kernel can be modified in a traditional way (this will look familiar to advanced Linux users, but is not a required step for the IntelliPi)

make kernel_menuconfig

To build the image using the configuration you have specified (if following this doc - Dev-barebones) then all that remains is to run the below command.

make V=99 -j numberOfPhysicalCoresPlusOne

Note: if the build is failing - try building it using only a single process by not specifying the -j option. Otherwise, error messages are displayed chaotically in whatever order as the make server has no synchronization between parallel build processes.

To clean the build directory and rebuild from scratch (doesn't include the toolchain used for cross-compilation), run the command "make clean". WARNING: If you run, "make distclean" beware! It will clean out the feeds, packages, and toolchain! If the build was successful, the standard read-to-use and RAMdisk image is ready to be burned (or more accurately "dd'd") to the SDcard (mini-sdcard for Pi2, A+ and B+).

To write to the sdcard, you should be cautious in your choice - dd has the power to wreck your system if you start flashing to your host system SSD instead. To determine the SDcard, open a terminal, insert the sdcard into the reader (internal or external - the results will be similar, but not exact). The drive in the first example is: sdb and the second is mmcblk0:

dmesg
[31544.484735] usb-storage 1-1:1.0: USB Mass Storage device detected [31544.484902] scsi host15: usb-storage 1-1:1.0 [31545.485342] scsi 15:0:0:0: Direct-Access USB Mass Storage Device PQ: 0 ANSI: 0 CCS [31545.486251] sd 15:0:0:0: Attached scsi generic sg2 type 0 [31545.486976] sd 15:0:0:0: [sdb] 30392320 512-byte logical blocks: (15.5 GB/14.4 GiB) [31545.487203] sd 15:0:0:0: [sdb] Write Protect is off [31545.487210] sd 15:0:0:0: [sdb] Mode Sense: 03 00 00 00 [31545.487421] sd 15:0:0:0: [sdb] No Caching mode page found [31545.487425] sd 15:0:0:0: [sdb] Assuming drive cache: write through [31545.492084] sdb: sdb1 sdb2 [31545.493341] sd 15:0:0:0: [sdb] Attached SCSI removable disk [31545.711183] EXT4-fs (sdb2): mounted filesystem without journal. Opts: (null)

Alternatively, it could look like this for an sdcard using an internal reader:

[31605.781430] mmc0: new high speed SDHC card at address 0007 [31605.781616] mmcblk0: mmc0:0007 SD08G 7.43 GiB [31605.782767] mmcblk0: p1 p2

Using the drive identifier found in the above step, replace "YOUR-DEV" with the one that indicates YOUR SD card in the following dd command. This will begin the flashing process and will be mostly silent until complete.

sudo dd if=bin/brcm2708/openwrt-brcm2708-sdcard-vfat-ext4.img of=/dev/YOUR-DEV bs=2M conv=fsync

DD will output something like the following to the terminal upon completion:

62+0 records in 62+0 records out 130023424 bytes (130 MB) copied, 14.9538 s, 8.7 MB/s

Accessing the Intellipi

There are several ways - one is to use an HDMI capable display and a keyboard combo. Alternatively, you can setup an SSH connection if your device has an on-board Ethernet NIC or using a USB to serial TTY adapter. For the purposes of this document, it will illustrate how to connect to the IntelliPi using an Ethernet connection and SSH.

By default, the IntelliPi will be at the address, 192.168.20.100/24 by means of a static IP address. To connect to the device, your system will need to be on the same subnet - 192.168.20.x/24 (but x should not be 0, 100 or 255). The IntelliPi does not have Internet or DHCP connectivity configured (easily possible later). To set your IP address to a static one within the 192.168.20.x range, and provided that your system's Ethernet interface is not controlled by the OS's network manger - the following steps address this AND how to gain SSH access.

sudo ifconfig YOUR_INTERFACE 192.168.20.10/24
ssh -l root 192.168.20.100

Note: if your are using that one ethernet port on your computer, YOUR_INTERFACE should be eth0.

Using the above ssh command and you are able to connect! Then you will be prompted to access an SSH key (used for cryptographic or secure communications - same concept as the lock icon in your web-browser) and the default password is "atom". Now you should be greated by a prompt that looks like this (although you may get an error message to remove the key as SSH may believe that it belongs to another device):

# ssh -l root 192.168.20.100
The authenticity of host '192.168.20.100 (192.168.20.100)' can't be established. RSA key fingerprint is 90:0f:90:06:8e:60:d7:53:0d:85:b8:ce:35:2d:51:bd. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.20.100' (RSA) to the list of known hosts.

Note: Everytime you rebuild your image, the ssh key changes and you need to delete it and add the new one again. (search for ssh-keygen to find ways of removing a ssh key)

Enter password: atom

root@192.168.20.100's password: BusyBox v1.22.1 (2015-04-26 10:03:57 PDT) built-in shell (ash) Enter 'help' for a list of built-in commands. ATOM EMBEDDED - Intellipi "Enabling Neural Freedom" Distributed under GPLv2, MIT or inherited license(s) ----------------------------------------------------- root@OpenWrt:~#

Note: To summarize and for my personnal use, I created a script that execute all the steps required to establish the connectivity with the IntelliPi. You will need to adapt it to your own system.

#!/bin/bash

sudo ifconfig eth0 192.168.20.20/24
ssh-keygen -f "/home/frederic/.ssh/known_hosts"
ssh -l root 192.168.20.100
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.