Creating an OpenWRT USB Stick for Zimaboard: A Step-by-Step Guide
If you're looking to create an OpenWRT USB stick for your Zimaboard, you've come to the right place. This tutorial will guide you through the process, using a Linux environment, the 'dd' tool, and ensuring that the full disk space is utilizable.
Step 1: Setting Up the Linux Environment
Before we can begin, you need to have a Linux environment ready. Any popular distribution like Ubuntu, Debian, or CentOS will work perfectly. Ensure your system is up to date using your distribution's package manager.
Step 2: Download the OpenWRT Image
Visit the OpenWRT download page and locate the latest version for the Zimaboard. As Zimaboard uses an x86/64bit architecture, choose an image compatible with this architecture. Download the image to your Linux machine.
Step 3: Decompressing the Image
After the image has been downloaded, we need to decompress it. Navigate to the directory where the file was downloaded and use the following command:
gunzip <filename>
Replace <filename>
with the name of the file you downloaded. For instance, if you have downloaded the file 'openwrt-22.03.2-x86-64-generic-ext4-combined.img.gz', the command would be:
gunzip openwrt-22.03.2-x86-64-generic-ext4-combined.img.gz
This command will decompress the image and you'll end up with 'openwrt-22.03.2-x86-64-generic-ext4-combined.img' ready to be flashed onto your USB stick.
Step 4: Identifying Your Disk
Use the lsblk
command to display all disks connected to your system. This command will provide a list of all storage devices, making it easier to identify the one you'll be using:
lsblk
Step 5: Flashing the Disk with the OpenWRT Image
Once you've identified the correct disk, you can flash the OpenWRT image onto it using the 'dd' tool. In the command below, replace "openwrt-22.03.2-x86-64-generic-ext4-combined.img" with the filename of your OpenWRT image and "/dev/sda" with your disk identifier:
dd if=openwrt-22.03.2-x86-64-generic-ext4-combined.img of=/dev/sda bs=4M; sync;
Step 6: Resizing the Disk to Use Full Capacity
By default, OpenWRT doesn't use the full disk space. But you can adjust this by resizing the partition. First, verify your disk again with lsblk
.
Next, install the 'parted' tool, which we will use for resizing. On Debian-based distributions, you can use:
sudo apt-get install parted
Use 'parted' to print your disk layout:
parted /dev/sda print
This command will show you two partitions. The first one is used for booting, while the second one is what we want to resize. Resize the second partition to use the full available space with the command below. In this case, we're resizing it to 16GB:
parted /dev/sda resizepart 2 16G
Check your result by printing the disk layout again with parted /dev/sda print
.
Step 7: Resizing the Filesystem
The final step is to resize the filesystem. Execute the following command:
resize2fs /dev/sda2
Congratulations! You have successfully created an OpenWRT USB stick for Zimaboard that utilizes the full disk space. This USB stick can be used as a live boot device or for installing OpenWRT onto other systems.