Thursday, November 2, 2017

openwrt open-wrt

Adding configuration options

If you would like configure your package installation/compilation in the menuconfig you can do the following: Add MENU:=1 to your package definition like this:
define Package/mjpg-streamer
  SECTION:=multimedia
  CATEGORY:=Multimedia
  TITLE:=MJPG-streamer
  DEPENDS:=@!LINUX_2_4 +libpthread-stubs +jpeg
  URL:=http://mjpg-streamer.wiki.sourceforge.net/
  MENU:=1
endef
Create a config key in the Makefile:
define Package/mjpg-streamer/config
 source "$(SOURCE)/Config.in"
endef
Create a Config.in file directory where the Makefile is located with the content like this:
 # Mjpg-streamer configuration
 menu "Configuration"
  depends on PACKAGE_mjpg-streamer

 config MJPEG_STREAMER_AUTOSTART
  bool "Autostart enabled"
  default n

  menu "Input plugins"
   depends on PACKAGE_mjpg-streamer
   config MJPEG_STREAMER_INPUT_FILE
    bool "File input plugin"
    help 
     You can stream pictures from jpg files on the filesystem
    default n
  
   config MJPEG_STREAMER_INPUT_UVC
    bool "UVC input plugin"
    help
     You can stream pictures from an Universal Video Class compatible webcamera
    default y
  
   config MJPEG_STREAMER_FPS
    depends MJPEG_STREAMER_INPUT_UVC
    int "Maximum FPS"
    default 15

   config MJPEG_STREAMER_PICT_HEIGHT
    depends MJPEG_STREAMER_INPUT_UVC
    int "Picture height"
    default 640

   config MJPEG_STREAMER_PICT_WIDTH
    depends MJPEG_STREAMER_INPUT_UVC
    int "Picture width"
    default 480


   config MJPEG_STREAMER_DEVICE
    depends MJPEG_STREAMER_INPUT_UVC
    string "Device"
    default /dev/video0
 
   config MJPEG_STREAMER_INPUT_GSPCA
    bool "GSPCA input plugin"
    help
     You can stream pictures from a gspca supported webcamera Note this module is deprecated, use the UVVC plugin instead
    default n
  endmenu
 
  # ......
 
 endmenu
Above you can see examples for various type config parameters.
And finally you can check your configuration parameters in your Makefile in the following way: (Note that you can reference to the parameters value with it name prefixed with CONFIG_)
ifeq ($(CONFIG_MJPEG_STREAMER_INPUT_UVC),y)
 $(CP) $(PKG_BUILD_DIR)/input_uvc.so $(1)/usr/lib
endif

No comments:

Post a Comment