Pietro Paolini <[email protected]> [2013-02-27 17:45:29]: > Hello all,
Hi, > I'd like understand how customise the .config file in order to put inside > it some variable I need and which I use in Makefile in this way : read this http://wiki.openwrt.org/doc/devel/packages?s[]=config#adding.configuration.options I don't recommend you hand editing .config. Just add a dummy package, say myfoo-config and add a Makefile + Config.in file in it with a custom string variable. It's jsut better for a lot of reasons. Some example: diff --git a/package/gaben-foo/Config.in b/package/gaben-foo/Config.in new file mode 100644 index 0000000..f871009 --- /dev/null +++ b/package/gaben-foo/Config.in @@ -0,0 +1,11 @@ +menu "Configuration" + depends on PACKAGE_gaben-foo + +config FOO_SERIAL_PORT + string + prompt "Default serial port used for application output" if PACKAGE_gaben-foo + default "ttyAM0" + help + Specify serial console used by the application output + +endmenu diff --git a/package/gaben-foo/Makefile b/package/gaben-foo/Makefile index fec44f7..f713ab7 100644 --- a/package/gaben-foo/Makefile +++ b/package/gaben-foo/Makefile @@ -25,6 +25,10 @@ endef define Build/Compile endef +define Package/$(PKG_NAME)/config + source "$(SOURCE)/Config.in" +endef + define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/etc/init.d @@ -35,6 +39,8 @@ define Package/$(PKG_NAME)/install $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) $(INSTALL_BIN) ./files/$(PKG_NAME) $(1)/usr/bin/$(PKG_NAME) $(INSTALL_BIN) ./files/$(PKG_NAME).uci-defaults $(1)/etc/uci-defaults/$(PKG_NAME) + + sed -i s:CONFIG_FOO_SERIAL_PORT:$(strip $(CONFIG_FOO_SERIAL_PORT)): $(1)/etc/config/$(PKG_NAME) endef $(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/gaben-foo/files/gaben-foo.config b/package/gaben-foo/files/gaben-foo.config index 995f787..f977971 100644 --- a/package/gaben-foo/files/gaben-foo.config +++ b/package/gaben-foo/files/gaben-foo.config @@ -8,7 +8,7 @@ config general 'core' option sensor_right 'input2' option bypass_button 'input3' option foo_is_ascii 'true' - option serial_device '/dev/ttyAM0' + option serial_device '/dev/CONFIG_FOO_SERIAL_PORT' option serial_baudrate '9600' option serial_enabled 'true' option send_read 'false' -- ynezz _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
