These are some notes from installing [Archlinux ARM](http://archlinuxarm.org/platforms/armv6/raspberry-pi) on my raspberry pi. 

### Expand the root partition.

The default root partition is much smaller than my 32gb SD card. We can resize it with `fdisk` as suggested in these [useful forum posts](http://archlinuxarm.org/forum/viewtopic.php?f=31&t=3119&sid=a865f2e3cd31ff5ab3c42ed5b99af1dd&start=30) on the subject.

```shell
# fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1           2048    186367   92160   c W95 FAT32 (LBA)
/dev/mmcblk0p2         186368   3667967 1740800   5 Extended
/dev/mmcblk0p5         188416   3667967 1739776  83 Linux

Command (m for help): d
Partition number (1,2,5, default 5): 2

Partition 2 has been deleted.

Command (m for help): n

Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): e
Partition number (2-4, default 2): 
First sector (186368-62333951, default 186368): 
Last sector, +sectors or +size{K,M,G,T,P} (186368-62333951, default 62333951): 

Created a new partition 2 of type 'Extended' and of size 29.6 GiB.

Command (m for help): n

Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l

Adding logical partition 5
First sector (188416-62333951, default 188416): 
Last sector, +sectors or +size{K,M,G,T,P} (188416-62333951, default 62333951): 

Created a new partition 5 of type 'Linux' and of size 29.6 GiB.

Command (m for help): p
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot     Start       End   Blocks  Id System
/dev/mmcblk0p1           2048    186367    92160   c W95 FAT32 (LBA)
/dev/mmcblk0p2         186368  62333951 31073792   5 Extended
/dev/mmcblk0p5         188416  62333951 31072768  83 Linux

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

# reboot
```

All that's left do is resize the new volume after reboot.

```shell
# resize2fs /dev/mmcblk0p5
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mmcblk0p5 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mmcblk0p5 is now 7768192 blocks long.

# df /
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/root       30575292 427948  28874492   2% /
```

### Taking advantage of systemd for initial set up.

Say what you want -- I like systemd.

```shell
# hostnamectl set-hostname tofu
```

```shell
# echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
# locale-gen
# localectl set-locale LANG="en_US.UTF-8"
```

```shell
# timedatectl set-timezone America/Chicago
# timedatectl set-ntp 1
```

### Set up wireless networking with `netctl`.

```shell
# cp /etc/netctl/examples/wireless-wpa /etc/netctl
# wpa_passphrase $SSID $WIFI_PASS >> /etc/netctl/wireless-wpa
```

Edit so that `Key=\"<HEX KEY FROM WPA_PASSPHRASE>` and enable it. 

You can `unset HISTFILE` so that your wifi pass doesn't get written to your `.bash_history`.

```shell
# netctl enable wireless-wpa
# netctl start wireless-wpa
```

### Make some changes in `/boot/config.txt`.

A detailed list of possibile configuration options can be found [here](http://elinux.org/RPiconfig). A list of changes I made is below:

```shell
# 1920x1080 from HDMI
hdmi_group=2                                                                                                      
hdmi_mode=82
# some overclocking
arm_freq=950
core_freq=450
sdram_freq=450
over_voltage=6
# less gpu memory = more memory
gpu_mem_512=64
gpu_mem_256=64
```

These will take change on next reboot.

### Using `pacman` to update our system.

```shell
# pacman -Syu
# pacman -S vim sudo git tmux xf86-video-fbturbo-git fbterm
```

### Time for some [~~twerking~~](https://www.youtube.com/watch?v=iBptNbgUOxQ) tweaking.

Like everything else, the [ArchWiki](https://wiki.archlinux.org/index.php/Raspberry_Pi) has a great wiki for the raspberry pi. 

I'll come back to this.

### Other stuff to do

* Make your raspberry pi an Airplay receiver with `sharepoint` (available from the [AUR](https://aur.archlinux.org/packages/shairport-git-sysdcompat/)). 
   1. `alsaequal` ([AUR](https://aur.archlinux.org/packages/alsaequal/)) is a system-wide equalizer