ARM Installation Guide

From ParabolaWiki
(Redirected from Parabola ARM installation)
Jump to: navigation, search
Warning: SBCs normally run the GNU/Linux system, but that doesn't mean that all is well for software freedom on these boards. Therefore, there's no support for hardware that doesn't work without running a nonfree program, such as Raspberry Pi, ODROID (models using the Samsung Exynos SoC), Arndale, Intel Edison boards and probably others. See the FSF article for more info.


The Installation Guide for ARM computers is intended to assist experienced GNU/Linux users in installing Parabola official tarball image. This page assumes a high-level of experience with GNU/Linux systems and utilities, especially the command line. Note that dealing with ARM computers is more complicated than common x86 computers because you will need to lean some some hardware specific knowledge.

Before beginning, we recommend you view the Arch Linux FAQ, and employ the man command to read the man page of any command they are not familiar with. The Parabola wiki, as well as the Arch Linux wiki, should be the primary source of information and your first resource during trouble-shooting.

1 Warning

Warning: Theses new instructions have not been tested yet, remove this warning when they will have been tested.

2 ARM status

Many ARM computers can be used with 100% free software. This however doesn't mean that every hardware component is perfectly supported by free software. It's better to plan ahead and choose your hardware accordingly.

See the Article on the single-board-computers at the FSF for more details on the topic. This article also covers devices that do not have an ARM CPU, and are not supported by Parabola because of that.

2.1 Linux

You should take into account the state of the software support in upstream projects before buying ARM devices. The project that has the biggest impact on hardware support is Linux, as it is required to make your hardware work:

Devices vendor typically ship an old version of the Linux kernel that is modified by them to support their hardware. The Free and Open source software communities are working actively to add support for many ARM devices in Linux.

