Mini PC how to write OpenWRT to NVMe?

I'm considering the unit listed below. I'm assuming initially you would write OpenWRT to a bootable USB, and boot from it. However, in what way do you write OpenWRT from the USB to the NVMe after it boots?

I'm thinking of ordering 4GB ddr4 and 128GB NVMe from Amazon as both are fairly cheap there.

$71.91 38%OFF | XCY Firewall Appliance Mini PC Intel Celeron J4125 Quad-Cores 4x LAN 2.5G i225V Network Card Soft Router Pfsense OPNsense


By using any OS (any linux is probably easier, including OpenWrt itself - but e.g. a Debian-, Fedora, OpenSuSE, Ubuntu, ${INSERT_YOUR_FAVOURITE_GENERAL_PURPOSE_LIVE_LINUX_DISTRIBUTION_HERE} might be more convenient) to write the very same image to the raw SSD (e.g. /dev/nvme0n1).

Disclaimer: I have not booted OpenWrt from NVME yet, there may -or may not- be some implications from that, as NVME behaves a little different compared to 'normal' storage devices based on the traditional SCSI storage layer. Given the way OpenWrt is set up, I wouldn't necessarily expect issues with this (the image based/ removable media path approach probably bypasses some of the finer details that would be necessary to keep track of otherwise).

1 Like

I hadn't thought of that. Basically, what you are saying is:

1.) Boot from USB with something like Ubuntu with the OpenWRT image stored on the USB drive.

2.) Use something such as dd to write the image to NVMe.

3.) Change bios to boot from NVMe.

Or would ssd be a better choice?

  1. yes
  2. cat firmware.bin >/dev/xxx
  3. I'm not saying that, I just have limited personal experiences with NVMe myself (and there are a few gotchas), but I do expect this combination to work (albeit probably more by accident, than conscious design)

For context, I presently have an Xunlong Orange Pi R1 Plus for the past 3 years has been rock stable. However, I find sdcards to wear with constant read/write, and I was considering upgrading to a 2.5Gbps network. I already have a 2.5Gbps switch, and have six CAT6 runs in my home. I'm wondering if I can alter this script slightly (which works fine for my current device) to do the same after booting from Ubuntu USB boot, and running the script to create the OpenWRT image, and write to nmv or ssd.

I've been using this script:


#Download image Tool

#Extract Tool
tar -J -x -f openwrt-imagebuilder-*.tar.xz
cd openwrt-imagebuilder-rockchip-armv8.Linux-x86_64

#Resize Partitions

#Build OpenWRT
make clean
make image RELEASE="23.05.2" PROFILE="xunlong_orangepi-r1-plus" PACKAGES="luci luci-app-adblock luci-app-adblock-fast luci-app-commands luci-app-ddns luci-app-diag-core luci-app-firewall luci-app-nlbwmon luci-app-ntpc luci-app-opkg luci-app-samba4 luci-app-softether luci-app-statistics luci-app-unbound luci-app-upnp luci-app-vnstat luci-app-watchcat luci-app-wireguard blkid bmon htop ifstat iftop iperf3 iwinfo lsblk lscpu lsblk fdisk losetup resize2fs nano rsync rtorrent tcpdump adblock arp-scan blkid bmon kmod-usb-storage kmod-usb-storage-uas rsync kmod-fs-exfat kmod-fs-ext4 kmod-fs-ksmbd kmod-fs-nfs kmod-fs-nfs-common kmod-fs-nfs-v3 kmod-fs-nfs-v4 kmod-fs-ntfs luci-app-diag-core block-mount ppp kmod-pppoe ppp-mod-pppoe luci-proto-ppp luci-proto-pppossh pppoe-discovery kmod-pppoa comgt ppp-mod-pppoa rp-pppoe-common luci-proto-ipv6 luci-proto-wireguard" DISABLED_SERVICES="adblock banip gpio_switch lm-sensors softethervpnclient"

**A 2nd script writes the image:**
sudo dd if=openwrt-x64-armv8-xunlong_x64-ext4-sysupgrade.img of=/dev/sde status=progress bs=4M

You can do the very same for x86_64.

1 Like