Skip to content

Instantly share code, notes, and snippets.

@tkiapril
Last active June 24, 2020 04:51
Show Gist options
  • Save tkiapril/f9718e11ccc172b38c77 to your computer and use it in GitHub Desktop.
Save tkiapril/f9718e11ccc172b38c77 to your computer and use it in GitHub Desktop.
How to install Arch Linux ARM quick - in a tkistic style

How to install Arch Linux ARM quick on Odroid XU3-Lite with an external HDD - in a tkistic style

This article derives from this article - where typical x86-64 Arch Linux Installation is described. The procedure is a bit simillar, a bit different - if the original article is revised, the changes may also be applied to this article.

This guide is based on Arch Linux ARM on Odroid XU3-Lite board: I cannot gurantee that same orders apply to other boards.

This guide describes how to install Arch Linux ARM with simillar steps when installing Arch Linux on regular x86-64 system - and also with external HDD.

Disclaimer: This guide is for personal archival and referencing purposes; it is not written as to inform general public, and may have vague and unfriendly steps. Follow on your own responsibillity.z

THIS GUIDE ASSUMES THAT YOU HAVE FAIR KNOWLEDGE ABOUT THE SUBJECT IN TOTAL - THE AUTHOR HOLDS NO RESPONSIBILLITY ON WHAT HAPPENS TO YOUR SITUATION. FOLLOW ON YOUR OWN RISK: DO NOT BLINDLY COPY-AND-PASTE THE STEPS, YOU HAVE TO READ THE INSTRUCTIONS THROUGHLY AND MODIFY WHAT YOU HAVE TO DO ON YOUR BEHALF.

Requirements

  • Odroid-XU3 (Lite) board
  • MicroSD card larger than 1GB - I recommend having two of these.
  • USB External HDD
    • Preferably with USB 3.0 support, SATA3(6G) and UASP for maximum performance.

Install base system

  1. This step is different from the original article! With instructions here, install the first pass of ALARM (which will be discarded) on the SD Card.

  2. Boot.

  3. Load keymap. Typically it will be:

    loadkeys us

    but it should be already loaded for you on boot.

  4. This step is different from the original article! With the external hdd plugged in, partition it.

    cfdisk /dev/sdX

    Making a swap partition is not recommended.

  5. Format.

    mkfs.FORMAT /dev/sdXn

    Recommended FORMAT is ext4.

  6. Mount the partition under /mnt.

    mount /dev/sdXn /mnt
  7. This step is different from the original article! Install arch-install-scripts to get tools for installation.

    pacman -S arch-install-scripts
  8. Edit the /etc/pacman.d/mirrorlist: put your preferred mirror at top. JAIST was the best in my circumstances. In order to edit easily, you might want to install vim. You would also use rankmirrors. Refer to this page.

  9. This step is different from the original article! Install the base packages into your partition.

    pacstrap /mnt base base-devel curl git openssh screen tmux vim wget zsh zsh-completions

    Note that you don't have to install grub, it does not work with our board.

  10. When it's done, generate fstab.

    genfstab -p /mnt >> /mnt/etc/fstab
  11. chroot into the partition.

    arch-chroot /mnt
  12. Write your hostname.

    echo HOSTNAME >> /etc/hostname
  13. Symlink local time zone.

    ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime
  14. Uncomment locale of your liking from /etc/locale.gen. Typically it would be en_US.UTF-8.

  15. Generate your locales.

    locale-gen
  16. Set locale preferences.

    locale > /etc/locale.conf
  17. Set console keymap and font preferences. In /etc/vconsole.conf:

    # /etc/vconsole.conf
    KEYMAP=us
    FONT=lat2-16

    Steps are different from the original article from here!

  18. Install linux firmware and bootloader(uboot).

    pacman -S linux-firmware linux-odroid-xu3 uboot-odroid-xu3

    When the pacman tells you that you have to flash the mmcblk0 device, go ahead and flash it.

  19. Edit /boot/boot.ini:

    setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 root=/dev/sda1 rootwait rw"
    

    Notice that root= parameter is set to your root partition.

    *Steps are same with the original article from here, you can go on.

  20. Set a root password with passwd.

Enable services

Enable and start services you would run. All of these commands should be run as root.

```shell
sudo systemctl enable sshd
sudo systemctl start sshd
```

Change bootloader Settings

This step is different from the original article!

First, exit the chroot.

Then, with the same changes, edit /boot/boot.ini. If you forget this step, you cannot boot into your new system.

When you're done, go ahead and reboot.

```shell
umount -R /mnt
reboot
```

