Install OpenWRT on a PC

 

1.Prepare a bootable Debian USB

Download a Finnix image from here https://www.finnix.org/

If you are using Windows, flash the image using Rufus: https://rufus.akeo.ie/ if you are using Linux, use dd. 

Connect a LAN cable to the first NIC port, insert the newly flashed USB and boot the system.

Use putty to connect to the serial port. Putty instructions for Windows are available here and for macOS here.

2. Connect to PC via SSH

By default, Rescue Mode’s Finnix environment does not accept SSH connections. 

Set the root password for the Finnix rescue environment by entering the following command:

passwd

Enter the new password for the root user.

Start the SSH server:

service ssh start

You can now connect to the server as root with the SSH client on a local computer

Make sure you have the WAN cable connected, so you have a connection to the internet.

root@1:/# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=114 time=17.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=114 time=16.3 ms

3. Flash the HDD drive with the OpenWRT image

You can now download the latest OpenWRT image from here https://downloads.openwrt.org/releases. Make sure to download x86 / 64 / generic-ext4-combined.img.gz file. 

We need an image called "generic-ext4-combined.img.gz". Make sure you get the ext4 image; otherwise, you won't be able to resize the partition and use the entire disk space.

At the time of writing, the latest image is 22.03.5, so my wget command looks like shown below.

wget https://downloads.openwrt.org/releases/22.03.5/targets/x86/64/openwrt-22.03.5-x86-64-generic-ext4-combined.img.gz 

This should go relatively quickly. Once it's downloaded, unpack it with 

gunzip openwrt-22.03.5-x86-64-generic-ext4-combined.img.gz

This should produce a file named "openwrt-22.03.5-x86-64-generic-ext4-combined.img" (without the .gz extension).

root@1:/# ll | grep openwrt
-rw-r--r--   1 root root 126353408 Apr 28 01:52 openwrt-22.03.5-x86-64-generic-ext4-combined.img

 

Once you have the image downloaded, you can flash it on the HDD with the following command:

dd if=openwrt-22.03.5-x86-64-generic-ext4-combined.img of=/dev/sda bs=4M; sync; 

Output should look similar to this:

root@1:/# dd if=openwrt-22.03.5-x86-64-generic-ext4-combined.img of=/dev/sda bs=4M; sync;
30+1 records in
30+1 records out
126353408 bytes (126 MB, 120 MiB) copied, 1.86846 s, 67.6 MB/s 

At this point, you have a bootable OpenWRT installation. 

You could power off, remove the USB and boot your PC, but should probably also complete the last step to gain access to the entire space on the HDD.

To check avalible disks use this commnds:

root@0:~# parted -l
Model: ATA WDC WD1600AAJS-6 (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  160GB  160GB  primary  ext4

Model: JetFlash Transcend 8GB (scsi)
Disk /dev/sdb: 8032MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  8032MB  8031MB  primary  fat32        boot, lba

Model: Unknown (unknown)
Disk /dev/zram0: 4162MB
Sector size (logical/physical): 4096B/4096B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system     Flags
 1      0.00B  4162MB  4162MB  linux-swap(v1)

 

root@0:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0 407.9M  1 loop /usr/lib/live/mount/rootfs/filesystem.squashfs
                                 /run/live/rootfs/filesystem.squashfs
sda      8:0    0 149.1G  0 disk
└─sda1   8:1    0   149G  0 part
sdb      8:16   1   7.5G  0 disk
└─sdb1   8:17   1   7.5G  0 part /usr/lib/live/mount/medium
                                 /run/live/medium
zram0  252:0    0   3.9G  0 disk [SWAP]


root@0:~# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root  9 Apr 29 16:30 ata-WDC_WD1600AAJS-60PSA0_WD-WCAP94237178 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 29 16:30 ata-WDC_WD1600AAJS-60PSA0_WD-WCAP94237178-part1 -> ../../sda1

lrwxrwxrwx 1 root root  9 Apr 29 16:25 usb-JetFlash_Transcend_8GB_C7E09118-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 29 16:25 usb-JetFlash_Transcend_8GB_C7E09118-0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Apr 29 16:30 wwn-0x50014ee100828280 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 29 16:30 wwn-0x50014ee100828280-part1 -> ../../sda1

root@1:~# sudo lshw -class disk
  *-disk
       description: SCSI Disk
       product: Transcend 8GB
       vendor: JetFlash
       physical id: 0.0.0
       bus info: scsi@6:0.0.0
       logical name: /dev/sdb
       version: 8.07
       serial: C
       size: 7660MiB (8032MB)
       capabilities: removable
       configuration: ansiversion=4 logicalsectorsize=512 sectorsize=512
     *-medium
          physical id: 0
          logical name: /dev/sdb
          size: 7660MiB (8032MB)
          capabilities: partitioned partitioned:dos
          configuration: signature=003844b9
  *-disk
       description: ATA Disk
       product: WDC WD1600AAJS-6
       vendor: Western Digital
       physical id: 0.0.0
       bus info: scsi@3:0.0.0
       logical name: /dev/sda
       version: 2M22
       serial: WD-WCAP94237178
       size: 149GiB (160GB)
       capabilities: partitioned partitioned:dos
       configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=aab7a21c
 


 

 

 

Links:

 

Комментарии

Популярные сообщения из этого блога

Youtube api credentials for OSMC / LibreElec (Raspberry Pi Zero W)

Raspberry Pi 3 (Volumio) и OLED дисплей 3,12 дюйма (SSD1322) - проверка работоспособности.