User:Miasma
My devices:
- Banana Pi M1+
- OPi PC x 2
- OPi Zero x 2
- OPi+2e
Unofficial tutorial for installing Arch Linux ARM on sunxi boards
Install to a micro SD card
Installing Arch Linux ARM on the sunxi boards is pretty straightforward. This tutorial assumes that you have an Arch system already installed on a x86 system.
Insert the SD card into card reader and zero the beginning of the SD card:
dd if=/dev/zero of=/dev/sdX bs=1M count=8
Then partition the SD card:
fdisk /dev/sdX
Create the filesystem (requires: e2fsprogs):
mkfs.ext4 -O ^metadata_csum,^64bit /dev/sdX1
Mount the filesystem:
mkdir mnt mount /dev/sdX1 mnt
Download and extract the root filesystem:
wget http://os.archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C mnt sync
Install the prerequisites for compiling U-boot and kernel:
pacman -S arm-none-eabi-newlib arm-none-eabi-gcc dtc base-devel git uboot-tools
Compile and install U-Boot (replace $BOARD with e.g. orangepi_pc_defconfig -- see the device pages for possible defconfigs):
git clone git://git.denx.de/u-boot.git cd u-boot git checkout -b v2016.11 # select the preferred version make $BOARD ARCH=arm CROSS_COMPILE=arm-none-eabi- KBUILD_OUTPUT=output/ dd if=output/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
Configure the bootloader:
boot.txt (mainline with initrd) | boot.txt (mainline without initrd) |
---|---|
setenv bootdelay 0 setenv bootargs console=ttyS0,115200 rootwait panic=10 root=/dev/sda1 load mmc 0:1 0x43000000 boot/${fdtfile} load mmc 0:1 0x42000000 boot/zImage load mmc 0:1 0x45000000 boot/uInitrd bootz 0x42000000 0x45000000 0x43000000 |
setenv bootdelay 0 setenv bootargs console=ttyS0,115200 rootwait panic=10 root=/dev/sda1 load mmc 0:1 0x43000000 boot/${fdtfile} load mmc 0:1 0x42000000 boot/zImage bootz 0x42000000 - 0x43000000 |
mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr cp boot.scr mnt/boot/boot.scr
Compile and install the kernel (will install dtb files for all sunxi boards, fine-tune the kernel config if you like):
Get the kernel for the board, e.g. from https://kernel.org/. We assume the downloaded kernel is version 4.8.7. tar xf linux-4.8.7.tar.xz cd linux-4.8.7 make sunxi_defconfig ARCH=arm CROSS_COMPILE=arm-none-eabi- KBUILD_OUTPUT=output/ make -j8 zImage dtbs ARCH=arm CROSS_COMPILE=arm-none-eabi- KBUILD_OUTPUT=output/ make -j8 modules_install ARCH=arm CROSS_COMPILE=arm-none-eabi- INSTALL_MOD_PATH=output2/ cp output/arch/arm/boot/?Image mnt/boot cp output/arch/arm/boot/dts/*.dtb mnt/boot
Embed the new modules into initramfs:
TODO
Install the initramfs:
mkimage -A arm -T ramdisk -C none -n uInitrd -d initramfs uInitrd cp uInitrd mnt/boot umount mnt sync
Insert the micro SD card into the board, connect ethernet, and apply 5V power. Use the serial console or SSH to the IP address given to the board by your router. Login as the default user alarm with the password alarm. The default root password is root.