Hackberry A10

Hackberry A10: Wifi with Debian

Posted by Max on Wed, Nov 21 2012 14:27:00

The Hackberry A10 has a built in wifi chip which is deactivated by default if you use the Debian Wheezy image provided by Jas-Hacks (I wrote an article about how to run Debian on your Hackberry). Im going to explain what I did to get wifi running and make the Hackberry automatically obtain an IP-Address after boot. Again this is basically a summary of bits and pieces I found either on Jas-Hacks blog or in the miniand forums. Also I followed this (german) tutorial on wpa-supplicant.

Try it manually

Boot up your Hackberry A10 with your Debian SD Card inserted and connect to it via SSH.

First of all we manually load the wifi card module

sudo modprobe 8192cu

lsmod should now list the module and iwconfig should list your wifi card. It's probably called "wlan1".

lsmod
sudo iwconfig

Fire up the card and check if it's listed in ifconfig now.

sudo ifconfig wlan1 up
sudo ifconfig

You should now be able to scan for surrounding networks.

sudo iwlist wlan1 scan

Configure wpa-supplicant

I recommend using wpa-supplicant to connect to wifi networks. I'm not going into detail what wpa-supplicant is, go search on your own. ;)

wpa-supplicant should already be installed, we only have to add a config file. The first lines are basic configuration, after that you can add multiple "network" blocks, for each network you want to use your board with. For example network blocks see for instance this file. The iwlist command earlier should have presented you with your networks configuration details like WPA/WPA2, TKIP/CCMP, ...

sudo vim /etc/wpa_supplicant/wpa_supplicant.conf

My config looks like this:

ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=1

network={
        ssid="networkname"
        scan_ssid=1
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=TKIP
        psk="ibetyouwouldliketoknow"
}

Since this file holds a lot of sensitive information, chmod it to 0600.

sudo chmod 0600 /etc/wpa_supplicant/wpa_supplicant.conf

Now let's do a manual test of the configuration

sudo wpa_supplicant -i wlan1 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf -d

Open up another shell and check what iwconfig displays. Something like the following should be great.

wlan1     IEEE 802.11bgn ...

Now we can connect to the specified network by

sudo wpa_supplicant -i wlan1 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf -B

I checked via ifconfig if I got an IP-address, which I didn't, so I manually called dhclient.

sudo ifconfig #check for IP
sudo dhclient wlan1
sudo ifconfig #check again

If all that worked, you should now be connected to your network via wifi.

Make this permanent

What I wanted, and you do probably too, is for the Hackberry to connect to the network automatically after boot, since, yeah, the thing is still headless and we want to connect via ssh.

To load the wifi-card module on startup uncomment the "8192cu" line in /etc/modules

sudo vim /etc/modules

Also modify the wifi part in /etc/network/interfaces to use wpa-supplicant.

sudo vim /etc/network/interfaces

Mine looks like this:

auto wlan1
iface wlan1 inet dhcp
        wpa-driver wext
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Unplug the ethernet cable and reboot your device. In your router check if the Hackberry is connected. Mine unfortunately wasn't so I had to do the following. Plugin ethernet again, connect via ssh and insert the following ifdown/ifup commands into /etc/rc.local before "exit 0". These commands are executed after every boot.

...
ifdown wlan1
ifup wlan1

exit 0

Now I did another reboot (with ethernet unplugged) and the Hackberry showed up in my routers DHCP table and I could SSH onto the board. YEAH!

Hackberry A10: Starting with Debian

Posted by Max on Mon, Nov 12 2012 19:42:00

Wow, this is a coincidence! I decided to finally write another blog entry today and had a look how much time passed since my last posts. It was exactly one year ago.

