OpenWrt Forum Archive

Topic: new build system

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

I'm proposing new slightly modified build system for openwrt. As all we know routers does not hold much on boad memory and most full featured packages does not fit on flash images.

For example. If you wish to have full featured cups server which is about 100M in size you have to think your way.

Most of the solutions described here http://wiki.openwrt.org/doc/howto/extroot but they all have limitations. I'd like to push new look to the situation.

What do we have here as a perfect build? I suggest it would be a binary file which, after flushing to the router has all your settings (including provided by your ISP) local services, like samba, dhcp already configured. So you flushing a router with 1 single file and you ready to go.

Even your friend or mom can flush a single file if it does not require a additional setup. So 1 file is the best. And flushing or hard reseting (or restoring from a hack) a router will provide a working router as well, since all settings allready fliled up on a flash binary file. That is good.

Actually I configured my build scripts to provide the solution I described above for me first router. DIR-300 has no external IO like USB and it make it single flash file is easy enough. My build scripts includes main branch with example configs, after cloning a git tree you can fill up your settings and push git repo back to your backup server. So you will never lose any settings or your prefered services again.

You can see my work here:

https://github.com/axet/openwrt-dir300-b1

But that was only first step in that direction. My second step is to flash extremely large size image to my 8 MB router.

What the best way of doing so? I think all possible ways and end up with following.

First of all, you need create basic image, with your favorite configs. Same as above. You flash a router with mimimum set of services, necessary to fire up your ipv4, ipv6 may be samba server. And you are ready to go. Next step is to add external device to router. All large packages should come easy enough to the router if you already have them prebuilded.

And here I suggest to use additional folder /opt mounted by block-mount automatically on boot. If this folder or external device is absent, router should keep working and give you no error. If that folder automatically mounter then router should fireup all /opt/etc/init.d scripts, enable swap, run ldconfig to fixup dynamic library paths and all services should read it's settings from /opt/etc.

The new look in my solution is to have new set of rules for openwrt build scripts (some of this rules already implemented in my git repo).

1) add new package prefix, indicating it is a LARGE package and shuld be installed into prefix directory. I called this variable PKG_PREFIX. This prefix read by build system and while building, scripts are providing nessesery prefixes to configure and make command to allow you prepare packages ready to run from PKG_PREFIX path (ex: PKG_PREFIX=/opt)

2) it also required to modify some build script of the package manually (by patching). Since not all parameters from ./configure or configure.ac can be configured trough script parameters, such as --cups-prefix=/opt

3) it required to modify opkg script to allow you to install specially prepared packages (builded with /opt prefix) to the /opt dirrecotory and keept all information about installed package on the /opt folder in case if /opt folder is not mounted (usb removed or damaged) we shall not show /opt installed packages

4) change boot scripts to make them mount and read /opt dirrectory and run startup scripts from a /opt/etc/rc.* folders

This is where I'm working on CUPS services installed to /opt dirrectory (branch cups).

https://github.com/axet/openwrt-tl-wr842nd-v2

That's exactly I do for my own devices. All I need is a single firmware file to flash. After flashing, my device will be up running as expected. If I modify the configuration on my device for a better, all I will do is to include the new configuration into the next build and then flash to my device. This way, if I perform a factory reset, my device will be up running as if it was just flashed with the firmware.

Hi,
I'm using pivot-overlay alias extroot.
Look at http://wiki.openwrt.org/doc/howto/extroot

It works fine for me without creating or modifing any package install scripts.
Everything is installed at the right directory.

Here I can test "new" and large packages and later on integrate them into the "master" image, if fits into flash.
If not, I write a shell script to do all the installation for me with one call.
i.e. install-samba.sh doing package load via opkg and uci commands to modify the config or cat<<-EOF into the relevant .conf files to fit my settings.

Greetings from Germany

Christian

I am not sure I understood all from the OP, but what I do is simply use ImageBuilder with customized package list and customized configuration files. I have not needed more than fits into 8MB flash so I cannot comment on the second part, but I guess it could be solved as well by ImageBuilder as all the built packages (which would not fit into image) can be mounted later from external storage as package source (so they correspond exactly to the built kernel) and installed wherever one wants, potentially to the same external storage using pivot-overlay.

(Last edited by risa2000 on 19 Jan 2014, 12:15)

I'd like to add some progress here. I'm running openwrt on TPLINK and seems like a got into problem.

Seems like it is not possible to use openwrt in the way I describe here. Currently openwrt (trunk) keep reseting usb device and when you have swap or additonal (/opt in my case) directory mounted from external usb stick it will breaks eventually.

I have questions, is here some technicall group who decides what way openwrt will go? I'd like to propose using additional partition to the current directory scheme. Same thing I described here.

Would be nice if you can, by default, add packages to the external device by build system its self. Without playing with dpkg configs and allow you to extend packages by adding external device.

Currently you can install packaged to different root, but new root will be linked to the main root and all package information will be stored on the main root partition.

It would be nice to have an option to dynamically add / remote new packages installed on external drive. Boot scripts can easily ldd librarys from just mounted partition to the /opt directory and run scripts from /opt/etc/init.d/* which can add way more flexability to current openwrt routers.

The discussion might have continued from here.