Need help building a minimal firmware

Hi, I have a Xiaomi Mi Router 4A Gigabit Edition and I want to use it to share v2ray vpn connection. So, I want to build a firmware that can do that with minimal flash/storage usage (because the v2ray client package is ~8.5 MBs and when I install the official build I only have 8 MBs of free space). Can someone guide me through? Or even build the package for me please?
Thank you guys.
Note: I'm really still a noob, so please be as thorough as possible. And it's really nice to have the LuCI interface (again because I'm a noob :slight_smile:)

See: https://firmware-selector.openwrt.org/?version=22.03.4&target=ramips%2Fmt7621&id=xiaomi_mi-router-4a-gigabit

1 Like

That's exactly where I downloaded my build from. I want a smaller build

Use:

Screenshot_20230501-052031_Firefox Focus

Make build smaller by editing the list.

3 Likes

as @lleachii said, you could try to disable few package and add directly v2ray to be built in, this way, if you generate image with needed packages, it will be smaller, opposite to installing v2ray after default flash image

personally i am building my images on Ubuntu, so not 100% sure in this, but something similar ... look at the end of line, this way you could add (+) and remove(-) packages in online image buider

base-files busybox ca-bundle dnsmasq dropbear firewall4 fstools kmod-gpio-button-hotplug kmod-leds-gpio kmod-mt7603 kmod-mt76x2 kmod-nft-offload libc libgcc libustream-wolfssl logd mtd netifd nftables odhcp6c odhcpd-ipv6only opkg  procd procd-seccomp procd-ujail uci uclient-fetch urandom-seed urngd wpad-basic-wolfssl -ppp -ppp-mod-pppoe +v2ray-core +v2ray-extra +luci

this package selection produce 12 MB img so in theory it should fit

1 Like

So you're saying that I copy this line to where @lleachii said and install that build??

On the Firmware Selector, just list/add/remove the packages you desire (as normal - just like you already see listed). No need for punctuation or mathematical operation symbols.

1 Like

That's exactly where I downloaded my build from. I want a smaller build

if you really downloaded once from this site, then, site is generating proper image for you device

the line i pasted is already there, if you expand "Customize installed packages and/or first boot script" arrow on left, you will see it
only modification is on the end of line, removing ppp and adding v2ray and luci as example

i am realy don't know do you use ppp/pppoe for your wan, or whatever, this is example how to add/remove packages

rest is up to you :slight_smile:

3 Likes

Ok, I get it. Just one question remains: what packages do I need to properly share the connection? I don't want to accidentally remove a critical package, or can I install them later?
Sorry if I'm asking too much, it's just that I'm trying to fully understand what I'm going to do.

And just to be sure, when I install the new build through LUCI, I get a fresh new build and everything gets wiped out, right? because obviously I don't have space for 2 builds

You need to know the packages you desire, since you want the "smaller build" (it seems like you're asking us to guess - kinda confusing).

The firmware is replaced.

2 Likes

I get a fresh new build and everything gets wiped out,

you need to untick " Keep settings and retain the current configuration" when you upload new image

2 Likes

:bulb: (BTW, most answers to your inquires thus far already exist in Wikis/forums.)

2 Likes

Sorry for that, but I don't know what packages are necessary either. I'll search more and find out myself. Thank you!

2 Likes

Hey are you able to make this work to run v2ray?? I am also planning to buy this router for v2ray.

I didn't try it to be honest. Because I feel it's risky and I need to use other protocols as well, so I can't fill my storage with just v2ray

Yeah too risky. did you try custom build?

I tried to install a custom build from the official firmware selector and it almost bricked my router, I had to restore the original oem and flash openwrt again. So, unless you really know what you're doing, don't do it.

can you try installing shadowsocks? This is also a proxy. On server side you can use v2ray and client side use shadowsocks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.