Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to install Arch Linux ARM on the BeagleBone Black eMMC
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root!"
exit 1
fi
echo -e "\033[31mThis Script comes with ABSOLUTELY NO WARRANTY!\033[0m"
echo -e "\033[31mUse at your own risk!\033[0m"
sleep 2
echo "Enter Home of root"
cd
sleep 2
echo "Initialize the pacman keyring and populate the Arch Linux ARM package signing keys"
pacman-key --init
pacman-key --populate archlinuxarm
sleep 2
echo "Install required software"
pacman -Sy wget parted
sleep 2
echo "Zero the beginning of the eMMC"
dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=8
sleep 2
echo "Partitioning of the eMMC"
parted /dev/mmcblk1 -s mklabel msdos mkpart primary 2048s 7553023s
sleep 2
echo "Create ext4 filesystem"
mkfs.ext4 /dev/mmcblk1p1
sleep 2
echo "Create mount folder"
mkdir mnt
sleep 2
echo "Mount filesystem"
mount /dev/mmcblk1p1 mnt
sleep 2
echo -e "\033[36mDownload the root filesystem\033[0m"
echo -e "\033[31mThis can take a while. Please be patient!\033[0m"
wget http://os.archlinuxarm.org/os/ArchLinuxARM-am33x-latest.tar.gz
echo -e "\033[36mExtract the root filesystem\033[0m"
echo -e "\033[31mThis can take a while. Please be patient!\033[0m"
bsdtar -xpf ArchLinuxARM-am33x-latest.tar.gz -C mnt
sync
sleep 2
echo "Install the U-Boot bootloader"
dd if=mnt/boot/MLO of=/dev/mmcblk1 count=1 seek=1 conv=notrunc bs=128k
dd if=mnt/boot/u-boot.img of=/dev/mmcblk1 count=2 seek=1 conv=notrunc bs=384k
echo "Unmount filesystem"
umount mnt
sync
echo -e "\033[36mIt's done!\033[0m"
echo "Now you can shut down your BeagleBone Black."
echo "After shutting down, remove the SD card and restart your BeagleBone Black."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.