SD Card - Fixing shutdown bug + updated steps to building your own card

Started by Cure, December 14, 2012, 09:51:33 AM

Previous topic - Next topic

Cure

I had trouble building my own SD card from the instructions on the wiki.  I was frustrated for more than a week but finally figured it out, so this is my way of giving back and helping others in the Olimex community.  Considering I have NEVER used Linux before last week, I think this is quite an accomplishment.  The steps in http://blog.klava.se/post/debian-sd-card-for-olinuxino-a13 work but the shutdown bug is a huge problem, plus it's missing UVC camera support.  According to Olimex tech support, they use kernel 3.0.8 (stable) in their SD card image.  http://blog.klava.se/post/debian-sd-card-for-olinuxino-a13 uses kernel 3.4 which is "in development" and unstable.

**NOTE this kernel does not support WPA2 wifi authentication, at the end I will show you how to fix it but you need to know how to make changes to your wifi router.  If someone knows how to fix this before the kernel is compiled, please post it here.


Follow the steps on http://blog.klava.se/post/debian-sd-card-for-olinuxino-a13 but change these sections:

---Building the kernel---
  $ git clone https://github.com/linux-sunxi/linux-sunxi linux-sunxi
  $ cd linux-sunxi
  $ git checkout sunxi-3.0

  $ make ARCH=arm a13_defconfig
  $ vim .config

  Find and change this row to:
   #   CONFIG_SUN4I_GPIO_UGLY is not set
   CONFIG_SUN4I_GPIO_UGLY=y

Adding UVC camera support (this step is optional):

  $ make ARCH=arm menuconfig
   V4L support needs to be enabled by changing "<>" to "<M>"
   Device drivers -> <M> Multimedia support -> <M> Video for Linux

   Enable UVC as well by changing "<>" to "<M>"
   Device drivers -> Multimedia support -> [`] Video capture adapters -> [`] V4L USB devices -> <M> USB Video Class (UVC)

Complie the kernel:

  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage
  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=out modules
  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=out modules_install



---Writing to the SD-card, section 3 change to:---
NOTE: I like to delete all volumes on my SD card (using windows Computer Management > Disk Management) then do a FULL FORMAT each time, otherwise old information stays on the card and it sometimes doesn't boot up.

  $ mount /dev/sdb2 /mnt
  $ cd /mnt
  $ gunzip -c /home/antonklava/olinuxino/mele_debian_armhf_minimal.cpio.gz | cpio -i
  $ cd /home/antonklava/olinuxino
  $ cp -a linux-sunxi/out/lib/modules/3.0.52+/ /mnt/lib/modules/
  $ sync
  $ umount /mnt

DONE!



Next step is to setup WPA2 wifi support.  You must change your router to Encryption: NONE then connect and download the WPA2 package:

Boot the A13 and login

  $ ifconfig -a (get the name of the wifi adaptor, should be wlan0)
  $ ifconfig wlan0 up
  $ iwconfig wlan0 essid SSIDNAME (my router has no spaces in the name, if it does not work for you try quotes "SSID Name")
  $ dhclient wlan0
  $ ifconfig -a (to make sure you have an ip address)
  $ apt-get update

This will take a minute, by then the A13 will disconnect from the router so you have to reconnect:
  $ iwconfig wlan0 essid SSIDNAME
  $ apt-get install wpasupplicant

Change your wifi router back to WPA2 encryption. 

Setup the interface to auto connect to wifi:
  $ vi /etc/network/interfaces
  (vi doesn't work through terminal so I use this instead):
  ( $ ex /etc/network/interfaces )
  ( $ visual )

Add the lines:
   auto wlan0
   iface wlan0 inet dhcp
   wpa-ssid SSID name
   wpa-psk password

You do not have to reboot to test the new connection, just use:
  $ /etc/init.d/networking restart

Check to see if you are connected to the right router:
  $ ifconfig -a


Done!  Please post a followup or a thank you if this works, it took me a while to figure all this out.

olimex


jwischka

Quote from: Cure on December 14, 2012, 09:51:33 AM
**NOTE this kernel does not support WPA2 wifi authentication, at the end I will show you how to fix it but you need to know how to make changes to your wifi router.  If someone knows how to fix this before the kernel is compiled, please post it here.

The problem is not the kernel, but rather the fact that the rootfs he provides does not have wpa-supplicant installed. This is annoying, but fixable.

Follow your instructions, up to the point where you are about to unmount /dev/sdb2. Then, instead, do the following (assuming you are still su):

apt-get install qemu-user-static
cp -a /usr/bin/qemu-arm-static /mnt/usr/bin/

mount -t proc proc /mnt/proc
mount -t sysfs sysfs /mnt/sys
mount --bind /dev /mnt/dev

chroot /mnt /bin/bash

At this point, you will be in a chroot prompt, and in effect you are now making changes to your olinuxino a13 system, not your computer. The sources that are apt's defaults are from the UK server, which is slow for those of us across the pond, so I change that to be the American server in /etc/apt/sources.list Anyway:

apt-get update
apt-get install wpasupplicant
vi /etc/network/interfaces

And whatever other housekeeping you want to do before boot.

When you're done and ready to get things going on the embedded side:

exit
umount /mnt/proc
umount /mnt/sys
umount /mnt/dev
umount /mnt

You'll probably have something that's being annoying and locking the card, so rebooting is probably the prudent option.

Pop the card in, and you'll be good to go.

Done and done.

granel

SD card --boot made ​​in the operating system Windous 7.
fist on display see -->
root@ubuntu:~#  --> login -- olinuxino password --olinuxino -->
next-->
olinuxino@ubuntu:~$ ( what else???)
Sergei

jwischka

Quote from: granel on March 18, 2013, 11:05:59 PM
SD card --boot made ​​in the operating system Windous 7.
fist on display see -->
root@ubuntu:~#  --> login -- olinuxino password --olinuxino -->
next-->
olinuxino@ubuntu:~$ ( what else???)
Sergei

What do you want to do? You're at the shell.

granel

I thought I would see a window
is the same as after loading Windous
but only black screen....

JohnS

You can really help yourself by reading a primer about the basic aspects of Linux.

Read about things like
shell
startx

You might find it really useful to join a Linux forum or three and/or buy a beginner's book.

The OS is built out of parts, many of them optional.  One such is the GUI (or indeed the UI) and there is even a wide choice of which (G)UI.

Many users run small boards like these "headless" i.e. with no display attached, so any GUI would be a huge waste of RAM etc.

John

granel

Thank you , John.
I want to have this board like second PC with Linux OS .
For Linux testing.
I need GUI for this OS + board.
Can I see GUI or no (using thiv var. OS on the micro SD )?
Or I must to do SD card using PC with Linux OS?
Sergei

olimex

Sergei, read here http://olimex.wordpress.com/2012/11/23/running-debian-with-xfce4-on-a13-olinuxino/ how to instal xfce
I would recommend you to install some Linux on your desktop computer first before go in to Embedded Board Linux.
So you can play a bit and get familiar with the OS.
You can install Ubuntu on your Windows computer and to have dual boot and switch between the OS-es

JohnS

I agree.  Learning Linux on a PC is much easier and of course it's a much faster device.

No substitute for learning and that's by reading and especially doing...

John

granel

ubuntu display size only 800x600?
(after ~$ startx can see GUI)

aquarat

This is probably a n00b question, but does the compiled kernel make use of hard floating point ?

I've also seen "CXXFLAGS" and CFLAGS set to -pipe, -O2, etc. could those options speed things up here ?