User Tools

Site Tools


docs:guide-user:installation:openwrt_x86

OpenWrt on x86 hardware aka PC or Servers

OpenWrt can of course run in normal PC or server hardware, and take advantage of the much more powerful hardware the x86 (Intel/AMD) architecture can offer.

Download disk images

Go here, choose the release version, then click on target and then on x86. You will see different targets.

:!: There are multiple targets for x86 OpenWrt, some are targeted at old or specific hardware and their build defaults may not be suit modern x86 hardware.

  • 64 is for modern PC hardware (anything from around 2007 onward), it is built for 64bit-capable computers and has support for modern CPU features. Choose this unless you have good reasons not to.
  • Generic is for 32-bit-only hardware (either old hardware or some Atom processors), should be i586 Linux architecture, will work on Pentium 4 and later. Use this only if your hardware can't run the 64-bit version.
  • Legacy is for very old PC hardware, pre-Pentium 4, what is called i386 in Linux architecture support. It will miss a lot of features you want/need on modern hardware like multi-core support and support for more than 1GB of RAM, but will actually run on ancient hardware while other versions will not.
  • Geode is a custom Legacy target customized for Geode SoCs, which are still in use in many (aging) networking devices, like the older Alix boards from PCEngines.

Now you will see different files offered, the following two are disk images you can download and use:

  • combined-squashfs.img.gz This disk image uses the traditional OpenWrt layout, a squashfs read-only root filesystem and a read-write partition where settings and packages you install are stored. Due to how this image is assembled, you will have only 230-ish MB of space to store additional packages and configuration, and Extroot does not work.
  • combined-ext4.img.gz This disk image uses a single read-write ext4 partition with no read-only squashfs root filesystem, which allows to enlarge the partition. Features like Failsafe Mode or Factory Reset won't be available as they need a read-only squashfs partition to function.

Hardware Support

All images support basic video output (screen text terminal), so you can connect a screen to the device's video ports and see it boot up.

No image supports keyboard and mouse so the only way to communicate is through Ethernet or through the device's serial port.

To communicate through a PC serial port you will need a “null-modem” aka “crossed” serial cable to connect the device's serial port to your PC's serial port.

To be able to connect to your device, the image must support the Ethernet hardware.

The 64bit image supports Intel and Realtek Ethernet chipsets. These are the kmods installed by default: kmod-button-hotplug kmod-e1000e kmod-e1000 kmod-r8169 kmod-igb

The Generic and Legacy images support Intel, Realtek, Via and some other ethernet chipsets. These are the kmods installed by default: kmod-3c59x kmod-e100 kmod-e1000 kmod-natsemi kmod-ne2k-pci kmod-pcnet32 kmod-8139too kmod-r8169 kmod-sis900 kmod-tg3 kmod-via-rhine kmod-via-velocity

The Geode images support Geode hardware so as long as you have a Geode-based board you should be fine.

Installation

The installation is just writing a raw disk image on a USB flash drive or USB SDcard reader with SDcard (recommended) or in a Sata hard drive or SSD from your PC, then connecting this drive to the target device and make it boot from that drive.

Installation procedure differs depending from what PC you are using to write the raw disk image from, mostly because of different tools you have to use.

WARNING: writing raw image files DELETES the content of the drive you write them on, be sure that you are not deleting anything important, and that you have selected the right drive.

Windows

If you are using a Windows PC, you will need a program to extract the raw disk image from the compressed archive you downloaded.
Then you will need to open the raw image file with a program that can write it on the drive you want to install OpenWrt on.

A good free and opensource archiver program you can use is 7zip.

A good free and opensource raw disk image writer program you can use is Win32 Disk Imager , there is also Etcher .

MacOS

Same as with Windows.

The archiver program recommended by 7zip on MacOS is Keka

A good free and opensource raw disk image writer program you can use is Etcher .

Linux

Linux users will probably know how to do this better on their own already, but I'll say it anyway.

Extract the image file from the archive. Most sane distros will let you do so by rightclick and then select “extract”, or you will have to open up your graphical archive manager and do it from there. From the terminal it is done by gzip -d openwrt-18.06.1-x86-64-combined-squashfs.img.gz.

Then write the image file you extracted to the drive you want to install OpenWrt in. Many distros include a disk image writer application already (also, “Gnome Disks” application allows you to do this). From the terminal, detect how is called (sda, sdb, sdc, etc) the drive you want by writing sudo blkid or sudo lsblk and then write the image with good old dd tool dd if=openwrt-18.06.1-x86-64-combined-squashfs.img.gz of=/dev/sdX where sdX is the name of the drive you want to write the image on.

Partition Layout

The x86 image is using the following partition layout (as seen from inside of the device):

  1. /dev/sda1 is a 16MB ext4 /boot partition where GRUB and the kernel is stored.
  2. /dev/sda2 is a 256MB partition containing the squasfs root filesystem and a read-write f2fs filesystem OR the ext4 root filesystem (depending on what image you have chosen).

Any additional space in the device is unallocated.

Resizing partitions

This is possible only if you have chosen the combined-ext4.img.gz type of image, and currently due to technical limitations you can't just resize the ext4 partition online (while it is mounted) so you will need to install OpenWrt on another drive to use it to perform the following operations. Also using a Linux system (either from a VM or actually installed in a PC) will of course work.

The ext4 filesystem can be enlarged “online” i.e. while mounted, so we can do this from OpenWrt commandline directly.

  1. Install fdisk and resize2fs
  2. use fdisk to show the partitions
  3. write down the starting sector address of /dev/sdb2 (which is the root partition)
  4. use fdsk to delete the partition 2 (which is sdb2), don't write the changes to disk yet
  5. use fdisk to create a new partition 2, choose/type the starting sector address you wrote down earlier (as by default it will try to place it somewhere else), and leave the default end sector address (this will mean the partition will now use all available space)
  6. write the partition table changes to disk. It may complain about partition signatures already present, write n to NOT remove the partition signature to proceed.
  7. write resize2fs /dev/sdb2 to enlarge the actual filesystem to fill the larger partition size.

an example fdisk operation on a 8GB flash drive

root@OpenWrt:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.32).                                                                                                                                                                                                                                                                                                                  
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 7.2 GiB, 7751073792 bytes, 15138816 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcbad8a62

Device     Boot Start    End Sectors  Size Id Type
/dev/sdb1  *      512  33279   32768   16M 83 Linux
/dev/sdb2       33792 558079  524288  256M 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (33280-15138815, default 34816): 33792
Last sector, +sectors or +size{K,M,G,T,P} (33792-15138815, default 15138815): 

Created a new partition 2 of type 'Linux' and of size 7.2 GiB.
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): w

The partition table has been altered.
Syncing disks.

Compiling your own image with larger partition size

The symbol that sets the partition size is called TARGET_ROOTFS_PARTSIZE, and can be changed by menuconfig by going in the image settings.

docs/guide-user/installation/openwrt_x86.txt · Last modified: 2018/12/23 19:55 by bobafetthotmail