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 <unicorn@regrow.earth>
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
install.sh Change advised partsize to min. 200MiB 2023-01-14 19:06:42 +01:00

README

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 unicorn-spam@regrow.earth (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.

Dependencies:
=============
* 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.

Synopsis:
=========
  ./install.sh [-chv] [-d DEVICE] [-e value] [-p PARTSTR] [-r REVISION]

Options:
========
 -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

Examples:
=========
Completely interactive:
    ./install.sh

Completely interactive without making changes, returns a template with all the chosen options:
    ./install.sh -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.
    ./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[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.

[1] https://alpinelinux.org/
[2] https://github.com/alpinelinux/alpine-chroot-install/
[3] https://www.denx.de/wiki/U-Boot
[4] https://linux-sunxi.org/Olimex_A20-OLinuXino-Lime2
[4] https://web.archive.org/web/20221201110322/https://linux-sunxi.org/Olimex_A20-OLinuXino-Lime2