Skip to content

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

Notifications You must be signed in to change notification settings

RoEdAl/alarm-uboot-sunxi-armv7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Supported boards:

Board U-Boot package WiFi package(s) Bootlog
OrangePi Zero uboot-orangepi-zero xradio-dkms, xradio-firmware here
OrangePi One uboot-orangepi-one N/A here
OrangePi R1 uboot-orangepi-r1 [TODO] here
NanoPi Neo uboot-nanopi-neo N/A here
ZeroPi uboot-zeropi N/A
A10 oLinuXino Lime uboot-a10-olinuxino-lime-dt N/A here
A20 oLinuXino Lime uboot-a20-olinuxino-lime-dt N/A here
BananaPi M2 Zero uboot-bananapi-m2-zero ap6212-wifi-firmware here

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

All bootloaders requires Linux kernel version >=4.15.0.


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, delete old partitions and create a new one:
    1. Type o. This will clear out any partitions on the drive.
    2. Type p to list partitions. There should be no partitions left.
    3. Now type n, then p for primary, 1 for the first partition on the drive, 2048 for the first sector, and then press ENTER to accept the default last sector.
    4. 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-armv7-latest.tar.gz
    bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C root
    sync
    
  7. Download download appropriate U-Boot package from releases.
    wget https://github.com/RoEdAl/alarm-uboot-sunxi-armv7/releases/download/vyyy.mm-r/uboot-<your board name>-yyyy.mm-r-armv7h.pkg.tar.xz
    
  8. Extract required U-Boot binary and compiled script from package:
    bsdtar -xf uboot-<your board name>-yyyy.mm-r-armv7h.pkg.tar.xz boot/u-boot-sunxi-with-spl.bin boot/boot.scr
    
  9. Install the U-Boot bootloader:
    mv boot/boot.scr root/boot
    umount root
    dd if=boot/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
    
  10. Insert the micro SD card into the board, connect ethernet, and apply 5V power.
  11. 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.
  12. 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
    
  13. Install U-Boot package:
    wget https://github.com/RoEdAl/alarm-uboot-sunxi-armv7/releases/download/vx-y/uboot-<your board name>-yyyy.mm-r-armv7h.pkg.tar.xz
    pacman -U uboot-<your board name>-yyyy.mm-r-armv7h.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, delete old partitions and create a new one:
    1. Type o. This will clear out any partitions on the drive.
    2. Type p to list partitions. There should be no partitions left.
    3. Type n, then p for primary, 1 for the first partition on the drive, 2048 for the first sector, and then type +256M for the last sector.
    4. Now type n, then p for primary, 2 for the first partition on the drive and then press ENTER twice to accept the default first and last sector.
    5. Write the partition table and exit by typing w.
  4. Create the boot filesystem:
    mkfs.ext4 /dev/sdX1
    
  5. Mount the boot filesystem:
    mkdir boot
    mount /dev/sdX1 boot
    
  6. Create the root filesystem:
    mkfs.f2fs /dev/sdX2
    
  7. Mount the boot filesystem:
    mkdir root
    mount /dev/sdX2 root
    
  8. 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 root
    sync
    
  9. Move boot files to the first partition:
    mv root/boot/* boot
    
  10. Download download appropriate U-Boot package from releases.
    wget https://github.com/RoEdAl/alarm-uboot-sunxi-armv7/releases/download/vyyy.mm-r/uboot-<your board name>-yyyy.mm-r-armv7h.pkg.tar.xz
    
  11. Extract required U-Boot binary and compiled script from package:
    bsdtar -xf uboot-<your board name>-yyyy.mm-r-armv7h.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=1024 seek=8
    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-armv7/releases/download/vx-y/uboot-<your board name>-yyyy.mm-r-armv7h.pkg.tar.xz
    pacman -U uboot-<your board name>-yyyy.mm-r-armv7h.pkg.tar.xz
    
  21. Install f2fs-tools package and rebuild initcpio:
    pacman -Syu f2fs-tools
    mkinitcpio -p linux-armv7
    

Build issues:

  • Due to git-apply behaviour packages must be built outside a git repository - specify BUILDDIR in ~/.makepkg.conf file.

About

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

Resources

Stars

Watchers

Forks

Languages