Install new bootloader to SD Card

  1. Make sure that you successfully booted into your newly installed system on your HDD, and that your SD Card is not mounted.

    df -h

    If you cannot find /dev/mmcblkN here, you're safe to go.

  2. Pop the card out and pop in another one. You can skip this step, but if something goes wrong, you may have to re-create your installation pass of system.

  3. Partition and format the SD Card with dos (MBR) partition table and ext4.

  4. Mount it on /mnt and copy /boot into /mnt, including the directory.

  5. cd to /mnt and run `./sd_fusing.sh /dev/mmcblk0'. It is normal to take some time.

    You can reboot from now. Remember that you have to mount and flash bootloader on SD Card again when new uboot update is shipped. Also, you have to copy and overwrite your /boot folder to SD Card when new kernel update is done since your kernel is at /boot/zImage, which is not used for actual boot sequence.

Network Configuration

Configure your network. I personally prefer systemd-networkd. All of these commands should be run as root.

  1. Configure /etc/systemd/network/PROFILE_NAME.network (you should have one every NIC).
  • for static IP:
[Match]
Name=INTERFACE_NAME

[Network]
Address=YOUR.IP.ADDRESS.HERE/CIDR
Address=ANOTHER.IP.ADDRESS.HERE/CIDR
Gateway=GATEWAY.IP.ADDRESS.HERE
  • for DHCP:
[Match]
Name=INTERFACE_NAME

[Network]
DHCP=yes

;uncomment this section if you want to *not* use received from the DHCP server as the transient hostname.
;[DHCPv4]
;UseHostname=false
  1. Start systemd-resolvd and link resolv.conf for DNS resolution from DHCP, or if DNS is defined in network files.

    sudo systemctl enable systemd-resolved
    sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
    sudo systemctl start systemd-resolved
  2. Enable and start systemd-networkd.

    sudo systemctl enable systemd-networkd
    sudo systemctl start systemd-networkd
  3. Check network status.

    ip addr
    ping -c3 google.com

Create new user and add to sudoers

  1. Create a new user for typical use. Using root for everyday chores are EVIL.

    useradd -m -G wheel -s /bin/bash USERNAME
  2. Edit sudoers. Before editing, I recommend you to edit your vimrc for easy editing, or install sensible.vim.

    EDITOR=vim sudo visudo
    # visudo
    USERNAME ALL=(ALL) NOPASSWD: ALL

If you enabled sshd and configured network, you can use ssh to work from now on.

Create Swap File

I recommend you use a swap file instead of a swap partition because it is easier to modify. All of these commands should be run as root.

  1. Create file for use as swap file.

    sudo fallocate -l 1024M /swapfile # allocate file for swapfile
    sudo chmod 600 /swapfile # set proper permissions
    sudo mkswap /swapfile # format swapfile as swap
    sudo swapon /swapfile # enable swap
  2. Edit /etc/fstab and add an entry for the swapfile:

    # /etc/fstab
    /swapfile none swap default 0 0

In case you want to remove swapfile:

sudo swapoff /swapfile
sudo rm -f /swapfile

and remove the entry from /etc/fstab.

If you want to resize swapfile, just remove it and regenerate it without removing the fstab entry.

When removing or resizing swapfile, note that swap is managed by systemd and will be re-enabled by it after some time.

Install zsh

Because we installed zsh on system install, we do not have to install the package. However, I will install oh-my-zsh for ease of configuration and themes.

  1. Install oh-my-zsh.

    curl -L http://install.ohmyz.sh | sh
  2. Automatic chsh is likely to fail, so you have to do it for yourself.

    chsh # authorize and type zsh on prompt
  3. Edit ~/.zshrc and change oh-my-zsh theme. I prefer agnoster, which is flavored with powerline-patched fonts and solarized colors. I recommend you to install powerline-patched fonts such as Source Code Powerline if you are going to use agnoster.

    # ~/.zshrc
    ZSH_THEME="agnoster" # it should be residing on top, you should modify it.
  4. Editing ~/.zshrc, change your $EDITOR environmental variable and alias:

    # ~/.zshrc
    export EDITOR="vim"
    alias vi="vim"
  5. Editing ~/.zshrc, enable keypad by appending:

    # ~/.zshrc
    # Keypad
    # 0 . Enter
    bindkey -s "^[Op" "0"
    bindkey -s "^[Ol" "."
    bindkey -s "^[OM" "^M"
    # 1 2 3
    bindkey -s "^[Oq" "1"
    bindkey -s "^[Or" "2"
    bindkey -s "^[Os" "3"
    # 4 5 6
    bindkey -s "^[Ot" "4"
    bindkey -s "^[Ou" "5"
    bindkey -s "^[Ov" "6"
    # 7 8 9
    bindkey -s "^[Ow" "7"
    bindkey -s "^[Ox" "8"
    bindkey -s "^[Oy" "9"
    # + -  * /
    bindkey -s "^[Ok" "+"
    bindkey -s "^[Om" "-"
    bindkey -s "^[Oj" "*"
    bindkey -s "^[Oo" "/"
  6. Change into zsh by:

    exec zsh

Relax on the couch and drink a glass of your favorite drink

You now have installed Arch Linux, tkistic style. Now go on and install other stuff you would use, such as:

  • Edit vimrc.
  • Edit .tmux.conf.
  • Install rvm.
  • Install pyenv.
  • Install mkvirtualenv.
  • Install powerline.
  • and many other geeky things!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment