OpenWrt Forum Archive

Topic: How to build a "micro" openwrt?

The content of this topic has been archived on 4 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

The WAP54G access point has 2mb flash 8mb ram.
What is a good way to slim openwrt down to have a minimal build for the brcm47xx platform?
It seems like inside the squashfs lua and uclibc and luci take up lots of space (the rootfs un-lzma-d takes up 8mb!).
Something with just the basics -- wifi, ethernet, etc; no luci, ppp, wep, wireless-n, wpa1, eap/radius/etc.
I tried it before looking at rootfs contents, but removing utilities from busybox and some debugging symbols from kernel etc. didnt help much :-), the trx output was only a few hundred KB smaller.

by the way i know this is not officially supported, but it would be really nice if i could make a little build for myself.

Thanks!

(Last edited by hhm1 on 11 Nov 2012, 11:32)

A few suggestions, in no particular order:

  • Write down a list of what you REALLY need to have on the router and stick to it!!!

  • Use a graphical disk analyzer like baobab to analyze where is the bloat in the "build_dir/target_xxx/root-yyy" directory which contains an image of the device filesystem

  • There are tuning options in the menuconfig to strip unnecessary export from the kernel/functions from libraries in the "Global Build settings", with the drawback that you will not be able to extend the system without reflashing it completely (no support for add-on kernel modules/new executable programs)

  • In the same menu, check the option " Remove ipkg/opkg status data files in final images", with the drawback that you will not be able to remove the basic packages one by one using "opkg"

  • Build a kernel with only the minimal required features, removing all debug options, core dump support, shadow password support

  • If possible, try to use the busybox equivalent of a standalone program, they are usually much smaller

  • In busybox, remove all bells and whistles, like verbose messages, history in shell, fancy prompts, large file support, obsolete features, locale/Unicode support, tab completion, use of ioctl names rather than hex values

Baobab Graphical Disk Usage Analyzer

(Last edited by Squonk on 11 Nov 2012, 16:47)

hhm1 wrote:

The WAP54G access point has 2mb flash 8mb ram.
What is a good way to slim openwrt down to have a minimal build for the brcm47xx platform?
It seems like inside the squashfs lua and uclibc and luci take up lots of space (the rootfs un-lzma-d takes up 8mb!).
Something with just the basics -- wifi, ethernet, etc; no luci, ppp, wep, wireless-n, wpa1, eap/radius/etc.
I tried it before looking at rootfs contents, but removing utilities from busybox and some debugging symbols from kernel etc. didnt help much :-), the trx output was only a few hundred KB smaller.

by the way i know this is not officially supported, but it would be really nice if i could make a little build for myself.

Thanks!

I remember there as a page somewhere that says the absolute minimum requirement for OpenWRT is is something like 4MB ROM and 16MB flash. Doesn't sound like it is possible to strip it down to 2MB ROM..

Maybe you should buy a new router for this instead...

ericwongcm wrote:

I remember there as a page somewhere that says the absolute minimum requirement for OpenWRT is is something like 4MB ROM and 16MB flash. Doesn't sound like it is possible to strip it down to 2MB ROM..

Maybe you should buy a new router for this instead...

Yeah, that's theory!

In practice, I already put some stripped-down Linux distros in 2+8MB, so you can probably shoehorn a minimum OpenWrt system without any sophisticated functionalities in these memory capacities, if you tailor the kernel correctly, don't use the opkg system, lock down everything to static, and strip unnecessary symbols: in this case, OpenWrt is just adding a small set of lightweight init scripts to the kernel and busybox.

Maybe @hhm1 has good reasons for wanting to reuse this router... If not, I agree that you can find smaller, cheaper and more capable TL-WR703N routers with 4+32MB for $21 on eBay!

Working on it. Have it down to 2 MB sofar! Thanks!

@hhm1: Can you share your .config for your 2MB build?

phuque99 wrote:

@hhm1: Can you share your .config for your 2MB build?

The .config is here. Kernel config is here.

The rootfs is 1.1mb, just about same as stock. Kernel is 800kb whereas stock is 400kb. So stock total is about 1.5 MB, this is about 2MB.

I have not yet tested it on the hardware.

(Last edited by hhm1 on 13 Nov 2012, 05:02)

By the way, the build i am making is for using as a repeater bridge, in other words for 1) a reverse access point (lan accesses via wlan), 2) a wifi repeater. Currently I am using dd-wrt for this but having some issues, and want to put openwrt on it. That is why I took out things like ppp, dnsmasq, even iptables (which i dont know if is a good idea but can always change it :-) ).

(Last edited by hhm1 on 13 Nov 2012, 04:58)

Managed to get it down to 1.9 MB (changed more stuff in kernel), but the router is dead now*, so cant test it.

*: UPDATE: Thank G-d, I was able to revive the router from the dead :-) Tried touching wires bypassing the main power input (via this hint), and the router is working now!

See also this thread, which is about the same topic as the current one.

EDIT: forgot to mention that for the time being it is running dd-wrt.

(Last edited by hhm1 on 6 May 2013, 08:08)

Hey hhm1

this config files to down to 1.9mb work ?

Hi

The minimal requirements for running OpenWRT (up to BB I think) is
4 MB Flash and 16 MB RAM
This was the setup for beginning OpenWRT -> WRT54G.

The discussion might have continued from here.