Skip to content

Instantly share code, notes, and snippets.

@h0tw1r3
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h0tw1r3/11235098 to your computer and use it in GitHub Desktop.
Save h0tw1r3/11235098 to your computer and use it in GitHub Desktop.
Arch Linux for ARM setup
## Device specific stuff
# Wandboard
pacman -Sy uboot-wandboard
pacman -Sy firmware-imx
pacman -Sy firmware-brcm43xx
curl https://raw.githubusercontent.com/Freescale/meta-fsl-arm-extra/master/recipes-bsp/broadcom-nvram-config/files/wandboard/nvram.txt \
> /lib/firmware/brcmfmac-sdio.txt
ln -s /lib/firmware/brcmfmac4329-sdio.bin /lib/firmware/brcmfmac-sdio.bin
## Set hostname
hostnamectl set-hostname wandboard
## Root fs
echo -e "/dev/root\t/\text4\tnoatime,discard,data=ordered\t0\t0" >>/etc/fstab
# Resize root mmc partition to fill entire storage area
# This only applies if you used an image that was not the same size as your mmc.
fdisk /dev/mmcblk0
# Print partition table, take note of partition 2 start sector
# p
# Delete the second partition /dev/mmcblk0p2
# d
# 2
# Create a new primary partition.
# n
# p
# 2
# <original p2 start sector>
# enter
#
# Save and exit fdisk:
# w
reboot
resize2fs /dev/mmcblk0p2
## Colorful pacman output
sed -i 's/^#Color$/Color/' /etc/pacman.conf
## Update system
pacman -Syu
## Wireless
pacman -Sy iw wpa_supplicant
echo -e "ctrl_interface=/run/wpa-wlan0\nupdate_config=1" > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
systemctl enable wpa_supplicant@wlan0
systemctl enable dhcpcd@wlan0
# Read https://wiki.archlinux.org/index.php/WPA_Supplicant for details on setting up a network
## Bluetooth
# Replace systemd/script - it uses the wrong tty!
systemctl enable brcm43xx
## Set local timezone
timedatectl set-timezone America/Chicago
timedatectl set-local-rtc 0
timedatectl set-ntp 1
## Setup AUR support (and yaourt)
pacman -S --needed base-devel
sed -r -i 's/^#?MAKEFLAGS="-j.*/MAKEFLAGS="-j'`nproc`'"/' /etc/makepkg.conf
mkdir ~/build && \
cd ~/build && \
curl -O https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz && \
curl -O https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz && \
tar -xf package-query.tar.gz && \
tar -xf yaourt.tar.gz && \
cd package-query && makepkg -s && pacman -U package-query*pkg.tar.xz && \
cd ../yaourt && makepkg -s && pacman -U yaourt*pkg.tar.xz && \
cd ..
#!/bin/sh
#
# Does some guessing to find the device type and UART for patching.
MAC_OPTIONS=""
if [ -z "$MAC_ADDR" ]; then
echo "MAC_ADDR in /etc/conf.d/bcm43xx not set, will use MAC set by device (expect this to be buggy)"
else
MAC_OPTIONS="--bd_addr $MAC_ADDR"
fi
DEVS=($( cat /sys/class/mmc_host/mmc*/mmc?\:0001/mmc?\:0001:?/device ))
HCD=""
EXTRA=""
for a in "${DEVS[@]}"
do
if [ "${HCD:0:4}" = "0x43" ] ; then
break
fi
done
if [ "$a" = "0x4329" ] ; then
HCD="bcm4329.hcd"
fi
if [ "$a" = "0x4330" ] ; then
HCD="bcm4330.hcd"
EXTRA="--no2bytes --enable_lpm --tosleep=50000 "
fi
TTYS=($( ls -r1 /dev/ttymxc? ))
for tty in "${TTYS[@]}"
do
ttynum=${tty:0-1}
if [ $ttynum -eq 0 ]; then
echo "Writing to ttymcx0 does not seem right, aborting."
exit 1
else
break
fi
done
if [ -n "$ttynum" -a -n "$HCD" ] ; then
echo "Found chip version $a."
/usr/bin/brcm_patchram_plus -d --patchram /usr/lib/firmware/brcm/$HCD --baudrate 3000000 --use_baudrate_for_download /dev/ttymxc${ttynum} --enable_hci $EXTRA $MAC_OPTIONS &
else
echo " No device Found."
exit 1
fi
for i in 1 2 3 4 5 ; do
b=`hciconfig | grep UART | cut -d: -f1`
if [ -n "$b" ] ; then
hciconfig $b up
break
else
sleep $i
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment