SD card

Installation can be done via SD card.

Linux :

  1. Download the correct image for your device. Probably named similar to openwrt-*-sysupgrade.img.gz.
  2. Decompress it:
    gzip -d openwrt-*-sysupgrade.img.gz
  3. Connect sd card to your computer and look at lsblk or dmesg to identify it. In most cases, it would be something like /dev/sdX. 1)
  4. Double check that you have identified your sd card correctly. If the /dev/sdX you have chosen, corresponds to your harddrive, the next step would destroy your system
  5. copy the image to the sd card with:
    dd if=openwrt-*-sysupgrade.img of=/dev/sdX

Other OS :

https://www.balena.io/etcher/ - free open source program to flash SD cards on Windows, Linux, or macOS

  1. Download the correct image for your device. Probably named similar to openwrt-*-sysupgrade.img.gz.
  2. Select the image.
  3. Select your SD card.
  4. Flash the image.

Examples:

Often a device has multiple images available which differ in the filesystem used.

ext4-sdcard.img.gz

  • not optimized for flash memory (journaling increases flash wear)
  • sd card can be easily mounted externally for modification
  • updates and changes can be made directly to the partition
  • Linux desktop standard

squashfs-sdcard.img.gz

  • compressed
  • newer images include a hidden f2fs filesystem, which is optimized for flash memory
  • needs special mount procedure to externally modify
  • all changes are done in an overlay partition
  • due to overlay partition it is simple to reset system to defaults
other images
  • ubifs-sdcard.img.gz

If you insert your newly flashed SD card into a Linux machine, it will be easy to mount the read only squashfs partition but it won't know about the overlay, which is not even in the partition table but instead located immediately after the squashfs filesystem in the same partition. You therefore need to mount the overlay as a loopback device. You can discover the offset by running losetup on the device, or calculate the offset yourself by inspecting the filesystem.

# Setup the loop back device.
# See libfstools/rootdisk.c for source of partition offset logic.
DEVICE= ### Set this appropriately - e.g. /dev/sda
PARTITION="$DEVICE"2
FS_SIZE="$(sudo unsquashfs -s "$PARTITION" | grep -o 'Filesystem size [0-9]* bytes' | grep -o '[0-9][0-9]*')"
FS_OFFSET="$(expr '(' "$FS_SIZE" + 65535 ')' / 65536 '*' 65536)" 
LOOP_DEVICE="$(sudo losetup -f --show -o "$FS_OFFSET" "$PARTITION")"

# Now mount both partitions (remember, you may need to unmount any automatic mounts)
mkdir -p /mnt/base /mnt/overlay /mnt/combined
sudo mount "$PARTITION" /mnt/base            
sudo mount "$LOOP_DEVICE" /mnt/overlay
sudo mount -o noatime,lowerdir=/mnt/base,upperdir=/mnt/overlay/upper,workdir=/mnt/overlay/work -t overlay overlayfs /mnt/combined

This should leave you with a writable filesystem in /mnt/combined which will work as it does on OpenWRT.

To use the whole available space of your sdcard, you probably have to resize your partition.

squashfs image

As with mounting the overlay above, to resize it you'll need the offset of the hidden f2fs or ext4 filesystem (depending on the size of your image, one or the other will be used).

First, make sure the partition is not mounted, then do something like:

DEVICE= ### Set this appropriately - e.g. /dev/sda
PARTITION="$DEVICE"2
sudo cfdisk "$DEVICE"  # select resize, then write

# Create a loop device pointing to the FS
# See libfstools/rootdisk.c for source of partition offset logic.
FS_SIZE="$(sudo unsquashfs -s "$PARTITION" | grep -o 'Filesystem size [0-9]* bytes' | grep -o '[0-9][0-9]*')"
FS_OFFSET="$(expr '(' "$FS_SIZE" + 65535 ')' / 65536 '*' 65536)" 
LOOP_DEVICE="$(sudo losetup -f --show -o "$FS_OFFSET" "$PARTITION")"

# Now, resize... you may need to fsck first, though.
sudo fsck "$LOOP_DEVICE"
sudo resize2fs "$LOOP_DEVICE"

ext4 image

You can use gparted to resize and extend the partitions. To do it online, follow the procedure in link or link.

Example, to resize /dev/mmcblk0p2 mounted on /, install parted, tune2fs and resize2fs then:

parted
p
resizepart 2 32GB
q

Next, you may need to repair your device (perhaps say yes to all interactive queries):

mount -o remount,ro /                  #Remount root as Read Only
tune2fs -O^resize_inode /dev/mmcblk0p2    #Remove reserved GDT blocks
fsck.ext4 /dev/mmcblk0p2                  #Fix part, answer yes to remove GDT blocks remnants

Now, reboot and then resize the partition:

resize2fs /dev/mmcblk0p2

Examples:

Howto:

  1. Partition and format the SD card. Details devicespecific? → Devicepage
  2. Copy bootloader, kernel, rootfs (and if necessary other data) to SD card. Details devicespecific? → Devicepage
  3. Possibly resize filesystem in order to use the complete available space on the SD card
  4. ...
BrandModelVersionSupported Current RelInstallation method(s)Comment installationDevice PageDevice Techdata
FriendlyARMNanoPi NEO Core222.03.5SD card, Sysupgrade, U-Boot USB recoverySimilar to install method for Raspberry Pinanopi_neo_core2View/Edit data
FriendlyARMNanoPi NEO Plus222.03.5SD card, Sunxi installationSimilar to install method for Raspberry Pinanopi_neo_plus2View/Edit data
FriendlyARMNanoPi R122.03.5SD card, see git-commit, Sunxi installationView/Edit data
FriendlyARMNanoPi R2Sv122.03.5SD cardwrite image to microSD/TFnanopi_r2sView/Edit data
FriendlyARMNanoPi R4S22.03.5SD cardflash image to SD cardnanopi_r4s_v1View/Edit data
FriendlyARMZeroPi22.03.5SD card, see git-commit, Sunxi installationView/Edit data
FriendlyARMNanoPi R5Sexternal imageSD cardSDcard and eMMC images available on FriendlyElecnanopi_r5sView/Edit data
FriendlyARMNanoPi R6Sexternal imageSD cardSDcard and eMMC images available on FriendlyElecView/Edit data
KobolHelios422.03.5SD card, see git-commitView/Edit data
Libre ComputerALL-H3-CC H522.03.5SD card, see git-commit, Sunxi installationView/Edit data
MarvellDB-88F3720-DDR322.03.5SD card, see git-commitView/Edit data
MarvellMACCHIATObin Single Shot22.03.5SD card, see git-commitmarvell_macchiatobinView/Edit data
MicrochipSAMA5D4 Xplained Ultra22.03.5SD cardView/Edit data
MicrochipSAMA5D2 Xplained Ultra22.03.5SD cardView/Edit data
NXPLS1088A-RDB18.06.4SD card, U-Boot TFTP recoverytest image on non default boot drivels1088a-rdbView/Edit data
NXPLS1021A-IOT22.03.5SD cardView/Edit data
OlimexiMX233-OLinuXino-MINI15.05SD card, see devicepageimx233-olinuxinoView/Edit data
OlimexiMX233-OLinuXino-MINI-WiFi15.05SD card, see devicepageimx233-olinuxinoView/Edit data
OlimexiMX233-OLinuXino-NANO15.05SD card, see devicepageimx233-olinuxinoView/Edit data
OlimexiMX233-OLinuXino-MAXI15.05SD card, see devicepageimx233-olinuxinoView/Edit data
OlimexiMX233-OLinuXino-MICRO15.05SD card, see devicepageimx233-olinuxinoView/Edit data
PC EnginesAPU1C22.03.5SD card, see devicepageapuView/Edit data
PC EnginesAPU2C422.03.5SD card, see devicepageapu2View/Edit data
PC EnginesAPU3C422.03.5SD card, see devicepageapu3View/Edit data
PC EnginesAPU3C222.03.5SD card, see devicepageapu3View/Edit data
 

1)
You want to specify the device and not the partition, meaning, you have to use /dev/sdX and not /dev/sdX1
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2023/03/31 01:59
  • by wryun