Skip to content

U-Boot bootloaders for Allwinner-based boards [Arch Linux ARM, 64-bit]

Notifications You must be signed in to change notification settings

RoEdAl/alarm-uboot-sunxi-aarch64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arch Linux ARM - U-Boot bootloaders for Allwinner-based boards [64-bit]

Supported devices

Board U-Boot package WiFi package(s) Bootlog
OrangePi Zero Plus uboot-orangepi-zero rtl8189fs-dkms here
OrangePi PC2 uboot-orangepi-pc2 N/A here
NanoPi Neo2 uboot-nanopi-neo2 N/A here 1G

Theese bootloaders are ready to apply additional DT overlays from Armbian's Device Tree overlays for sunxi devices. See this repository for more info.

SD Card preparation

Classic way

Replace sdX in the following instructions with the device name for the SD card as it appears on your computer.

  1. Zero the beginning of the SD card:
    dd if=/dev/zero of=/dev/sdX bs=1M count=8
    
  2. Start fdisk to partition the SD card:
    fdisk /dev/sdX
    
  3. At the fdisk prompt, create the new partition:
    • Type o. This will clear out any partitions on the drive.
    • Type p to list partitions. There should be no partitions left.
    • Type n, then p for primary, 1 for the first partition on the drive, 4096 for the first sector, and then press ENTER to accept the default last sector.
    • Write the partition table and exit by typing w.
  4. Create the ext4 filesystem:
    mkfs.ext4 /dev/sdX1
    
  5. Mount the filesystem:
    mkdir root
    mount /dev/sdX1 root
    
  6. Download and extract the root filesystem:
    wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
    bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C root
    
  7. Download appropriate U-Boot package from releases:
    wget https://github.com/RoEdAl/alarm-uboot-sunxi-aarch64/releases/download/vyyy.mm-r/uboot-<your board name>-yyyy.mm-r-aarch64.pkg.tar.xz
    
  8. Extract required U-Boot binary and compiled script from package:
    bsdtar -xf uboot-<your board name>-yyyy.mm-r-aarch64.pkg.tar.xz boot/u-boot-sunxi-with-spl.bin boot/boot.scr
    
  9. Install the U-Boot bootloader:
    dd if=boot/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=8k seek=1
    cp boot/boot.scr root/boot
    sync
    
  10. Umount the partition:
    umount root   
    
  11. Insert the micro SD card into the board, connect ethernet, and apply 5V power.
  12. 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.
  13. After logging into the system initialize the pacman keyring and populate the Arch Linux ARM package signing keys:
    pacman-key --init
    pacman-key --populate archlinuxarm
    
  14. Install U-Boot package:
    wget https://github.com/RoEdAl/alarm-uboot-sunxi-aarch64/releases/download/vx-y/uboot-<your board name>-yyyy.mm-r-aarch64.pkg.tar.xz
    pacman -U uboot-<your board name>-yyyy.mm-r-aarch64.pkg.tar.xz
    

Separate boot (ext4) and root (f2fs) partitions

Replace sdX in the following instructions with the device name for the SD card as it appears on your computer.

  1. Zero the beginning of the SD card:
    dd if=/dev/zero of=/dev/sdX bs=1M count=8
    
  2. Start fdisk to partition the SD card:
    fdisk /dev/sdX
    
  3. At the fdisk prompt, create the new partition:
    • Type o. This will clear out any partitions on the drive.
    • Type p to list partitions. There should be no partitions left.
    • Type n, then p for primary, 1 for the first partition on the drive, 4096 for the first sector, and then type +256M for the last sector.
    • Type n, then p for primary, 2 for the second partition on the drive, 528384 for the first sector, and then press ENTER to accept the default last sector.
    • Write the partition table and exit by typing w.
  4. Create the boot filesystem:
    mkfs.ext4 /dev/sdX1 -O ^has_journal,^ext_attr,^huge_file -m 0
    
  5. Mount the filesystem:
    mkdir boot
    mount /dev/sdX1 boot
    
  6. Create the root filesystem:
    mkfs.f2fs /dev/sdX2
    
  7. Mount the filesystem:
    mkdir root
    mount /dev/sdX2 root
    
  8. Download and extract the root filesystem:
    wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
    bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C root
    
  9. Move boot files to the first partition
    mv root/boot/* boot
    
  10. Download appropriate U-Boot package from releases:
    wget https://github.com/RoEdAl/alarm-uboot-sunxi-aarch64/releases/download/vyyy.mm-r/uboot-<your board name>-yyyy.mm-r-aarch64.pkg.tar.xz
    
  11. Extract required U-Boot binary and compiled script from package:
    bsdtar -xf uboot-<your board name>-yyyy.mm-r-aarch64.pkg.tar.xz boot/u-boot-sunxi-with-spl.bin boot/boot.scr
    
  12. Install the U-Boot bootloader:
    dd if=boot/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=8k seek=1
    sync
    rm boot/u-boot-sunxi-with-spl.bin
    
  13. Inform bootloader that root filestystem is on second partition:
    touch boot/root-is-on-2nd-partition
    
  14. Add fstab entry to mount boot partition:
    echo '/dev/mmcblk0p1 /boot ext4 defaults 0 2' >> root/etc/fstab
    
  15. Optionally configure systemd-journald service to store log data only in memory:
    mkdir -p root/usr/lib/systemd/journald.conf.d
    echo '[Journal]' > root/usr/lib/systemd/journald.conf.d/storage-volatile.conf
    echo 'Storage=volatile' >> root/usr/lib/systemd/journald.conf.d/storage-volatile.conf
    
  16. Umount the partitions:
    umount root boot  
    
  17. Insert the micro SD card into the board, connect ethernet, and apply 5V power.
  18. 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.
  19. After logging into the system initialize the pacman keyring and populate the Arch Linux ARM package signing keys:
    pacman-key --init
    pacman-key --populate archlinuxarm
    
  20. Install U-Boot package:
    wget https://github.com/RoEdAl/alarm-uboot-sunxi-aarch64/releases/download/vx-y/uboot-<your board name>-yyyy.mm-r-aarch64.pkg.tar.xz
    pacman -U uboot-<your board name>-yyyy.mm-r-aarch64.pkg.tar.xz
    
  21. Install f2fs-tools package and rebuild initcpio:
    pacman -Syu f2fs-tools
    mkinitcpio -p linux-aarch64
    
  22. Change root filesystem mount flags (optional):
    • Edit /boot/boot.txt U-Boot script and add following option to bootargs environment variable:
      rootflags=nodiscard,relatime,lazytime,background_gc=sync
      
    • Compile modified script and reboot:
      cd /boot
      ./mkscr
      reboot
      

Build issues

  • uboot-* packages: Due to git-apply behaviour packages you must build uboot-* packages outside a git repository. Specify BUILDDIR in ~/.makepkg.conf file.
  • uboot-orangepi-pc2 package: HDMI port is not initialized - no HDMI output HDMI initialization was added in kernel 4.17.

About

U-Boot bootloaders for Allwinner-based boards [Arch Linux ARM, 64-bit]

Resources

Stars

Watchers

Forks

Languages