Interactive shell script for creating a bootable Alpine Linux uSD card for the Olimex A20-OLinuXino-Lime2 SBC
Go to file
Unicorn b82a42494c Change advised partsize to min. 200MiB
Signed-off-by: Edin Taric <>
2023-01-14 19:06:42 +01:00
.gitignore Initial commit 2022-12-10 18:56:03 +01:00
README Change advised partsize to min. 200MiB 2023-01-14 19:06:42 +01:00 Change advised partsize to min. 200MiB 2023-01-14 19:06:42 +01:00


This shell script installs Alpine Linux to a storage device of your choice for use with the Olimex A20-OLinuXino-Lime2 and T2-OLinuXino-Lime2. It aims to support all revisions of the board, as well as both the eMMC/NAND and non-eMMC/NAND variants.

Unfortunately I only have an eMMC board with revision K to test, so please send me feedback if it works on your device to (without the -spam)!

Since the different revisions have their own kinks regarding ethernet, this script builds U-Boot with custom configuration options depending on which revision is picked. Since this is done in a chroot environment, it should theoretically work on any Linux distribution. Again, please let me know how it works for you.

* lsblk
* sfdisk
* e2fsprogs (for mkfs.ext4)
* wget
* some kind of root access (either run as root, or have doas or sudo installed)

If you do not specify any options while running the script, it will ask for all options interactively.

  ./ [-chv] [-d DEVICE] [-e value] [-p PARTSTR] [-r REVISION]

 -d  Install to DEVICE, where DEVICE is the full path
     of the block device (eg. /dev/mmcblk8 or /dev/sdx)
 -e  Configure eMMC/NAND support, recognized values:
       0 = off
       1 = on
 -h  Show this help
 -p  Use PARTSTR for partitioning. PARTSTR must be in a format that
     is recognized by the 'sfdisk' utility. The first partition must
     be bootable and should be at least 200 MiB in size
 -r  Configure board REVISION, recognized values for REVISION:
       0 = Rev. A-E
       1 = Rev. F-G2
       2 = Rev. H and later
 -s  Simulate, does not perform any actions and returns the parameters
     that correspond with the user input.
 -v  Enable verbose output to stderr
 -y  Confirm overwriting DEVICE without prompt

Completely interactive:

Completely interactive without making changes, returns a template with all the chosen options:
    ./ -s

Fully automatic example (run with doas/sudo to prevent it from asking while running)
This configures U-Boot with eMMC/NAND support for revision H and later and selects /dev/mmcblk9. The PARTSTR needs to be recognized by sfdisk and contain a bootable first partition. In this case, it creates a single bootable partition that takes up the whole microSD card. Note that '-y' confirms overwriting the device without an additional prompt.
    ./ -d /dev/mmcblk9 -e 1 -p ',,,*' -r 2 -y

The script was written entirely by me and is licensed with the open-source MIT license, but it takes advantage of Alpine Linux[1], alpine-chroot-install[2], U-Boot[3] and some U-Boot configuration information from the Linux Sunxi wiki[4]. Please check the links below regarding their respective licenses.