Building firmware with pre-configured settings

I followed https://openwrt.org/docs/guide-user/installation/flashing_openwrt_with_wifi_enabled_on_first_boot guide. I placed following script into files/etc/uci-defaults/99_z8102-ax-emmc-giorez_config during the building. Unfortunatelly this script is not integrated into built firmware.

# Configure system
uci set system.@system[0].hostname='z8102'
uci set system.@system[0].timezone='CET-1CEST,M3.5.0,M10.5.0/3'
uci set system.@system[0].zonename='Europe/Rome'
uci commit system
 
# Configure modem interface - rm551 in ECM mode
uci set network.wwan=interface
uci set network.wwan.proto='dhcp'
uci set network.wwan.device='usb0'
uci set network.globals.packet_steering='1'
uci commit network

# Configure modem interface firewall
uci add_list firewall.@zone[1].network='wwan'
uci commit firewall

# Configure WIFI
uci set wireless.radio0.channel='auto'
uci set wireless.radio0.htmode='HE40'
uci set wireless.radio0.country='IT'
uci set wireless.radio0.cell_density='0'
uci set wireless.default_radio0=wifi-iface
uci set wireless.default_radio0.device='radio0'
uci set wireless.default_radio0.network='lan'
uci set wireless.default_radio0.mode='ap'
uci set wireless.default_radio0.ssid='z8102-24'
uci set wireless.default_radio0.encryption='psk2'
uci set wireless.default_radio0.key='xxxxxxxx'
uci set wireless.default_radio0.disabled='0'
uci set wireless.radio1.channel='auto'
uci set wireless.radio1.htmode='HE160'
uci set wireless.radio1.cell_density='0'
uci set wireless.default_radio1=wifi-iface
uci set wireless.default_radio1.device='radio1'
uci set wireless.default_radio1.network='lan'
uci set wireless.default_radio1.mode='ap'
uci set wireless.default_radio1.ssid='z8102-50'
uci set wireless.default_radio1.encryption='psk2'
uci set wireless.default_radio1.key='xxxxxxxx'
uci set wireless.default_radio1.disabled='0'
uci commit wireless

# Restart services to apply changes
/etc/init.d/system reload
/etc/init.d/network reload
/etc/init.d/firewall reload
wifi reload

Any help is appreciated.

thanks

is this a an initial flash or a sysupgrade ?

there's also https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#custom_files.

the buit image is *sysupgrade.bin and I use to flash over an old vendor snapshot

there's also https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#custom_files.

I checked that guide also, and at the moment I just followed the preferred method using uci-defaults indications

thanks for your feedback

tried pasing your script into https://firmware-selector.openwrt.org/ too (skipping the last 4 lines though).

since the PR for my router is still to be reviewed (https://github.com/openwrt/openwrt/pull/21995) I can NOT test the online builder. I just tested the script via terminal on the fresh sysupgrade installation, and it works.

If you are building with the full toolchain, it should get integrated ok. Check the path & filename.

How are you evaluating that it does not get embedded?
Note that after a successful run, the ucii-defaults files are normally deleted from /etc/uci-defaults. But if should still be present in /rom/etc/uci-defaults.

(You can also see the final file system with those files included deep in the buildhost build directories.)

My point is that try to separate "it does not get included" from "it is included but does not work" case.

i will investigate according to your tips. thanks!

here are some findigs.

  1. just after the build is done. this is the situation of the local repo:
gio@aimecUBU:~/openwrt-giorez$ find -name  99_z8102-ax-emmc-giorez_config
./build_dir/target-aarch64_cortex-a53_musl/root-mediatek/etc/uci-defaults/99_z8102-ax-emmc-giorez_config
./files/etc/uci-defaults/99_z8102-ax-emmc-giorez_config


One question, there is another file (./build_dir/target-aarch64_cortex-a53_musl/root-mediatek/etc/uci-defaults/99_fwenv-store-ethaddr.sh) in that folder, ending with "exit 0". Could be the reason of some issuues?

  1. Regarding the router content after the fresh installation of
    openwrt-mediatek-filogic-zbtlink_zbt-z8102ax-emmc-squashfs-sysupgrade.bin

there no 99_z8102-ax-emmc-giorez_config file:

root@OpenWrt:/# find -name  99_z8102-ax-emmc-giorez_config
root@OpenWrt:/# find / -name  99_z8102-ax-emmc-giorez_config
root@OpenWrt:/#


To get that config tio be applied, I need force the script into router cli.

I hope this help to find the reason of the issue.
thanks

@frollic @hnyman
I also just undestood that some packages (kmod-tun, tailscale, ttyd, etc) I selected during β€œmake menuconfigβ€œ are not installed on the fresh installation. Ho do I investigate why the building process is missing some packs?

thanks

Not installed or not built ?

they are build into
/bin/packages/aarch64_cortex-a53/packages/tailscale_1.94.1-r2_aarch64_cortex-a53.ipk

but when I go to webgui into router http://192.168.1.1/cgi-bin/luci/admin/system/package-manager they are not installed

Tried installing them?

yes they are installing properly, but the probably get installed from the online repo. but kmod-tun package is not available nor in bin folder, nor online

For opkg you could change the source of the packages, I'm sure it can be done with apk too, but I have no idea how, probably a conf file somewhere in /etc.

sorry for the stupid question, but if I build the firmware, the packages should e integrated into the bin firmware, correct?

here are the steps I follow during the building process:

make menuconfig
# Select:
# - Target System β†’ MediaTek Ralink ARM
# - Subtarget β†’ Filogic 830x/860x
# - Target Profile β†’ Zbtlink ZBT-Z8102AX EMMC
# - Global Buil Settings β†’  Use APK instead OPKG
# - Kernel Modules β†’ Network Support β†’ kmod-tun (deps tailscale)
# - Kernel Modules β†’ USB Support β†’ kmod-usb-net-cdc-ether (rm551 in ECM mode)
# - LuCI β†’ luci
# - LuCI β†’ Applications β†’ luci-app-tailscale-community
# - LuCI β†’ Applications β†’ luci-app-ttyd
# - Utilities β†’ Editors β†’ nano
# - Utilities β†’ Terminal β†’ picocom
# Salva ed esci (Save β†’ Exit) per scrivere .config

1 Like

packages no, kmods yes, if they're set as *, not m.

for non-kmods you probably have to modify the default build recipe.

I always use *

modify the default build recipe

any idea where is the setting to include non-kmod packages?

should I force to include pakages into firmware.bin using the β€œmake” command this way?


make -j4 image PROFILE=zbt-z8102-emmc PACKAGES=\
  "-libiwinfo-lua -liblua -libubus-lua -libuci-lua -lua \
   -luci -luci-app-firewall -luci-base -luci-lib-ip \
   -luci-lib-nixio -luci-mod-admin-full -luci-proto-ipv6 \
   -luci-proto-ppp -luci-theme-bootstrap -uhttpd -uhttpd-mod-ubus \
   -ip6tables -ppp"




make sure the script is executable, scripts inside the /files/* directory are not set as executable during build. You MUST do it manually. In ubuntu just right click on the file --> properties --> set permissions ..or from terminal

chmod +x /path/to/files/etc/uci-defaults/99_z8102-ax-emmc-giorez_config

This is often overlooked. And one of the many reason i do not use the ./files dir approach. I usually create a package with a simple openwrt makefile, in which its only job is to install files where i want ..with the permissions I want.

3 Likes

That command is about cooking the image with the imagebuilder.

If you are using menuconfig, then you are using the full toolchain that has the package selection in the file .config (from make menuconfig or defconfig)

1 Like

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