OpenWrt On Raspberry 4B

For those who had pretty good Linux experience, the whole process is just a piece of cake.

According OpenWrt Official document, We know 4B is on BCM2711 Family, So we just go to the related folder to download the OS image.

Copy this image to a Linux machine(Physical or virtual), if virtual, make sure the USB mounted to the virtual machine, run fdisk -l to know the /dev/sdX, where X could be a,b,c etc. Then dd the img to SD card.
# dd if=openwrt-brcm2708-bcm2711-rpi-4-ext4-sysupgrade.img of=/dev/sdb bs=2M conv=fsync

Before we eject the SD card, we may can mount to check and change some file if want.
# mount /dev/sdb2 /mnt; mount /dev/sdb1 /mnt/boot
# vim /mnt/etc/config/network
Change the IP address to your own VLAN’s IP. So you don’t need to change your PC network to change with uci command later.

Now put the SD card into RaspBerry, it should be able to boot up, and run a cable for it, you should now ssh roo@192.168.x.y into your Pi.

For the first time, it will not be connected to Internet, if you don’t have default gateway setup and resolver setup. So we just run:
# route add default gw 192.168.x.1
# vim /etc/resolv.conf
add your current nameserver at this moment, it will be overwritten after reboot! But once we have a working dnsmasq, it should be OK to use as nameserver.

Now run nslooup to verify Internet connection, so we can install a lot packages.
Here are the normal ones a Linux guru will be using after run #opkg update.
# opkg install lsof curl coreutils proxychains-ng vim bash uhttpd luci procps-ng-ps procps-ng-w bind-tools bind-host fdisk block-mount haveged

For those need Chinese language interface, here are the additional packages:
# opkg install luci-i18n-base-zh-cn luci-i18n-samba4-zh-cn
# opkg install luci-i18n-wireguard-zh-cn luci-i18n-cifsd-zh-cn luci-i18n-dnscrypt-proxy-zh-cn