Contents

OpenWRT on Wifi Pineapple MARK VII

OpenWRT Installation

From this link we can download the OpenWRT firmware. Then we access the pineapple via SSH:

1
2
3
4
# We extract all installed packages and save the file:
opkg list-installed > installedPkgs
# With the firmware already uploaded to the pineapple, we install it with the command:
sysupgrade -n -p -v openwrt-23.05.0-ramips-mt76x8-hak5_wifi-pineapple-mk7-squashfs-sysupgrade.bin

We should wait for the firmware to finish installing; the LEDs will stop flashing and turn green.

Configuration

Once the new firmware is installed, access is through the IP: http://192.168.1.1. From the Network>Wireless section, you will only see one interface that we will use to connect the pineapple to the internet via Wi-Fi and download all the necessary packages as shown in the images:

/hardware/openwrt/pine/images/img1.png
Figure 1: Login

/hardware/openwrt/pine/images/img2.png
Figure 2: OpenWRT Information

/hardware/openwrt/pine/images/img3.png
Figure 3: Interfaces

We update the package list from the System>Software section.

Modules

We connect via SSH and install the following packages:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
mmc-utils mii-tool fdisk
block-mount e2fsprogs parted usbutils libblkid
f2fs-tools kmod-bluetooth kmod-cfg80211 kmod-crypto-aead
kmod-crypto-cmac kmod-crypto-crc32c kmod-crypto-ecb
kmod-crypto-ecdh kmod-crypto-hash kmod-crypto-kpp
kmod-crypto-manager kmod-crypto-null kmod-crypto-pcompress
kmod-ebtables kmod-fs-autofs4 kmod-fs-ext4 kmod-fs-ntfs
kmod-fs-vfat kmod-fuse kmod-gpio-button-hotplug kmod-hid
kmod-i2c-core kmod-i2c-mt7628 kmod-input-core kmod-input-evdev
kmod-ip6tables kmod-ipt-compat-xtables kmod-ipt-conntrack 
kmod-ipt-core kmod-ipt-ipmark kmod-ipt-ipopt kmod-ipt-nat
kmod-ipt-offload kmod-leds-gpio kmod-lib-crc-ccitt kmod-lib-crc16
kmod-libphy kmod-mac80211 kmod-mii kmod-mmc kmod-mt76 kmod-mt76-core
kmod-mt76-usb kmod-mt7601u kmod-mt7603 kmod-mt76x02-common
kmod-mt76x02-usb kmod-mt76x2 kmod-mt76x2-common kmod-mt76x2u 
kmod-nf-conntrack kmod-nf-conntrack6 kmod-nf-flow kmod-nf-ipt
kmod-nf-ipt6 kmod-nf-nat kmod-nf-reject kmod-nf-reject6
kmod-nls-base kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8
kmod-ppp kmod-pppoe kmod-pppox kmod-regmap-core
kmod-scsi-core kmod-sdhci kmod-sdhci-mt7620 kmod-slhc
kmod-usb-acm kmod-usb-core kmod-usb-ehci kmod-usb-net 
kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152
kmod-usb-ohci kmod-usb-storage kmod-usb2 

It is possible that some packages do not install or that they are already present, this is not a problem and they can be ignored. Finally, we restart the pineapple (very important) and then in the Network>Wireless section, we can see all the interfaces that the pineapple has:

/hardware/openwrt/pine/images/img4.png
Figure 4: All Wi-Fi interfaces

Changing Root Partition

We must identify a 1.84 Gb partition, in this case, it is /dev/mmcblk0 as shown in the image. For this, we can use the fdisk -l command:

/hardware/openwrt/pine/images/img5.png
Figure 5: /dev/mmcblk0 partition

Now we must execute the following commands which were extracted from the OpenWRT documentation and are used to utilize 2GB of internal memory. We only have to run them from a script; there is no need to change anything:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
DEVICE="/dev/mmcblk0p1" # Replace with the partition found with fdisk -l
mkfs.ext4 -L extroot ${DEVICE}
eval $(block info ${DEVICE} | grep -o -e 'UUID="\S*"')
eval $(block info | grep -o -e 'MOUNT="\S*/overlay"')
uci -q delete fstab.extroot
uci set fstab.extroot="mount"
uci set fstab.extroot.uuid="${UUID}"
uci set fstab.extroot.target="${MOUNT}"
uci commit fstab
ORIG="$(block info | sed -n -e '/MOUNT="\S*\/overlay"/s/:\s.*$//p')" 
uci -q delete fstab.rwm
uci set fstab.rwm="mount"
uci set fstab.rwm.device="${ORIG}"
uci set fstab.rwm.target="/rwm"
uci commit fstab
service fstab boot

