Derived from these:

https://openwrt.org/docs/guide-developer/build-system/install-buildsystem

https://openwrt.org/docs/guide-developer/build-system/use-buildsystem

It's much easier to just install the stock image and install the packages, do that if u can. Do this if u can't.

The cleanest way to do a build is probably in a docker image, almost every os supports this and it gives you one environment to mess with (mess up??) with no consequences in your normal install. If you don't want to run a docker container just run the same commands on a debian machine/VM. It's probably the same packages for ubuntu, you can figure it out with the links above.

openwrt%20aircard-small

#this will exit/stop the entire container as soon as you close the console, be careful
podman pull alpine:latest
podman run -it alpine:latest

In the container:

apk update
apk add asciidoc bash bc binutils bzip2 cdrkit coreutils diffutils findutils flex g++ gawk gcc gettext git grep intltool libxslt linux-headers make ncurses-dev openssl-dev patch perl python2-dev python3-dev rsync tar unzip util-linux wget zlib-dev

As of writing OpenWRT 21.02.3 is the latest, change "v21.02.3" below with the version you want. Choose the latest of what u want from the tags here: https://git.openwrt.org/openwrt/openwrt.git

You also need to find the default build config for your router and version, you need to find your specific version of this url: https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/config.buildinfo

Go manually browse around here and figure it out: https://downloads.openwrt.org/releases/

In the container:

#if u do it as root the tar package will complain when built
adduser -s /bin/sh builduser
su - builduser

# Download and update the sources
git clone --depth 1 --branch v21.02.3 https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
git pull

# Update the feeds
scripts/feeds update -a
scripts/feeds install -a

#get the defaults - FIND YOUR ROUTERS BUILD TARGET URL FOR THIS, THE BELOW IS FOR A NETGEAR R7000
wget https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/config.buildinfo -O .config

#add in our wireless packages
echo "CONFIG_PACKAGE_usb-modeswitch=y
CONFIG_PACKAGE_kmod-mii=y
CONFIG_PACKAGE_kmod-usb-net=y
CONFIG_PACKAGE_kmod-usb-net-sierrawireless=y
CONFIG_PACKAGE_kmod-usb-serial-sierrawireless=y
CONFIG_PACKAGE_kmod-usb-net-qmi-wwan=y
CONFIG_PACKAGE_kmod-usb-wdm=y
CONFIG_PACKAGE_uqmi=y
CONFIG_PACKAGE_modemmanager=y
CONFIG_PACKAGE_luci-proto-modemmanager=y" >> .config

# Build the firmware image
make -j $(nproc) defconfig download clean world

This will take a long time to build, once it is done leave the terminal open and go to a new terminal on your local real pc. Find the container name podman ps / docker ps,

CONTAINER ID  IMAGE                            COMMAND  CREATED      STATUS          PORTS   NAMES
2b33051a1bbc  docker.io/library/apline:latest  /bin/sh   2 hours ago  Up 2 hours ago          jolly_meninsky

Now do podman cp jolly_meninsky:/home/builduser/openwrt/bin/targets/bcm53xx/generic/openwrt-21.02.3-bcm53xx-generic-netgear_r7000-squashfs.chk ./mybuild-r7000-2102rc4.chk For the first path, go and find your build that you made, it's similar to the path for the wget above.

Now flash that image to your router and go from step 7 here: /blog/openwrt-21-02-and-aircard-320u

Previous Post