What happened in the time? Not much, but as mosts geeks out there I ordered myself a Raspberry Pi. While waiting in the ridiculously long waiting line, I read up on some of the other "developer boards" popping up at the moment. The Hackberry A10 Dev Board sold by miniand caught my eye with built in wireless, its 1.2GHz Allwinner CPU and 1GB Memory, so I went ahead and bought one of those as well. The guys at miniand let me pay via Paypal (even though it's not an official payment method on their site) and shipped really fast. Thanks!

Hackberry A10

You can read up on the details of the board on their homepage. The device runs Android out of the box but to really put the hack in hackberry I want to run a debian on it. Of course I'm not the only one, so the great Jas Hacks already offers a nice Headless Debian Wheezy Image. So basically all the credit goes to him. I just want to leave a little write-up of how to install the image and the first steps in the new debian for low-mid skilled linux users like me. If I do something terribly wrong, please tell me in the comments. ;)

What do you need?

  • SD Card with at least 4GB capacity
  • SD Card reader
  • Ethernet Cable

Let's begin:

Download the Jas Hacks Image from this Blog Entry and upack the thing.

wget http://dl.miniand.com/jas-hacks/debian_wheezy_3.0.36.img.gz
gunzip debian_wheezy_3.0.36.img.gz

Also get the right updated uboot (example for 1Gb Board)

wget http://dl.miniand.com/jas-hacks/uboot/1gb/sunxi-spl.bin
wget http://dl.miniand.com/jas-hacks/uboot/1gb/u-boot.bin

Insert the SD Card into the card, find out the name of the card. Be careful! Chosing the wrong device may destroy your system. On my system it's called "/dev/mmcblk" so make sure to replace it in the following commands. Copy the image on the card using dd

sudo dd bs=4M if=debian_wheezy_3.0.36.img of=/dev/mmcblk0

This may take some time. To see the progress open another shell, find out the pid of the dd process and run the foolowing kill command. The progress should pop up in the dd shell.

pgrep -l '^dd$'
sudo kill -USR1 <pid>

When it's done do a sync

sudo sync

dd the new uboot to the SD Card

sudo dd if=sunxi-spl.bin of=/dev/mmcblk0 bs=1024 seek=8
sudo dd if=u-boot.bin of=/dev/mmcblk0 bs=1024 seek=32
sudo sync

If your card is larger than 4GB you can extend the ext partition on the card. I use gparted for this task. Now you can insert the SD Card into your hackberry. Plug in the ethernet cable and the power supply. The board should now boot debian. Since it's a headless image, it's configured to fire up ssh. Find out the IP of the device (probably via your routers webinterface) and ssh into it

ssh root@192.168.0.42 (pw: password)

Now I'm going to write down a few things I do on a fresh install

Change the root password

passwd

Change the hostname (in this example hackberry)

hostname hackberry
echo hackberry > /etc/hostname

Change locale and timezone

dpkg-reconfigure tzdata
aptitude install locales
dpkg-reconfigure locales

select some utf-8 (e.g. en_US.UTF-8 UTF-8) by pressing the space bar

Set the clock:

aptitude install ntp
ntpd -q -g
hwclock --systohc

Do a full upgrade

aptitude update
aptitude upgrade

Add a new user (muxe in this example)

adduser muxe
aptitude install sudo
visudo

Insert "muxe     ALL=(ALL:ALL) ALL" below the root line

Backup

When you are finished setting up your basic system I recommend doing a backup of the card. So in case you somehow fuck up your system you have a kind of savegame. shutdown the hackberry and insert the card to your cardreader. dd the other way round.

sudo dd if=/dev/mmcblk0 of=my_hackberry.img bs=4M

What I'm planing on blogging in the future on this topic: I'm currently building my own kernel with webcam support. This takes so long, it's the main reason I even had the time to write all this down. ;) When the webcam is running, I'll hopefully tell you how I did it and show you some stuff you can do with tools like motion. Also some stuff of the board is not very well documented. I had to read through a lot of different forum topics to gather those informations. When my composite cable arrives, I plan on writing something about different ways to output video with the Hackberry A10.

Todos: Wow this looks ugly. Guess I'll have to edit the css a bit and insert codeboxes, but now I'm too lazy. Have a great day and leave comments.