If the device you want to get is not supported upstream (and that you don't intend to add such support yourself) you should rather look for another device. If your device requires a kernel version that is way older than the one used in your GNU/Linux distribution, it is almost unusable: it will be almost impossible to use because several software will not run with older kernels. For instance you won't be able to boot your device with systemd if your kernel is too old. If the vendor kernel is not too old yet, it will become too old years later as it will not be (indefinitely) updated by the device vendor.

2.2 Bootloaders

Bootloaders are less a concern, as you might be able to workaround the lack of support of modern filesystems and partitions. However finding why your device does not boot can be painful, so it's strongly advised to get devices which are support in upstream Free and Open source bootloader projects.

3 Know your hardware

ARM devices can be very different, and this has implications on the way you will install Parabola.

More specifically you will need to know:

  • From which storage device your device can boot. Most supported devices can boot from a microSD. Knowing the order in which it tries to boot on the storage devices can also be useful as it can help you understand what is going on if your device is not booting. Knowing the partitioning/filesystem boot requirements can also be handy in that case, if they are not mentioned in this installation guide. In that case it would be nice to add them in this guide.
  • How to get some feedback on what is going on:
    • Not all devices can be connected to a display, and when they can, the display is not necessarily available early at boot.
    • Some devices have an easily accessible serial port that can act as a display + keyboard replacement.
  • The state of the software support for your device:
    • What parts of the hardware works and what doesn't in Linux
    • The limitations of the bootloader (version) you are using

Here are some links to such information:

4 Some hardware and booting background

4.1 System on a chip

In most of the ARM computers, the CPU and many peripherals are inside the same chip. This chip is called 'System On A chip' (often abreviated as SOC). Beside the CPU, it often also contains:

  • A GPU
  • A display controller
  • One or more USB host controllers
  • An USB OTG/Device controller
  • A SD card controller
  • A serial port controller
  • Many other periperals

4.2 Bootrom and booting

Most of such System on a chip have ARM code in a ROM (hardwired inside the chip) that is executed at startup. This is called a bootrom.

The bootrom is responsible for doing some hardware initialization and fetching the bootloader from a storage device. Often it is also possible to load a bootloader from USB or a serial port.

The bootloader then do some more (device specific) hardware initialization and loads the operating system.

In practice, on most hardware, after initializing some hardware, the bootrom will try to locate the bootloader from an external storage device. The external storage device has to be supported by the bootrom. For instance in the bootrom of Allwinner System on a chip, the bootrom doesn't support booting from SATA storage devices, but supports booting from uSD/SD cards, eMMC, SPI flash chips, etc.

The kind of storage devices the bootrom tries to find a bootloader on, and the order in which it tries them can often be configured by hardware and/or software.

4.3 Bootloaders and their limitations

4.3.1 u-boot

u-boot supports the ext2, ext4, and ext4 filesystem, however, at the time of writing, the versions used in Parabola doesn't support all 'extensions' of the ext4 filesystem.

If you use unsupported extensions you would usually be able to list the filesystem content with ext4ls or similar commands, but you usually won't be able to read some files. When this is the case u-boot will output some errors at boot and booting will fail.

To make sure it doesn't happen, you can format the ext4 filesystem your kernel and initramfs resides on like that:

mkfs.ext4 -F -O ^metadata_csum,^64bit /dev/CARD1

In the commands above and below, replace /dev/CARD1 by the path of the SD-card, which could be /dev/mmcblk0 if you use a 'native' SD reader, or /dev/sdb1 for instance if you have an 'usb mass storage' SD reader.

To see which extensions you have, you can use the following command:

tune2fs -l /dev/CARD1

TODO: Check the commands below to remove unnecessary fsck

Ext4 filesystems can also be converted to remove metadata_csum like that:

fsck.ext4 -C 0 -f /dev/CARD1
tune2fs -O ^metadata_csum /dev/CARD1
fsck.ext4 -C 0 -f /dev/CARD1

And for removing 64bit:

fsck.ext4 -C 0 -f /dev/CARD1
resize2fs -s /dev/CARD1
fsck.ext4 -C 0 -f /dev/CARD1

5 Device-specific informations

5.1 GTA04 A3

Parabola then boots and you are supposed to see the boot log on the serial console. At the time of writing the kernel lacks the GTA04 display driver, this is bug #587

5.2 BeagleBone Black

Scripts for installing Parabola on the internal 4GB EMMC can be found at the knochenreiter repository. The BeagleBone Black with preinstalled Parabola is also sold by Phreedom2600.

6 Releases tarballs

Download and verify the official Release tarball

  • The release tarballs are signed and it is highly recommend to verify their signature before use. On Parabola GNU/Linux-libre, this can be done by using pacman-key -v <tarball-file>.sig. On other systems: gpg --verify <tarball-file>.sig. You may have to import the key from a keyserver with gpg --recv-keys <0x key ID>.
  • Checksums are also provided in the accompanying SHA512SUMS and WHIRLPOOLSUMS files. They can be verified with: sha512sum -c SHA512SUMS and whirlpool-hash -c WHIRLPOOLSUMS.

7 Partition disks

See partitioning for details.

Remember to create any stacked block devices like LVM, LUKS, or RAID.

If you use such stacked block devices, remember to generate an initramfs and configure the bootloader to use it.

8 Format the partitions

See File systems for details.

You will most likely need to use a filesystem supported by your bootloader, without using any features it does not support, for the files in /boot.

Some System on a chip may also require the bootloader to reside on a specific partition.

9 Mount the partitions

We now must mount the root partition on /mnt. You should also create directories for and mount any other partitions (/mnt/boot, /mnt/home, ...) and mount your swap partition if you want them to be detected by genfstab.

10 Enable executing arm code on x86

If you are installing from an x86 computer, you will need to enable running non-x86 binaries transparently. This can be done by telling the Linux kernel to use automatically qemu to do that.

If the computer you use to do the installation already runs Parabola, you can do it with:

# pacman -S binfmt-qemu-static
# systemctl start systemd-binfmt.service

The Building_armv7h_packages_on_a_x86_system page also have more background information on that.

Once this is done, you will be able to use as chroot, arch-chroot, and pacstrap transparently.

11 rootfs installation

You can either install the rootfs:

  • from the released tarball
  • directly with pacstrap

11.1 From the released tarball

After monting the filesystem in /mnt, extract Parabola in the rootfs partition:

$ sudo tar xpf ParabolaARM-armv7-LATEST.tar.gz -C /mnt/ --numeric-owner

Here --numeric-owner is used to make sure that everything is still fine if user and group ids differs between the tarball and the computer you're using to run the tar command above. This also enables you to run that command from another GNU/Linux distribution than Parabola (like Trisquel for instance).

11.2 With pacstrap

First we need to install arch-install-scripts to be able to use the pacstrap command

pacman -S --needed arch-install-scripts

Before installing, you may want to edit /etc/pacman.d/mirrorlist such that your preferred mirror is first. This copy of the mirrorlist will be installed on your new system by pacstrap as well, so it's worth getting it right.

Then take a fresh copy of pacman.conf for armv7h:

$ cp /usr/share/pacman/defaults/pacman.conf.armv7h /mnt/pacman.conf

Make sure the pacman keyring has been initialized

# pacman-key --init

Import, trust and install the archlinuxarm keyring. When possible, Parabola leverages free packages that originally came from Arch ARM.

# pacman -S --needed archlinuxarm-keyring

Install the base system using pacstrap:

# pacstrap -C /mnt/pacman.conf /mnt/ base

You can install additional packages passing base and the names of these packages as arguments after the root directory of the new installation (all packages from the base group are installed if no package is specified).

Note:

To use OpenRC instead of systemd, run the following command (instead of # pacstrap /mnt):

# pacstrap -C /mnt/pacman.conf /mnt base-openrc
Warning: Some of the installation steps, such as setting the hostname and keymap, will be different. Please refer to the OpenRC page.

If you have a btrfs root, you probably want to install also btrfs-progs.

Note:

If you face GPG errors when running # pacstrap /mnt, you can try to fix them with:

# pacman -Sfy archlinux-keyring

Generate an fstab with the following command (if you prefer to use UUIDs or labels, add the -U or -L option, respectively):

# genfstab -p /mnt >> /mnt/etc/fstab

Next we chroot into our newly installed system:

# arch-chroot /mnt

12 Configure the system

  • Write your hostname to /etc/hostname
  • Symlink /etc/localtime to /usr/share/zoneinfo/Zone/SubZone. Replace Zone and Subzone to your liking. For example:
# ln -s /usr/share/zoneinfo/Europe/Athens /etc/localtime
  • Set locale preferences in /etc/locale.conf
  • Add console keymap and font preferences in /etc/vconsole.conf
  • Uncomment the selected locale in /etc/locale.gen and generate it with locale-gen
  • Configure /etc/mkinitcpio.conf as needed (see mkinitcpio) and create an initial RAM disk with:
# mkinitcpio -p linux-libre

Add your user to the relevant group such as:

# gpasswd -a YourActualUserName video
Note: You can visit Beginners' Guide#Chroot and configure the base system to learn about further configuration options.

13 Change or set the root password

The current release tarball has a password set, so if you use it, you will need to change the root password, else you won't be able to log into the installation. This step will probably be un-necessary in future tarball releases.

If you don't use the release tarball, you might also want to set a root password.

Setting or changing the root password be done by running the passwd command inside the chroot.

14 Installing the bootloader

14.1 Bootloader provided by parabola

Parabola provides bootloaders for many devices. If parabola has one for your ARM computer, you can simply chroot and install it:

# arch-chroot /mnt
# pacman -S uboot4extlinux-a20-olinuxino-lime2
resolving dependencies...
looking for conflicting packages...

Packages (1) uboot4extlinux-a20-olinuxino-lime2-2017.01-1.1

Total Download Size:   0.20 MiB
Total Installed Size:  0.53 MiB

:: Proceed with installation? [Y/n] 
[...]

However merely installing the package isn't sufficent to make the device boot from that bootloader. You then need to put the bootloader in a special location so it's picked up by the hardware. At the end of the package installation, you will be asked if you want to do that:

A new U-Boot version needs to be flashed onto /dev/mmcblk0.
Do you want to do this now? [y|N]

Double check that /dev/mmcblk0 correspond to the storage device you're installing Parabola on and not the install computer storage or something else.

If it matches and that you say yes, it will install it:

526+1 records in
526+1 records out
539287 bytes (539 kB, 527 KiB) copied, 0.165519 s, 3.3 MB/s
==> WARNING: Remember to set up your kernels in /boot/extlinux/extlinux.conf

As the warning says, you will also need to edit /boot/extlinux/extlinux.conf to make it boot.

Several bootloaders are available in Parabola.

14.1.1 U-Boot4Extlinux
Note: uboot4extlinux-am335x_bone is available from [libre] since it's reported to work reliably on coadde's Beaglebone Black. For other uboot4extlinux packages we need more ARMv7 boards for porting and testing before moving them to [libre].

Extlinux is one of the many spinoffs of Syslinux -- the bootloader used for live CDs and many other applications. It's not as commonly used as a bootloader for desktops and laptops, but it's perfectly capable of that and U-Boot supports it. This allows for interactive multi-boot and multiple kernels. uboot4extlinux packages are under development yet for U-Boot with Extlinux support. At the moment, we have some packages for testing and debugging from [libre-testing].

Note: If you wish to use this repo add the following lines to /etc/pacman.conf:
[libre-testing]
Include = /etc/pacman.d/mirrorlist
14.1.2 U-Boot
Warning: Standalone uboot packages only work for a single kernel: linux-libre. If you use other or multiples kernels you should look for one of #U-Boot4Extlinux or #U-Boot4GRUB instead.

Installing the appropriate U-Boot package will copy the bootloader to your storage device's boot sector. Manual intervention shouldn't be necessary.

Once installed, you will need to run the following command to configure it:

# cd /boot && ./mkscr
14.1.3 U-Boot4GRUB

uboot4grub packages are under development yet for U-Boot with GRUB support. At the moment, we have some packages for testing and debugging from [libre-testing].

Note: If you wish to use this repo add the following lines to /etc/pacman.conf:
[libre-testing]
Include = /etc/pacman.d/mirrorlist
14.1.4 GRUB

grub claims some support for ARMv7 machines with EFI support (GRUB#UEFI_systems). Parabola hackers are investigating using this.

Note: By default grub is built for systems which have RAM at address 0x08000000. However SBC boards which we are targeting have RAM starting from different values (eg. BeagleBone and BeagleBone Black are 0x82000000) so we need to adjust GRUB_KERNEL_ARM_UBOOT_LINK_ADDR to make sure it matches U-Boot load_addr. Therefore, we are creating grub packages with specific suffix for it (eg. grub-am335x_bone for BeagleBone and BeagleBone Black)


14.1.5 Which bootloader package to use for which device?

Here's a list of devices with their corresponding bootloaders packages:

Computer(s) (vendor, product) Bootloader(s) packages Bootrom constraints
Banana Pi
  • BeagleBoard
  • BeagleBoard-xM
uboot-omap3_beagle
  • A separate /boot FAT partition is required for the bootloader
  • BeagleBone
  • BeagleBone Black
uboot-am335x_bone
Olimex A20 OLinuXino Lime uboot4extlinux-a20-olinuxino-lime
Olimex A20 OLinuXino Lime2 uboot4extlinux-a20-olinuxino-lime2

There are many more devices supported, a quick search in Parabola's packages shows many more bootloaders

14.1.6 Bootloader configurations

Our kernel images use custom names (eg. /boot/vmlinuz-linux-libre-grsec) to allow for various kernels to coexist via a multi-boot bootloader like GRUB or Extlinux. You really need to verify that your bootloader is configured to look for the right kernel name.

Note: We don't have uImage packages available in Parabola since we are adapting our kernels for GRUB and Extlinux compatibility. However, if you won't use them, we suggest you use our script to create a new one based on the kernel that you want.

Also remember to configure the bootloader to use an initramfs if you use any stacked block devices like LVM, LUKS, or RAID.

For instance for extlinux, it can be done by adding an initrd line, which would meake an entry look like that:

label Parabola GNU/Linux-libre, linux-libre kernel
	kernel /boot/vmlinuz-linux-libre
	initrd /boot/initramfs-linux-libre.img
	append console=ttyS0,115200n8 quiet rw root=/dev/mapper/vg-rootfs
	fdtdir /boot/dtbs/linux-libre/

14.2 Bootloader not provided by parabola

14.2.1 Barebox
14.2.2 Already present: Goldelico GTA04

The GTA04 typically has its bootloader in NAND. So there is no need to install a bootloader, however we might need to adjust the boot parameters/cmdline given to the kernel and the uboot environment to fit your partioning scheme. It is strongly advised to have a serial console working to do that as otherwise you won't be able to see why the device is not booting. Its uboot also expects an uImage in /boot/uImage. It can be created like that:

# pacman -S --needed uboot-tools
# cat /boot/vmlinuz-linux-libre /boot/dtbs/linux-libre/omap3-gta04a3.dtb > /tmp/zImage.dtb
# mkimage -A arm -O linux -T kernel -C none -a 0x82000000 -e 0x82000000 -d /tmp/zImage.dtb /boot/uImage

15 Unmount and reboot

If you are still in the chroot environment type exit or press Ctrl+D in order to exit. Earlier we mounted the partitions under /mnt. In this step we will unmount them:

# umount /mnt/{boot,home,}

Now you can boot the ARM computer and then login with the root account.

16 Configure pacman

Edit /etc/pacman.conf and configure pacman's options, also enabling the repositories you need.

See Pacman and Official Repositories for details.

Also consider using Pacman2pacman, a peer to peer package system, in order to reduce load on official Parabola servers.

17 Update the system

At this point you should update your system.

See Upgrading packages for instructions.

18 Add a user

Finally, add a normal user as described in User management.

19 Service management

Parabola GNU/Linux-libre uses a:systemd as init, which is a system and service manager for Linux. For maintaining your Parabola GNU/Linux-libre installation, it is a good idea to learn the basics about it. Interaction with systemd is done through the systemctl command. Read a:systemd#Basic systemctl usage for more information.

20 Conclusion

Your new Parabola GNU/Linux-libre base system is now a functional GNU/Linux environment.

You can now continue here.

21 See also

22 Troubleshooting

22.1 Mkinitcpio

22.1.1 WARNING: No modules were added to the image. This is probably not what you want.

If when creating the initramfs image with mkinitcpio, you get the message

==> WARNING: No modules were added to the image. This is probably not what you want.

Just ignore, you should be able to boot anyways.

22.1.2 ERROR: kernel version extraction from image not supported for `armv7' architecture

If when running mkinitcpio you get the message

ERROR: kernel version extraction from image not supported for `armv7' architecture

Or similar (like armv7h, armv7l, etc) edit /bin/mkinitcpio and where it says $arch leave it as

if [[ $arch != @(i?86|x86_64|armv7?) ]]; then
    error "kernel version extraction from image not supported for \`%s' architecture" "$arch"
22.1.3 ERROR: invalid kernel specified: '/boot/vmlinuz-linux-libre'

In this case edit /etc/mkinitcpio.d/linux-libre-xxx.preset and where it says ALL_kver="/boot/vmlinuz-linux-libre-xxx" change /boot/vmlinuz-linux-libre-xxx with the kernel release, which should be the output of uname -r, if you are using that kernel. You can see them with

$ ls /lib/modules
Note: The xxx stands for the kernel special name.

22.2 Iceweasel

22.2.1 Error code: NS_ERROR_NET_INADEQUATE_SECURITY

If some websites give you this error on Iceweasel (an probably on Icecat) with a message like:

Your connection is not secure

The website tried to negotiate an inadequate level of security.

www.example.com uses security technology that is outdated and vulnerable to attack. An attacker could easily reveal information which you thought to be safe.   The website administrator will need to fix the server first before you can visit the site.

Error code: NS_ERROR_NET_INADEQUATE_SECURITY

Then open a new tab and write about:config, then search spd and disable network.http.spdy.enabled

23 Acknowledgement

This wiki article is based on the Installation Guide which is itself based on the ArchWiki, with non-FSDG bits that may have been removed from it.