Skip to content
Snippets Groups Projects
  1. May 28, 2020
    • Thibaut VARÈNE's avatar
      package/base-files: caldata: work around dd's limitation · 7557e7f2
      Thibaut VARÈNE authored
      
      tl;dr: dd will silently truncate the output if reading from special
      files (e.g. sysfs attributes) with a too large bs parameter.
      
      This problem was exposed on some RouterBOARD ipq40xx devices which use a
      caldata payload which is larger than PAGE_SIZE, contrary to all other
      currently supported RouterBOARD devices: the caldata would fail to
      properly load with the current scripts.
      
      Background: dd doesn't seem to correctly handle read() results that
      return less than requested data. sysfs attributes have a kernel exchange
      buffer which is at most PAGE_SIZE big, so only 1 page can be read() at a
      time. In this case, if bs is larger than PAGE_SIZE, dd will silently
      truncate blocks to PAGE_SIZE. With the current scripts using bs=<size>
      count=1, the data is truncated to PAGE_SIZE as soon as the requested
      <size> exceeds this value.
      
      This commit works around this problem by using `cat` in the caldata
      routines that can read from a file (routines that read from mtd devices
      are untouched). cat correctly handles partial read requests. The output
      is then piped to dd with the same parameters as before, to ensure that
      the resulting file remains exactly the same.
      
      This is a simple workaround, the downside is that it uses a pipe and one
      more executable, and therefore has a larger memory footprint and is
      slower. This is deemed acceptable considering these routines are only
      used at boot time.
      
      Tested-by: default avatarRobert Marko <robimarko@gmail.com>
      Signed-off-by: default avatarThibaut VARÈNE <hacks@slashdirt.org>
      7557e7f2
  2. May 08, 2020
  3. Apr 12, 2020
  4. Feb 24, 2020
    • Piotr Dymacz's avatar
      base-files: diag: restore default trigger for 'boot' LED · a422b171
      Piotr Dymacz authored
      
      For devices without a dedicated 'diag' LED, we use sometimes one of
      other LEDs for indicating at least 'boot', 'failsafe' and 'upgrade'
      stages. In some cases, at the same time these LEDs have defined default
      triggers in DTS using 'linux,default-trigger' property. Current 'diag'
      setup removes the trigger and turns off 'boot' LED after bootup.
      
      One of the examples of such device is TP-Link TL-WR841N v14 (ramips)
      which uses 'wlan' LED with defined 'linux,default-trigger' for 'diag':
      
      aliases {
              led-boot = &led_wlan;
              led-failsafe = &led_wlan;
              led-upgrade = &led_wlan;
      };
      
      [...]
      
      led_wlan: wlan {
              label = "tl-wr841n-v14:green:wlan";
              gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
              linux,default-trigger = "phy0tpt";
      };
      
      This patch extends 'diag.sh' and 'leds.sh' scripts to make sure default
      trigger defined in DTS is restored for 'diag' LED which isn't used for
      indicating 'running' stage.
      
      Acked-by: default avatarAdrian Schmutzler <freifunk@adrianschmutzler.de>
      Signed-off-by: default avatarPiotr Dymacz <pepe2k@gmail.com>
      a422b171
  5. Jan 26, 2020
  6. Jan 17, 2020
  7. Nov 07, 2019
    • Rosy Song's avatar
      base-files: rename hostname with EUI of mac address · 6170c46b
      Rosy Song authored
      
      If a label MAC address is provided for device, system
      will rename the hostname with OpenWrt_{eui mac address}.
      This helps to distinguish between different devices.
      
      Since it's no good idea to nest json_* functions, this code does
      not use get_mac_label directly, but only get_mac_label_dt as
      external resource.
      
      Signed-off-by: default avatarRosy Song <rosysong@rosinson.com>
      [merged with commit introducing macaddr_geteui, rebased on updated
      label MAC address storage, extended commit message]
      Signed-off-by: default avatarAdrian Schmutzler <freifunk@adrianschmutzler.de>
      6170c46b
    • Adrian Schmutzler's avatar
      base-files: don't store label MAC address in uci system config · a6fbdd3a
      Adrian Schmutzler authored
      
      If set, label MAC address is available from one of two sources,
      device tree or board.json. So far, the function get_mac_label
      was meant for retrieving the address, while an option in uci
      system config was specified only for case 2 (board.json).
      
      The uci config option has several drawbacks:
      - it is only used for a fraction of devices (those not in DT)
      - label MAC address is a device property, while config implies
        user interaction
      - label_macaddr option will only be set if /etc/config/system
        does not exist (i.e. only for new installations)
      
      Thus, this patch changes the behavior of get_mac_label:
      Instead of writing the value in board.json to uci system config
      and reading from this location afterwards, get_mac_label now
      extracts data from board.json directly. The uci config option
      won't be used anymore.
      In addition, two utility functions for extraction only from DT
      or from board.json are introduced.
      
      Since this is only changing the access to the label MAC address, it
      won't interfere with the addresses stored in the code base so far.
      
      Signed-off-by: default avatarAdrian Schmutzler <freifunk@adrianschmutzler.de>
      a6fbdd3a
  8. Oct 22, 2019
  9. Oct 15, 2019
  10. Oct 14, 2019
  11. Oct 13, 2019
  12. Sep 19, 2019
  13. Sep 05, 2019
  14. Jul 09, 2019
  15. Jul 07, 2019
  16. Jun 29, 2019
  17. Jun 20, 2019
  18. May 20, 2019
    • Petr Štetiar's avatar
      base-files: add support for the new ar8xxx MIB counters settings · aac8b521
      Petr Štetiar authored
      
      Commit "generic: ar8216: add mib_poll_interval switch attribute" has
      added mib_poll_interval global config option and commit "generic:
      ar8216: group MIB counters and use two basic ones only by default" has
      added mib_type config option.
      
      So this patch adds ucidef_set_ar8xxx_switch_mib helper function which
      would allow configuration of the above mentioned new switch config
      options.
      
      Signed-off-by: default avatarPetr Štetiar <ynezz@true.cz>
      aac8b521
  19. Apr 06, 2019
  20. Sep 29, 2018
    • Christian Lamparter's avatar
      base-files: make it possible to specify switch led mode · 641dc501
      Christian Lamparter authored
      
      The swconfig switch led driver has the ability to switch
      between a "link, rx and/or tx" mode. However, this feature
      was not implemented in uci, the led init script and
      config_generate.
      
      This patch adds a seventh parameter to the
      ucidef_set_led_switch() function. The accepted values for
      this parameter are: link, rx and tx.
      Any permutations of these three values are supported, as
      long as they are properly encased with quotes.
      If the parameter is not specified it will default to "all"
      (link rx tx).
      
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      641dc501
  21. Sep 25, 2018
  22. Aug 11, 2018
  23. Jul 17, 2018
    • Jo-Philipp Wich's avatar
      base-files: network.sh: gracefully handle missing network.interface ubus ns · 1bad852f
      Jo-Philipp Wich authored
      
      When attempting to use any of the functions in network.sh while netifd is
      not started yet, the ubus interface dump query will fail with "Not found",
      yielding an empty response.
      
      Subsequently, jsonfilter is invoked with an empty string instead of a valid
      JSON document, causing it to emit a second "unexpected end of data" error.
      
      This caused the dnsmasq init script to log the following errors during
      early boot on some systems:
      
          procd: /etc/rc.d/S19dnsmasq: Command failed: Not found.
          procd: /etc/rc.d/S19dnsmasq: Failed to parse json data: unexpected end of data.
      
      Fix the issue by allowing the ubus query to fail with "Not found" but still
      logging other failures, and by passing an empty JSON object to jsonfilter
      if the interface status cache is empty.
      
      Signed-off-by: default avatarJo-Philipp Wich <jo@mein.io>
      1bad852f
  24. May 25, 2018
  25. May 24, 2018
  26. Apr 04, 2018
  27. Mar 14, 2018
  28. Jan 10, 2018
  29. Dec 14, 2017
    • Christian Lamparter's avatar
      base-files: unify get_dt_led helper function · da6fdce3
      Christian Lamparter authored
      
      Lantiq and IPQ806X (which includes IPQ40XX) both define the
      same custom function {ipq806x|lantiq}_get_dt_led.
      
      This patch moves the function into the base-file package at
      lib/functions/leds.sh to make it more accessible for other
      targets as well.
      
      Cc: Mathias Kresin <dev@kresin.me>
      Cc: John Crispin <john@phrozen.org>
      Cc: Hannu Nyman <hannu.nyman@iki.fi>
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      da6fdce3
  30. Jun 17, 2017
  31. Jun 08, 2017
    • Jo-Philipp Wich's avatar
      base-files: network.sh: fix a number of IPv6 logic flaws · 6426e4ed
      Jo-Philipp Wich authored
      
      * Change network_get_subnet6() to sensibly guess a suitable prefix
      
        Attempt to return the first non-linklocal, non-ula range, then attempt
        to return the first non-linklocal range and finally fall back to the
        previous behaviour of simply returning the first found item.
      
      * Fix network_get_ipaddrs_all()
      
        Instead of replicating the flawed logic appending a fixed ":1" suffix
        to IPv6 addresses, rely on network_get_ipaddrs() and network_get_ipaddrs6()
        to build a single list of all interface addresses.
      
      * Fix network_get_subnets6()
      
        Instead of replicating the flawed logic appending a fixed ":1" suffix
        to IPv6 addresses, rely on the ipv6-prefix-assignment.local-address
        field to figure out the proper network address.
      
      Signed-off-by: default avatarJo-Philipp Wich <jo@mein.io>
      6426e4ed
    • Jo-Philipp Wich's avatar
      base-files: network.sh: properly report local IPv6 addresses · 7f91cabd
      Jo-Philipp Wich authored
      
      Rework the network_get_ipaddr6() and network_get_ipaddrs6() functions to
      fetch the effective local IPv6 address of delegated prefix from the
      "local-address" field instead of naively hardcoding ":1" as static suffix.
      
      Fixes FS#829.
      
      Signed-off-by: default avatarJo-Philipp Wich <jo@mein.io>
      7f91cabd
  32. May 14, 2017
Loading