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 firstname.lastname@example.org (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.
* e2fsprogs (for mkfs.ext4)
* 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.
./install.sh [-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 without making changes, returns a template with all the chosen options:
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.
./install.sh -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, alpine-chroot-install, U-Boot and some U-Boot configuration information from the Linux Sunxi wiki. Please check the links below regarding their respective licenses.