Quantcast
Channel: Moorescloud Dev Blog » Creative Commons
Viewing all articles
Browse latest Browse all 22

Getting your (micro)SD card boot image ready

$
0
0

Here is what you want to do to get an SD card booting on your controller board.

After your initial boot, the first thing you’ll probably want to configure is networking, so that you can then do the rest of your work over a WiFi connection.  For the OLinuXino I’m going to give basic instructions to configure Linux networking, but I will assume you have some experience configuring a Linux environment via the command line (and using vi).

Raspberry Pi

This is really simple.  Download the Adafruit Occidentalis SD card image (we used v0.2 which is a 900MB download), and follow the instructions provided on Adafruit and eLinux.org websites to configure your Pi.

The reason we recommend you use the Adafruit image is because of the extra kernel modules included for hardware hacking – most importantly support for hardware I2C and SPI, and the Realtek RTL8188CUS WiFi.

You could boot the Pi with a HDMI monitor and USB keyboard and mouse connected, and go through the initial config that way (my preferred method).  Or you can use an FTDI serial adapter (available from Element14/Farnell/Newark), and connect via a terminal emulator like Putty or minicom.

OLinuXino

This is a bit more complex than the Raspberry Pi as we don’t *yet* have a pre-built image for you to download.  For our instructions we used this August 2012 ArchLinuxARM (ALARM) image, and if you used a later one there may be some differences to the process.

NOTE: If you are using the OLinuXino Micro, you’re going to have a chicken and egg problem getting networking up – unless you happen to have a USB Ethernet or WiFi adapter supported by the standard ALARM distribution (and for WiFi an open network – no WPA!).  To get around this, we used the OLinuXino Maxi with an Ethernet connection to download and install everything needed for the WiFi adapter.  If your are using a Micro and this affects you, let us know and we will try get a clean version of our SD card image uploaded somewhere asap to help.  Once the

  1. Follow the instructions under the Installation tab on the ALARM page for the OLinuXino
  2. Use a PC running Linux to modify the partitions on the microSD after imaging, although you could just adjust the instructions from the above page.  I adjust partition 2 to fill the card, excluding 128MB or 256MB at the end, where I create a swap partition.
  3. If you are using an OLinuXino Micro and the base ALARM image, you could mount the SD card on your Linux PC and copy needed files for WiFi networking into the SD card /root folder – such as our driver, and the wireless_tools and wpa_supplicant packages for armv5.
  4. Install the microSD in the OLinuXino, and connect a serial to USB adapter (note my earlier warning about the need for a Schottky diode on the serial receive line, or only connecting a few seconds after power up)
  5. If you have boot up issues, check for hints at the Olimex Forums
  6. Login as root – the default password is root
  7. To enable the swap partition – which is needed for some updates and compiles – you should run this command after each boot: “echo 1 >/proc/sys/vm/swappiness; mkswap /dev/mmcblk0p3 && swapon /dev/mmcblk0p3”.
  8. You can also add the swappiness setting to /etc/sysctl.conf and an entry to /etc/fstab so that the swap is automatically available on each boot.  Setting swappiness to 1 is important to reduce the writes to your SD card.
  9. Download our modified Realtek 8192cu driver and run “unzip 8192cu.zip && mkdir -p /lib/modules/`uname -r`/kernel/drivers/net/wireless/rtl818x/ && cp 8192cu.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/rtl818x/ && depmod –a
  10. Check your WiFi adapter is recongnised by running “iwconfig wlan0
  11. Install the needed WiFi packages by running “pacman –S wireless_tools wpa_supplicant
  12. Replace /etc/wpa_supplicant/wpa_supplicant.conf with contents like:

    network={

        ssid=”YOURSSID”

        psk=”yournetworkpassphrase”

        priority=5

    }

  13. Modify /etc/rc.conf, and set “interface=wlan0”, and either blank out address, netmask, broadcast, and gateway (for DHCP) or put in manual values.  If you don’t use DHCP, you’ll also want a nameserver entry to /etc/resolv.conf
  14. Edit /etc/rc.local to add lines to start wpa_supplicant – like this:

    # Start the wpa_supplicant

    echo “:: WPA_Supplicant”

    wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf &

  15. Finally reboot to see if you get your wireless networking up
  16. Due to a change in glibc since the 2012.08 image was release, before installing updates or other packages you should run “pacman -Syu –ignore glibc && pacman -R pcmciautils && pacman –Su” – don’t forget to enable swap first, or this is likely to fail
  17. Now install some additional useful stuff by running “pacman -S base-devel i2c-tools ntp
  18. You might now want to run “ntpd –qg&” after each boot to set the date and time – or add this to /etc/rc.local.

So whether you’ve chosen the Raspberry Pi or the OLinuXino, you should now have a booting embedded Linux box with wireless networking up and running.  The next couple of articles will take you though testing your hardware with some simple code.

Note re WiFi adapters for ALARM

We’ve been using a Nano USB WiFi adapter using the RTL8188CU chipset that is branded “COMFAST” (similar to this Adafruit one), or a larger one that has the RTL8192CU chipset.  The RTL8192CU uses the same driver, and was slightly faster in our testing, but it didn’t physically fit in our design.

Note that I couldn’t get an RTL8188SU adapter working (e.g. Asus N10) as it requires different drivers, and I just couldn’t get the ones I downloaded from Realtek website to compile for ArchLinuxARM.

Our 8192cu.ko driver linked above also includes the USB device ID for the Netgear N150 (WNA1000M).  Here is the things we modified to build it: Realtek driver build notes


Viewing all articles
Browse latest Browse all 22

Trending Articles