Finally, we restart the pineapple. In the System>Software section, we will be able to see that we have more storage space.

/hardware/openwrt/pine/images/img6.png
Figure 6: Pineapple storage space

Adding a Swap File

To improve performance, we can create a file that will be used as a 250MB swap:

1
2
3
4
5
6
7
8
DIR="$(uci -q get fstab.extroot.target"
dd if=/dev/zero of=${DIR}/swap bs=1M count=250
mkswap ${DIR}/swap
uci -q delete fstab.swap
uci set fstab.swap="swap"
uci set fstab.swap.device="${DIR}/swap"
uci commit fstab
service fstab boot

Verify the state of the swap file:

1
cat /proc/swaps

Installing Additional Tools

We update the entire system:

1
opkg upgrade $(opkg list-upgradable | cut -d " " -f 1)

The following list is the packages that come in the original firmware, they can be installed together in conjunction, some may already exist or have more recent versions in the OpenWRT firmware:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
aircrack-ng
airmon-ng
at
autossh
base-files
bash
block-mount
blockd
busybox
ca-bundle
ca-certificates
cc-client
coreutils
coreutils-base64
coreutils-sleep
curl
dbus
dnsmasq
e2fsprogs
ebtables
ethtool
file
firewall
fstools
fwtool
getrandom
glib2
hcxtools
hostapd-common
hostapd-utils
ip6tables
iptables
iptables-mod-ipmark
iptables-mod-ipopt
iw
iwinfo
jshn
jsonfilter
kernel
libatomic1
libattr
libblkid1
libblobmsg-json20210516
libbz2-1.0
libc
libcbor0
libcomerr0
libcurl4
libdbus
libelf1
libevdev
libexpat
libext2fs2
libffi
libfido2-1
libgcc1
libgmp10
libgnutls
libical
libip4tc2
libip6tc2
libiwinfo-data
libiwinfo20210430
libjson-c5
libjson-script20210516
liblzma
libmagic
libmbedtls12
libncurses6
libnettle8
libnghttp2-14
libnl-core200
libnl-genl200
libnl-tiny1
libopenssl-conf
libopenssl1.1
libpcap1
libpcre
libpthread
libpython3-3.9
libreadline8
librt
libsqlite3-0
libss2
libstdcpp6
libubox20210516
libubus20210630
libuci20130104
libuclient20201210
libudev-zero
libusb-1.0-0
libustream-openssl20201210
libuuid1
libwifi
libxtables12
logd
macchanger
mk7led
msmtp
mt7601u-firmware
mtd
nano
netifd
ntfs-3g
odhcp6c
odhcpd-ipv6only
openssh-client
openssh-client-utils
openssh-keygen
openssh-server
openssh-sftp-server
openssl-util
openwrt-keyring
opkg
pineap
pineapple-ouis
pineutil
ppp
ppp-mod-pppoe
procd
procps-ng
procps-ng-free
procps-ng-kill
procps-ng-pgrep
procps-ng-pkill
procps-ng-ps
procps-ng-snice
procps-ng-top
procps-ng-uptime
procps-ng-watch
protobuf-lite
python3-base
python3-codecs
python3-email
python3-light
python3-logging
python3-openssl
python3-urllib
resetssids
sniffer
swconfig
tcpdump
terminfo
ubox
ubus
ubusd
uci
uclibcxx
uclient-fetch
urandom-seed
urngd
usbids
usbutils
usign
vim
wireless-regdb
wireless-tools
wpad
zlib

It is possible that some packages do not install, this is not a problem and can be ignored.

USB Power

Some USB devices may not be detected. This is because the power to the USB ports is disabled. To activate it:

1
echo 1 > /sys/class/gpio/usb-power/value

And that’s the last version of OpenWRT.