Browse Source

Rebase off upstream master @ c9f5934c71e73df707d97f8b2ff86e164bfbda12

RISCi_ATOM 5 years ago
parent
commit
eaeafafb10
100 changed files with 855 additions and 1679 deletions
  1. 4 2
      Makefile
  2. 11 2
      config/Config-images.in
  3. 51 3
      config/Config-kernel.in
  4. 0 96
      docs/Basic_Wireless_Settings.md
  5. 0 101
      docs/Bridge_Mode.md
  6. 0 46
      docs/GL-AR300M.md
  7. 0 15
      docs/Image_Support.md
  8. 0 203
      docs/Layer_2_OpenVPN.md
  9. 61 103
      docs/OpenVPN_Layer_2_Server.md
  10. 0 84
      docs/Port_Forwards.md
  11. 0 104
      docs/Serial.md
  12. 0 32
      docs/Soft_Brick_Recovery_With_IPv6.md
  13. 37 37
      docs/Supported_Hardware.md
  14. 0 67
      docs/System_Log.md
  15. 19 3
      docs/TL_WR841ND.md
  16. 1 1
      docs/TPE_R1100.md
  17. BIN
      docs/images/librecmc-changing-admin-password.png
  18. BIN
      docs/images/librecmc-changing-essid.png
  19. BIN
      docs/images/librecmc-changing-wifi-password.png
  20. BIN
      docs/images/librecmc-default-interfaces.png
  21. BIN
      docs/images/librecmc-default-login.png
  22. BIN
      docs/images/librecmc-dhcp-server-ignore-lan.png
  23. BIN
      docs/images/librecmc-eth0-added-to-lan.png
  24. BIN
      docs/images/librecmc-luci-selecting-system-log.png
  25. BIN
      docs/images/librecmc-luci-system-log.png
  26. BIN
      docs/images/librecmc-port-forwards-after-save-apply.png
  27. BIN
      docs/images/librecmc-port-forwards-entering-parameters.png
  28. BIN
      docs/images/librecmc-selecting-firewall-menu.png
  29. BIN
      docs/images/librecmc-selecting-port-forwards-tab.png
  30. BIN
      docs/images/librecmc-switch-lan-to-dhcp.png
  31. BIN
      docs/images/serial.png
  32. 1 1
      docs/unbrick_with_uboot_mod.md
  33. 1 1
      feeds.conf.default
  34. 2 2
      include/cmake.mk
  35. 59 22
      include/download.mk
  36. 6 11
      include/feeds.mk
  37. 2 2
      include/hardening.mk
  38. 1 1
      include/host-build.mk
  39. 48 2
      include/image-commands.mk
  40. 1 0
      include/image.mk
  41. 1 1
      include/kernel-build.mk
  42. 6 8
      include/kernel-version.mk
  43. 2 2
      include/kernel.mk
  44. 1 0
      include/netfilter.mk
  45. 1 1
      include/package-ipkg.mk
  46. 2 2
      include/package.mk
  47. 2 2
      include/prereq-build.mk
  48. 1 1
      include/scan.awk
  49. 6 0
      include/scan.mk
  50. 1 0
      include/subdir.mk
  51. 3 4
      include/target.mk
  52. 2 2
      include/toplevel.mk
  53. 1 1
      include/verbose.mk
  54. 43 37
      include/version.mk
  55. 8 6
      package/base-files/Makefile
  56. 29 18
      package/base-files/files/bin/config_generate
  57. 6 0
      package/base-files/files/etc/ethers
  58. 4 2
      package/base-files/files/etc/init.d/led
  59. 1 1
      package/base-files/files/etc/init.d/sysctl
  60. 1 1
      package/base-files/files/etc/init.d/system
  61. 5 1
      package/base-files/files/etc/profile
  62. 2 2
      package/base-files/files/etc/services
  63. 8 12
      package/base-files/files/lib/functions.sh
  64. 14 3
      package/base-files/files/lib/functions/network.sh
  65. 27 8
      package/base-files/files/lib/functions/system.sh
  66. 31 49
      package/base-files/files/lib/functions/uci-defaults.sh
  67. 12 6
      package/base-files/files/lib/upgrade/common.sh
  68. 23 2
      package/base-files/files/lib/upgrade/fwtool.sh
  69. 1 0
      package/base-files/files/lib/upgrade/stage2
  70. 7 5
      package/base-files/files/sbin/sysupgrade
  71. 3 2
      package/base-files/files/sbin/wifi
  72. 1 1
      package/base-files/files/usr/lib/os-release
  73. 8 16
      package/base-files/image-config.in
  74. 3 3
      package/boot/arm-trusted-firmware-sunxi/Makefile
  75. 0 46
      package/boot/fconfig/Makefile
  76. 1 1
      package/boot/grub2/Makefile
  77. 71 0
      package/boot/grub2/patches/0008-Fix-packed-not-aligned-error-on-GCC-8.patch
  78. 40 0
      package/boot/grub2/patches/300-CVE-2015-8370.patch
  79. 75 0
      package/boot/grub2/patches/400-R_X86_64_PLT32.patch
  80. 1 1
      package/boot/uboot-envtools/Makefile
  81. 1 0
      package/boot/uboot-envtools/files/ar71xx
  82. 27 0
      package/boot/uboot-envtools/files/ath79
  83. 3 0
      package/boot/uboot-envtools/files/ipq40xx
  84. 3 0
      package/boot/uboot-envtools/files/ipq806x
  85. 1 0
      package/boot/uboot-envtools/files/kirkwood
  86. 25 0
      package/boot/uboot-envtools/files/layerscape
  87. 2 1
      package/boot/uboot-envtools/files/mvebu
  88. 0 57
      package/boot/uboot-omap/Makefile
  89. 0 8
      package/boot/uboot-omap/files/uEnv-default.txt
  90. 0 14
      package/boot/uboot-omap/patches/101-disable-thumb-omap3.patch
  91. 0 44
      package/boot/uboot-omap/patches/102-minify-spl.patch
  92. 0 27
      package/boot/uboot-omap/patches/103-disable-fat-write-spl.patch
  93. 0 18
      package/boot/uboot-omap/patches/104-omap3-overo-enable-thumb.patch
  94. 0 309
      package/boot/uboot-omap/patches/105-serial-ns16550-bugfix-ns16550-fifo-not-enabled.patch
  95. 27 6
      package/boot/uboot-sunxi/Makefile
  96. 2 2
      package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch
  97. 1 1
      package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch
  98. 1 1
      package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch
  99. 2 2
      package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch
  100. 1 1
      package/boot/uboot-sunxi/patches/100-sun6i-alternate-on-UART2.patch

+ 4 - 2
Makefile

@@ -14,7 +14,7 @@ export TOPDIR LC_ALL LANG TZ
 
 empty:=
 space:= $(empty) $(empty)
-$(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt directory must not include any spaces))
+$(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the libreCMC directory must not include any spaces))
 
 world:
 
@@ -27,6 +27,8 @@ ifneq ($(OPENWRT_BUILD),1)
   export OPENWRT_BUILD
   GREP_OPTIONS=
   export GREP_OPTIONS
+  CDPATH=
+  export CDPATH
   include $(TOPDIR)/include/debug.mk
   include $(TOPDIR)/include/depends.mk
   include $(TOPDIR)/include/toplevel.mk
@@ -85,7 +87,7 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
 	fi
 
 checksum: FORCE
-	$(call sha256sums,$(BIN_DIR))
+	$(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))
 
 diffconfig: FORCE
 	mkdir -p $(BIN_DIR)

+ 11 - 2
config/Config-images.in

@@ -149,6 +149,7 @@ menu "Target Images"
 			int "Block size (in KiB)"
 			depends on TARGET_ROOTFS_SQUASHFS
 			default 64 if LOW_MEMORY_FOOTPRINT
+			default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
 			default 256
 
 	menuconfig TARGET_ROOTFS_UBIFS
@@ -230,6 +231,14 @@ menu "Target Images"
 		help
 		  If you don't know, 5 seconds is a reasonable default.
 
+	config GRUB_TITLE
+		string "Title for the menu entry in GRUB"
+		depends on GRUB_IMAGES
+		default "OpenWrt"
+		help
+		  This is the title of the GRUB menu entry.
+		  If unspecified, it defaults to OpenWrt.
+
 	config VDI_IMAGES
 		bool "Build VirtualBox image files (VDI)"
 		depends on TARGET_x86 || TARGET_x86_64
@@ -259,12 +268,12 @@ menu "Target Images"
 
 	config TARGET_KERNEL_PARTSIZE
 		int "Kernel partition size (in MB)"
-		depends on GRUB_IMAGES
+		depends on GRUB_IMAGES || USES_BOOT_PART
 		default 16
 
 	config TARGET_ROOTFS_PARTSIZE
 		int "Root filesystem partition size (in MB)"
-		depends on GRUB_IMAGES || TARGET_ROOTFS_EXT4FS || TARGET_rb532 || TARGET_mvebu || TARGET_uml
+		depends on GRUB_IMAGES || USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_mvebu || TARGET_rb532 || TARGET_sunxi || TARGET_uml
 		default 256
 		help
 		  Select the root filesystem partition size.

+ 51 - 3
config/Config-kernel.in

@@ -31,7 +31,7 @@ config KERNEL_CRASHLOG
 
 config KERNEL_SWAP
 	bool "Support for paging of anonymous memory (swap)"
-	default y
+	default y if !SMALL_FLASH
 
 config KERNEL_DEBUG_FS
 	bool "Compile the kernel with debug filesystem enabled"
@@ -65,6 +65,27 @@ config KERNEL_PROFILING
 	  Enable the extended profiling support mechanisms used by profilers such
 	  as OProfile.
 
+config KERNEL_TASKSTATS
+	bool "Compile the kernel with task resource/io statistics and accounting"
+	default n
+	help
+	  Enable the collection and publishing of task/io statistics and
+	  accounting.  Enable this option to enable i/o monitoring in system
+	  monitors.
+
+if KERNEL_TASKSTATS
+
+	config KERNEL_TASK_DELAY_ACCT
+		def_bool y
+
+	config KERNEL_TASK_IO_ACCOUNTING
+		def_bool y
+
+	config KERNEL_TASK_XACCT
+		def_bool y
+
+endif
+
 config KERNEL_KALLSYMS
 	bool "Compile the kernel with symbol table information"
 	default y if !SMALL_FLASH
@@ -112,7 +133,7 @@ config KERNEL_DEBUG_KERNEL
 
 config KERNEL_DEBUG_INFO
 	bool "Compile the kernel with debug information"
-	default y
+	default y if !SMALL_FLASH
 	select KERNEL_DEBUG_KERNEL
 	help
 	  This will compile your kernel and modules with debug information.
@@ -205,7 +226,7 @@ config KERNEL_COREDUMP
 config KERNEL_ELF_CORE
 	bool "Enable process core dump support"
 	select KERNEL_COREDUMP
-	default y
+	default y if !SMALL_FLASH
 
 config KERNEL_PROVE_LOCKING
 	bool "Enable kernel lock checking"
@@ -785,3 +806,30 @@ config KERNEL_DEVKMEM
 	  Say Y here if you want to support the /dev/kmem device. The
 	  /dev/kmem device is rarely used, but can be used for certain
 	  kind of kernel debugging operations.
+
+config KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE
+	int "Number of squashfs fragments cached"
+	default 2 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
+	default 3
+
+#
+# compile optimiziation setting
+#
+choice
+	prompt "Compiler optimization level"
+	default KERNEL_CC_OPTIMIZE_FOR_SIZE if SMALL_FLASH
+
+config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE
+	bool "Optimize for performance"
+	help
+	  This is the default optimization level for the kernel, building
+	  with the "-O2" compiler flag for best performance and most
+	  helpful compile-time warnings.
+
+config KERNEL_CC_OPTIMIZE_FOR_SIZE
+	bool "Optimize for size"
+	help
+	  Enabling this option will pass "-Os" instead of "-O2" to
+	  your compiler resulting in a smaller kernel.
+
+endchoice

+ 0 - 96
docs/Basic_Wireless_Settings.md

@@ -1,96 +0,0 @@
-# Basic Wireless Settings
-
-This document is only intended to cover the most basic details of
-Wi-Fi settings on LibreCMC, for people who do not know much about
-computer networking. Geeks are encouraged to simply log in
-to `192.168.10.1` and experiment with the settings.
-
-## Log in to the LuCi configuration interface
-
-First, you need a physical connection to the LibreCMC Wi-Fi
-router. The simplest way is to connect an Ethernet cable between the
-Ethernet port on your computer, and the LAN port on your router. An
-Ethernet cable is like a fat telephone cable; usually you get one
-included with your router. Tablets and smart phones usually don't have
-an Ethernet port, so you might need to borrow a laptop.
-
-* In the address bar of your Web browser, enter the address
-  `192.168.10.1` and press `Enter` or `Return`. You should see a page
-  appear called `Authorization Required`.
-
-* If you see instead a page complaining that the connection is not
-  secure, you will need to add a security exception. On Mozilla
-  Firefox, you press the `Advanced` button and then the `Add
-  Exception` button, and then the `Confirm Security Exception`
-  button.
-  
-* Enter the adminstrative Username and Password for your router. The
-  default is `root` for the Username and a blank password.
-
-![alt text](images/librecmc-default-login.png "Default login page for
- LibreCMC")
-
-If a blank password does not work, and you cannot figure out what it
-is supposed to be, you may need to
-[reset the router](Router_Reset_Instructions.md).
-
-If you are unable to view the `Authorization Required` page, it may be
-that you do not have your Ethernet cable connected to the correct
-ports, or your computer is not set to allow use of the Ethernet
-cable. Find a tech savvy relative to help you out.
-
-## Change the name of your Wi-Fi network
-
-* Select the `Network` >> `Wireless` menu.
-
-* Select the `Edit` button to the right side of "libreCMC".
-
-* Scroll down to the `ESSID` text field under the `Interface
-  Configuration` section. and enter the name you would like for your
-  Wi-Fi network. This is the name people will see when they are
-  looking to connect to your Wi-Fi network.
-
-![alt text](images/librecmc-changing-essid.png "Changing ESSID on LibreCMC")
-
-* If that is all you wanted to do, press the `Save & Apply` button at
-  the bottom of the page, or go on to the next section.
-
-## Change your Wi-Fi password
-
-* If you haven't already, Select the `Network` >> `Wireless` menu, and
-  select the `Edit` button to the right side of "libreCMC".
-
-* Select the `Wireless Security` tab under the `Interface
-  Configuration` section.
-
-* In the `Encryption` drop down menu select `WPA2-PSK`. (If you have
-  some really old devices on your network, it may be necessary to
-  select `WPA-PSK` instead, to get them to connect, but don't do this
-  unless you really need to.)
-
-* In the `Key` text field, put in the password you want people to use
-  to connect to your Wi-Fi network. If you press the green arrows
-  button, it will make it easier to type in the password.
-
-![alt text](images/librecmc-changing-wifi-password.png "Changing Wi-Fi
- password on LibreCMC")
-
-* Press the `Save & Apply` button at the bottom of the page.
-
-## Change your Administrator password
-
-* There is a password used for logging into the LuCi configuration
-  interface. You typically want this to be different than the Wi-Fi password you share with other people.
-
-* Select the `System` >> `Administration` menu.
-
-* Under `Router Password` section, type a new password into the
-  `Password` text field. Pressing the green arrows button makes it
-  easier to type in your password.
-
-* Type the exact same password into the `Confirmation` text field.
-
-![alt text](images/librecmc-changing-admin-password.png "Changing
- admin password on LibreCMC")
-
-* Press the `Save & Apply` button at the bottom of the page.

+ 0 - 101
docs/Bridge_Mode.md

@@ -1,101 +0,0 @@
-# Bridge Mode
-
-A common feature of COTS Wi-Fi routers is to be able to set the router
-to bridge mode, where the devices stops acting like an IP router
-(layer 3) and starts acting like an ethernet switch (layer
-2). LibreCMC does not actually have a bridge mode, but the same effect
-is achievable with two easy steps.
-
-1. Add the WAN ethernet port to the LAN bridge interface
-2. Set the DHCP server to ignore the LAN interface
-
-## Adjust the LAN bridge interface
-
-Go to the Network >> Interfaces page and press the EDIT button next to
-the LAN Network. Select the Physical Settings tab.
-
-![alt text](images/librecmc-default-interfaces.png "LibreCMC default
- interfaces view")
-
-Place a checkmark in the box for the "eth0" interface for wan and
-wan6. (I suppose the interface name might vary amongst different
-routers.)
-
-![alt text](images/librecmc-eth0-added-to-lan.png "Adjustments to
- LibreCMC interface physical settings")
-
-You can also check the box for Enable STP if desired. There doesn't
-seem to be any downside from this, though I suppose it would use a
-little more CPU cycles and memory. STP is a protocol intended to
-prevent infinite communication loops from forming in a network of
-layer 2 switches.
-
-## Adjust DHCP server settings
-
-On the same page, scroll down a little to the DHCP Server section. In
-the General Setup tab, check the "Ignore interface" box.
-
-![alt text](images/librecmc-dhcp-server-ignore-lan.png "Setting
- LibreCMC DHCP server to ignore LAN interface")
-
-Save and apply your changes.
-
-## Communicating with LibreCMC in "bridge mode"
-
-Now that the DHCP server is turned off, the next time you connect to
-the libreCMC device, you will not be able to communicate with it. You
-must set your connecting device manually to be on the same
-subnet. Since the default libreCMC LAN IP address is 192.168.10.1/24,
-it should work to set your connecting device to IP address
-192.168.10.2/24.On Gnu/Linux systems, the command is usually `ip addr
-add 192.168.10.2/24 dev eth0` or `dev wlan0` if connecting wirelessly.
-
-Alternatively, you may set the libreCMC device to receive an IP
-address from another DHCP server on your network: go to back to the
-Network >> Interfaces page, press the EDIT button again next to the
-LAN Network, select the General Setup tab, and switch the Protocol
-from "Static address" to "DHCP client". (It seems that in LibreCMC,
-bridging the LAN interface to the WAN port disables the operation of
-the DHCP client on the WAN interface.) Of course, if you do this, be
-sure that your DHCP server has reserved a memorable IP address for the
-LibreCMC device's MAC address, so you don't have trouble finding it.
-
-![alt text](images/librecmc-switch-lan-to-dhcp.png)
-
-## Advanced
-
-These adjustments are not required, but they lead to a configuration
-which will be more consistent and have cleaner logs.
-
-### Disabling odhcpd (DHCP daemon)
-
-In bridge mode, you aren't going to want to serve DHCP out any
-interface. So you might as well just shut down the whole DHCP
-server. Log in via SSH, and run the commands:
-
-```
-/etc/init.d/odhcpd stop
-/etc/init.d/odhcpd disable
-```
-
-### Delete the WAN(6) interfaces
-
-From `Network` >> `Interfaces`, you can delete the WAN and WAN6
-interfaces. See also the "Add a LAN6 interface" section below.
-
-### Delete the WAN Firewall Zone
-
-From `Network` >> `Firewall` you can delete the WAN zone. If you do
-need a WAN firewall, then you should not be running in bridge mode in
-the first place.
-
-### Add a LAN6 Interface
-
-If you have IPv6 access, you will want an interface which receives an
-IPv6 address. From `Network` >> `Interfaces` create a new interface
-called `LAN6` with `Protocol` set to `DHCPv6 client`.
-
-You will likely also want to disable `odhcpd` (see above). Otherwise
-your logs can get filled up with unnecessary IPv6 related messages, as
-libreCMC tries to act like an IPv6 router. `odhcpd` normally handles
-DHCPv6 as well as IPv6 Router Advertisements.

+ 0 - 46
docs/GL-AR300M.md

@@ -1,46 +0,0 @@
-# GL.iNet AR300M
-
-## Hardware Specs
-
-* SoC : Qualcomm Atheros QCA9531
-* Flash ROM : 16 MB Nor + 128 MB Nand
-* RAM : 128 MB
-
-## Flashing from factory
-
-### Using GL.iNet's U-boot-mod and web UI
-
-1) Set computer IP address to 192.168.1.2
-
-2) Connect the enternet from the computer to "lan" port on the router
-
-3) Press and hold the reset button, and power on the router by plugging in the power
-
-4) Wait until the LED flashes once and red LED flashes 5 times before releasing the reset button.
-
-5) Open IP address in the browser 192.168.1.1
-
-6) Select the .img for NAND and .bin for NOR
-
-
-## Tested
-
-* v1.4.2 librecmc-ar71xx-nand-gl-ar300m-ubi-factory.img
-
-## Reset Instructions
-
-????
-
-## Notes:
-
-* This router is currently not officially supported by Librecmc
-
-* This router is dual flash and stock uboot attempts to boot nand flash first.
-
-* NOR flash uses .bin image and NAND flash uses .img image.
-
-* Use librecmc-ar71xx-nand-gl-ar300m-squashfs-sysupgrade.tar to update NAND installations
-
-* Default router ip is 192.168.10.1
-
-* On KDE, Disable change ipv4 method from automatic to manual to set the computer ip to 192.168.1.2.

+ 0 - 15
docs/Image_Support.md

@@ -1,15 +0,0 @@
-# libreCMC image support
-
-libreCMC is distributed in 3 different flavors: main, core and legacy. 
-Each image type is for a specific use case or to extend support for a 
-specific class of devices.
-
-
-| image type | Web-ui support    |Package Management | Min. Flash Size | Target Examples     | Use Case |
-|-----------:|-------------:|------------------:|-----------:|--------------------:|---------:|
-| Main     | Yes          | Yes	        | 8M      |                  | Easy to use |
-| Core       | No           | Yes               | 4M      |            | Minimal, more control | 
-| Legacy    | No	    | No	        | 4M	     | TL-WR741ND, TL-WR841ND,TPE-NWIFIROUTER* | Easy to use for legacy targets... |
-
-
-# NOT READY YET!

+ 0 - 203
docs/Layer_2_OpenVPN.md

@@ -1,203 +0,0 @@
-# Layer 2 OpenVPN
-
-## Introduction
-
-Librecmc can operate as an OpenVPN server. OpenVPN technology connects
-two networks via an encrypted tunnel. With proper server, network, and
-client configuration, OpenVPN allows a client outside of your LAN to
-see the LAN as though it were physically connected to the LAN.
-
-OpenVPN can run in layer 2 or layer 3 mode. In layer 3 mode, the
-remote client sees your LAN as though it is on the other side of an IP
-router. In layer 2 mode, the remote client sees your LAN as though
-they are both on the same Data Link segment (e.g., the same Ethernet
-link). Layer 3 mode is easier to set up, but layer 2 mode is sometimes
-desired to give clients a more direct exposure to services on the LAN.
-
-The scenario we are targeting here is to have:
-
-- An OpenVPN server running on a libreCMC system which can receive
-  traffic from the Internet.
-- An OpenVPN client running on a libreCMC system somewhere else in the
-  Internet. The client can be hidden behind a NAT.
-
-## Warnings
-
-This information is provided for educational purposes only and is not
-meant to be a guide to best network security practices. Readers are
-advised to study all relevant OpenVPN and network security
-documentation.
-
-## Server Setup and Configuration
-
-### Required LibreCMC packages
-
-* openvpn-openssl
-* openvpn-easy-rsa
-* luci-app-openvpn
-
-### Interface Setup
-
-In LuCi, select `Network` >> `Interfaces` and then `Add New Interface`.
-
-- Set `Name of the new interface` to `l2server`.
-- Set `Protocol of the new interface` to unmanaged.
-- Set `Cover the following interface` to `Custom Interface: vpn0`.
-
-In my working configuration, I added tap0 into the LAN bridge
-interface, and deleted the WAN interface. However, my vpn server is a
-separate unit on my network, intended to operate in "bridge mode",
-where if you server is your gateway router, a different configuration
-might be necessary.
-
-### Certificate and Key Setup Instructions
-
-```
-cd /etc/easy-rsa
-source vars
-clean-all
-build-ca
-build-dh
-build-key-server l2server
-openvpn --genkey --secret /etc/easy-rsa/keys/ta.key
-mkdir -m 700 /etc/openvpn/keys
-mv ca.crt l2server.crt l2server.key dh2018.pem /etc/openvpn/keys
-```
-
-N.B.: Using easy-rsa is a straightforward approach, but it may be
-possible to produce more secure certificates using openssl directly.
-
-### Generating a Client Key
-
-```
-build-key l2client
-```
-
-In the server-client configuration we are aiming for here, your client
-key needs to be unencrypted (i.e., not password protected).
-
-### Server configuration
-
-For the `server bridge` option: The first two parameters are the ip
-and netmask of the gateway on the bridged subnet. The next two
-parameters indicate the pool-start-IP and pool-end-IP, which is the
-part of your IP address pool that you have reserved just for VPN
-clients. You must to make sure that the DHCP server for your LAN is
-not leasing out those IP addresses to local (non-vpn) clients.
-
-```
-uci set openvpn.l2server=openvpn
-uci set openvpn.l2server.enabled='1'
-uci set openvpn.l2server.dev='tap0'
-uci set openvpn.l2server.port='1194'
-uci set openvpn.l2server.proto='udp'
-uci set openvpn.l2server.keepalive='10 120'
-uci set openvpn.l2server.persist_key='1'
-uci set openvpn.l2server.persist_tun='1'
-uci set openvpn.l2server.user='nobody'
-uci set openvpn.l2server.group='nogroup'
-uci set openvpn.l2server.ca='/etc/openvpn/keys/ca.crt'
-uci set openvpn.l2server.cert='/etc/openvpn/keys/l2server.crt'
-uci set openvpn.l2server.key='/etc/openvpn/keys/l2server.key'
-uci set openvpn.l2server.dh='/etc/openvpn/keys/dh2048.pem'
-uci set openvpn.l2server.tls_server='1'
-uci set openvpn.l2server.tls_auth='/etc/openvpn/keys/ta.key 0'
-uci set openvpn.l2server.server_bridge='192.168.1.1 255.255.255.0 192.168.1.201 192.168.1.220'
-uci set openvpn.l2server.client_to_client='1'
-uci set openvpn.l2server.push='persist-key' 'persist-tun' 'redirect-gateway def1'
-uci set 'route 192.168.1.0 255.255.255.0' 'dhcp-option DNS 192.168.1.1'
-uci set openvpn.l2server.mute='15'
-uci set openvpn.l2server.verb='3'
-uci commit
-```
-
-### Firewall
-
-I do not want to describe firewall adjustments in this document, but
-the important point is that your server needs to be able to receive
-UDP packages from the Internet on port 1194.
-
-## Client Setup and Configuration
-
-This assumes the above configuration for the server.
-
-### Required LibreCMC packages
-
-* openvpn-openssl
-* luci-app-openvpn
-
-### Interface setup
-
-In LuCi, select `Network` >> `Interfaces` and then `Add New Interface`.
-
-- Set `Name of the new interface` to `l2client`.
-- Set `Protocol of the new interface` to unmanaged.
-- Set `Cover the following interface` to `Custom Interface: vpn0`.
-
-Adjust the LAN interface so that it bridges over the `vpn0` physical
-interface as well as the default `eth0` and `wlan0` interfaces. This
-is done from the `Network` >> `Interfaces` menu, pressing the `Edit`
-button next to `LAN`, and selecting the `Physical Settings` tab.
-
-### Certificate and key storage
-
-```
-mkdir -m 700 /etc/openvpn/keys
-```
-
-Client will the need `ca.crt`, `l2client.crt`, `l2client.key', and
-`ta.key` you generated in the server section, stored in the
-`/etc/openvpn/keys` directory.
-
-### Client configuration
-
-```
-uci set openvpn.l2client=openvpn
-uci set openvpn.l2client.float='1'
-uci set openvpn.l2client.client='1'
-uci set openvpn.l2client.dev='tap'
-uci set openvpn.l2client.reneg_sec='0'
-uci set openvpn.l2client.persist_key='1'
-uci set openvpn.l2client.nobind='1'
-uci set openvpn.l2client.remote_cert_tls='server'
-uci set openvpn.l2client.remote='remote.alaskasi.com'
-uci set openvpn.l2client.proto='udp'
-uci set openvpn.l2client.rport='1194'
-uci set openvpn.l2client.resolv_retry='infinite'
-uci set openvpn.l2client.mute_replay_warnings='1'
-uci set openvpn.l2client.key_direction='1'
-uci set openvpn.l2client.redirect_gateway='def1'
-uci set openvpn.l2client.enabled='1'
-uci set openvpn.l2client.ca='/etc/openvpn/keys/ca.crt'
-uci set openvpn.l2client.cert='/etc/openvpn/keys/l2client.crt'
-uci set openvpn.l2client.key='/etc/openvpn/keys/l2client.key'
-uci set openvpn.l2client.tls_auth='/etc/openvpn/keys/ta.key 1'
-uci set openvpn.l2client.mute='15'
-uci set openvpn.l2client.verb='3'
-uci commit
-```
-
-## Troubleshooting
-
-You are likely to run into one of two issues:
-
-- Either your client or your server is not receiving UDP packets from the other.
-- You have an error in the server or client configurations.
-- There is some problem with the keys or certificates, or they are
-  in the wrong location.
-
-These are some useful tools:
-
-- Without OpenVPN even running, you can use the `nc` program (netcat)
-  to send UDP packets from the client to the server, and then use the
-  `tcpdump` program on the server to see if the UDP packets are
-  arriving at port 1194. The syntax of these programs will not be
-  covered in this document.
-
-- The log output on the server and on the client is very helpful. Run
-  `logread` to view the log or `logread && logread -f` to monitor for
-  log messages. If you find an OpenVPN error, use that in conjunction
-  with the OpenVPN manual page, to figure out what needs to be
-  tweaked.[1]
-
-[1] [https://openvpn.net/index.php/open-source/documentation/manuals.html]

+ 61 - 103
docs/OpenVPN_Layer_2_Server.md

@@ -1,103 +1,61 @@
-# OpenVPN Layer 2 Server
-
-## Introduction
-
-Librecmc can operate as an OpenVPN server. OpenVPN technology connects
-two networks via an encrypted tunnel. With proper server, network, and
-client configuration, OpenVPN allows a client outside of your LAN to
-see the LAN as though it were physically connected to the LAN.
-
-OpenVPN can run in layer 2 or layer 3 mode. In layer 3 mode, the
-remote client sees your LAN as though it is on the other side of an IP
-router. In layer 2 mode, the remote client sees your LAN as though
-they are both on the same Data Link segment (e.g., the same Ethernet
-link). Layer 3 mode is easier to set up, but layer 2 mode is sometimes
-desired to give clients a more direct exposure to services on the LAN.
-
-## Warnings
-
-This information is provided for educational purposes only and is not
-meant to be a guide to best network security practices. Readers are
-advised to study all relevant OpenVPN and network security
-documentation.
-
-## Required LibreCMC packages
-
-* openvpn-openssl
-* openvpn-easy-rsa
-* luci-app-openvpn
-
-## Interface Setup
-
-In LuCi, select `Network` >> `Interfaces` and then `Add New Interface`.
-
-- Set `Name of the new interface` to `myvpn` or anything else you would like.
-- Set `Protocol of the new interface` to unmanaged.
-- Set `Cover the following interface` to `Custom Interface: vpn0`.
-- In my current working system, the `firewall-zone` for the interface
-  is set to `lan`, but I don't think that really matters in this case.
-
-In my working configuration, I added tap0 into the LAN bridge
-interface, and deleted the WAN interface. However, my vpn server is a
-separate unit on my network, intended to operate in "bridge mode",
-where if you server is your gateway router, a different configuration
-might be necessary.
-
-## Certificate and Key Setup Instructions
-
-```
-cd /etc/easy-rsa
-source vars
-clean-all
-build-ca
-build-dh
-build-key-server myvpn
-openvpn --genkey --secret /etc/easy-rsa/keys/ta.key
-mkdir -m 700 /etc/openvpn/keys
-mv ca.crt myvpn.crt myvpn.key dh2018.pem /etc/openvpn/keys
-```
-
-N.B.: Using easy-rsa is a straightforward approach, but it may be
-possible to produce more secure certificates using openssl directly.
-
-## Server configuration
-
-For the `server bridge` option: The first two parameters are the ip
-and netmask of the gateway on the bridged subnet. The next two
-parameters indicate the pool-start-IP and pool-end-IP, which is the
-part of your IP address pool that you have reserved just for VPN
-clients. You must to make sure that the DHCP server for your LAN is
-not leasing out those IP addresses to local (non-vpn) clients.
-
-/etc/config/openvpn
-```
-config openvpn 'myvpn'
-	option enabled '1'
-	option dev 'tap0'
-	option port '1194'
-	option proto 'udp'
-	option keepalive '10 120'
-	option persist_key '1'
-	option persist_tun '1'
-	option user 'nobody'
-	option group 'nogroup'
-	option ca '/etc/openvpn/keys/ca.crt'
-	option cert '/etc/openvpn/keys/myvpn.crt'
-	option key '/etc/openvpn/keys/myvpn.key'
-	option dh '/etc/openvpn/keys/dh2048.pem'
-	option tls_server '1'
-	option tls_auth '/etc/openvpn/keys/ta.key 0'
-	option server_bridge '10.0.0.1 255.255.255.0 10.0.0.201 10.0.0.220'
-	option client_to_client '1'
-	list push 'persist-key'
-	list push 'persist-tun'
-	list push 'redirect-gateway def1'
-	list push 'route 10.0.0.0 255.255.255.0'
-	list push 'dhcp-option DNS 10.0.0.1'
-	option mute '15'
-	option verb '3'
-```
-
-## Client setup information
-
-TODO
+# OpenVPN Layer 2 Server
+
+## Installing OpenVPN packages
+
+TODO
+
+## Interface Setup
+
+TODO
+
+## Certificate and Key Setup Instructions
+
+TODO
+
+## Server configuration
+
+For server bridge option: First two parameters are the ip/netmask of
+the gateway on the bridged subnet. Next two paraters indicate the
+pool-start-IP and pool-end-IP, which is the part of your IP address
+pool that you have reserved just for VPN clients. You have to make
+sure the DHCP server on the company network is not handing those out
+to on-site systems.
+
+/etc/config/openvpn
+```
+config openvpn 'myvpn'
+	option enabled '1'
+	option dev 'tap0'
+	option port '1194'
+	option proto 'udp'
+	option status '/var/log/openvpn_status.log'
+	option log '/tmp/openvpn.log'
+	option verb '3'
+	option mute '5'
+	option keepalive '10 120'
+	option persist_key '1'
+	option persist_tun '1'
+	option user 'nobody'
+	option group 'nogroup'
+	option ca '/etc/easy-rsa/keys/ca.crt'
+	option cert '/etc/easy-rsa/keys/myvpn.crt'
+	option key '/etc/easy-rsa/keys/myvpn.key'
+	option dh '/etc/easy-rsa/keys/dh2048.pem'
+	option tls_server '1'
+	option tls_auth '/etc/easy-rsa/keys/ta.key 0'
+	option server_bridge '10.0.0.1 255.255.255.0 10.0.0.201 10.0.0.220'
+	option topology 'subnet'
+	option client_to_client '1'
+	list push 'persist-key'
+	list push 'persist-tun'
+	list push 'redirect-gateway def1'
+	# allow your clients to access to your network
+	list push 'route 10.0.0.0 255.255.255.0'
+	# push DNS to your clients
+	list push 'dhcp-option DNS 10.0.0.1'
+        # option comp_lzo 'no'
+```
+
+## Client setup information
+
+TODO

+ 0 - 84
docs/Port_Forwards.md

@@ -1,84 +0,0 @@
-# Port Forwarding
-
-## What is port forwarding?
-
-Technically, port forwarding is the use of Network Address Translation
-(NAT) to map an IP address and port number to another IP address and
-port number. Typically you need this function to be able to expose a
-service running our your local network (LAN) to the Internet (WAN)
-which otherwise would be impossible because your LAN uses private,
-non-routable IP addresses; for example, if you are trying to run a
-gaming server or a Web page server from your home network.
-
-## Security Warnings
-
-Be aware that the use of port forwarding may create additional
-security holes into your local network. The local system(s) and
-service(s) you are exposing to the Internet must be free from security
-vulnerabilities, or this may allow a remote attacker to infiltrate
-your network.
-
-## LuCi Interface
-
-* Log into the LuCi Web interface, which by default is at address https://192.168.10.1
-
-* Select the `Network` >> `Firewall` menu.
-
-![alt text](images/librecmc-selecting-firewall-menu.png "Selecting the
- Firewall menu entry")
-
-* Select the `Port Forwards` tab.
-
-![alt text](images/librecmc-selecting-port-forwards-tab.png "Selecting the
- Port Forwards tab")
-
-* Under the `New Port forward` section, enter in the `Name` field a
-  brief description of the port forward, e.g., "HTTP server" for an
-  unencrypted Web page server.
-
-* Select a protocol from the `Protocol` field. Most services you can
-  run will be using the TCP protocol, but you can select `TCP+UDP` if
-  you aren't sure.
-
-* Usually, you will leave the `External zone` set to `wan`.
-
-* Enter a port number in the `External port` field. Typically this
-  will be the usual port number expected for a particular
-  service. E.g., HTTP servers use port 80. You are free to use
-  non-standard ports, but your remote clients may need to use special
-  techniques to connect to the correct port.
-
-* Usually, you will leave the `Internal zone` set to `lan`.
-
-* Select an IP address in the `Internal IP address` drop down menu. If
-  your server is using DHCP, you should see its hostname appear in the
-  list. If your server is has it's private IP address set statically,
-  select the `Custom` option at the bottom of the list, and enter in
-  the correct IP address in the text field that appears. Note that if
-  your server is using DHCP, you should be sure LibreCMC has a static
-  lease created for it (TODO: link to Static Leases documentation).
-
-* Enter a port number in the `Internal port` field. Typically this
-  will be the same as the external port, unless you have set your
-  server to work through a non-standard port, or you selected a
-  non-standard external port earlier.
-
-![alt text](images/librecmc-port-forwards-entering-parameters.png
- "Entering parameters for port forwarding")
-
-* Press the `Add` button to the right.
-
-* Press the `Save & Apply` button at the bottom of the page.
-
-![alt text](images/librecmc-port-forwards-after-save-apply.png
- "Port Forwards view after Save & Apply")
-
-## Port Numbers
-
-The official IANA port number list is available at
-
-[https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml]
-
-## Port Range
-
-(TODO: option for configuring a range of ports simultaneously)

+ 0 - 104
docs/Serial.md

@@ -1,104 +0,0 @@
-# Using a serial interface with U-boot and libreCMC
-
-A serial interface (console) provides a means of debugging or 
-unlocking features hidden from the user. Most computing devices 
-have a serial interface whether it is broken out by the manufacture or not.
-
-In the case of devices that run libreCMC, a serial console is used
-to configure U-boot and debug libreCMC if the network interface can't
-be brought up. These instructions outline the basics of using
-a serial console with a USB to serial cable.
-
-
-
-## The basics
-
-There are a few different standards for serial interfaces, but here we are
-providing just the basics. There are 3 different connections that we care 
-about : Transmit (TX), Receive (RX) and Ground (GND). Depending on the
-serial cable, the color coding could be different. The common coloration
-is RX is Green, TX is white and GND is black*.
-
-These three wires will be connected to a pin header on the board or might need
-to be soldered to pads. Many device manufactures are kind enough to provide a 
-header and indicate where the serial interface is. Look for silkscreen labeling
-with : GND, TX, RX. Sometimes additional work is needed to break out a stable
-serial interface.
-
-* Many serial cables ship with the color corresponding to the connection on the board, 
-so TX and RX are effectively reversed.
-
-Some routers use the following standard:
-```
-         __________________
-        |            |     |
-        | .   .   .  |  .  |              <- Inside of the router (you may need to do some soldering)
-        |____________|_____|
-                 
-          |   |    \     \
-          *  GND   RX    TX
-```
-
-In this case, transmit is in the marked off box.
-
-
-
-```
-         _________________
-        |                 |
-        | .   .   .    .  |             
-      * |_________________|
-
-          |   |    \     \
-        GND   RX    TX   Vcc
-
-```
-
-Some might use a dot to indicate GND, etc...
-
-TPE-R1100 example:
-
-![alt text](images/serial.png "TPE-R1100 Serial")
-
-Warning: NEVER connect the red wire to the device / router! You will most likely fry it because
-many routers use 3.3V for Vcc instead of the 5V provided by USB.
-
-## Getting a console
-
-In order to communicate with the device, we need a terminal application to interact with
-the serial port provided by the USB to serial cable. In this case, we are going to use GNU Screen.
-Make sure that the GNU Screen package is installed and make sure that your user is part of the 
-`dialout` group.
-
-Before we can use the terminal application, we need to know the baud rate at which the serial
-console will be provided. With most devices running libreCMC and u-boot, this most likely will
-be 115200
-
-## Putting it all together
-
-
-1) Plug in / wire up the serial cable to the board.
-
-2) Plug the USB part of the serial cable into an available USB port.
-
-3) run `screen /dev/ttyUSB0 115200` or (if you are NOT part of the `dialout` group) `sudo screen /dev/ttyUSB0 115200`
-Please note that the serial device might have a different name (ttyUSB(n), ttyS0, etc...).
-
-4) Power on the device you are connecting to.
-
-5) You should see ledgible ASCII text scroll by.
-
-If the device gets all the way through the boot process, the libreCMC banner will appear with
-a shell prompt:
-
-```
-                    ____  _____  ____
-  _ _ _            |  __||     ||  __|
- | (_) |__ _ _ ___ | |   | | | || |
- | | | '_ \ '_/ -_)| |__ | | | || |__
- |_|_|_.__/_| \___||____||_|_|_||____|
- -----------------------------------------
-
-root@libreCMC:~#
-
-```

+ 0 - 32
docs/Soft_Brick_Recovery_With_IPv6.md

@@ -1,32 +0,0 @@
-# Soft Brick Recovery With IPv6
-
-## Use Case
-
-If you recklessly experiment with your libreCMC networking settings, it is likely you will eventually cause a "soft brick". Typically, this means you have messed up your IPv4 network configuration in such as way that you cannot connect to the LuCi control panel, nor connect to the busybox shell via SSH. One option is to figure out how to reload the firmware and start over from scratch. Something that might be easier, though, is to instead use IPv6 to connect to the router. This is usually possible for two reasons: (1) libreCMC has IPv6 enabled by default; (2) IPv6 has link-level autoconfiguration.
-
-## Determine the router's link local IPv6 Address and interface name.
-
-Connect a Gnu/Linux computer to the LAN port of the libreCMC router. Then run the `ip neigh` command. You are looking for a `REACHABLE lladdr` address that starts with `fe80`. For example:
-
-```
-christopher@evenstar:~$ ip neigh
-fe80::280:aeff:fece:5a21 dev eth0 lladdr 00:80:ae:ce:5a:21 router REACHABLE
-```
-
-Here, `fe80::280:aeff:fece:5a21` is the IPv6 address, and `eth0` is the name of the interface.
-
-## Log in to the router
-
-Unforunately, a link local IPv6 address usually cannot be used to directly connect to the LuCi control panel. This is because Web browsers are usually programmed not to process such addresses. However, you can use SSH to connect to the busybox shell, with a command like so:
-
-```
-ssh root@fe80::280:aeff:fece:5a21%eth0
-```
-
-Replace `fe80::280:aeff:fece:5a21` with the IPv6 address of your router, and `eth0` with the correct interface name.
-
-## What next?
-
-Once you are logged into the busybox shell, you can use the `ip addr` command to see what is the actual state of your IPv4 network configuration. If you understand IPv4, it may be sufficient to use `ip addr add` to add an IPv4 address, which you can then use to connect to the LuCi control panel. If the IPv4 configuration is okay, you may be having a problem with the dnsmasq dhcp server, or the LuCi Web service itself may be down, for some reason. Use the `logread` command to look for errors or warnings.
-
-If you are still not sure what to do, you can ask for help on the libreCMC IRC channel or libreCMC email list.

+ 37 - 37
docs/Supported_Hardware.md

@@ -1,37 +1,37 @@
-# libreCMC supported Hardware
-
-### Buffalo
-* [WZR-HP-G300NH](/WZR_HP_G300NH.md)
-* WHR-HP-G300NH
-
-### Netgear 
-
-* [WNDR3800](/WNDR3800.md)
-
-### TP-link 
-
-* [TL-MR3020 v1](/TL_MR3020.md) 
-* [TL-WR741ND](/TL_WR741ND.md)
-* [TL-WR841ND](/TL_WR841ND.md)
-* [TL-WR842ND](/TL_WR842ND.md)
-* [TL-WR1043ND](/TL_WR1043ND.md)
-
-### ThinkPenguin
-* [TPE-NWIFIROUTER2](/TPE_NWIFIROUTER2.md)
-* [TPE-R1100](/TPE_R1100.md)
-
-### Qi-Hardware
-
-* [Ben Nanonote](/Ben_Nanonote.md)
-
-## Tested Hardware
-
-[List of tested hardware](/List_of_Tested_Hardware.md)
-
-# libreCMC unofficially supported Hardware
-
-### D-Link
-
-* DGL-5500 a1 : Ships with non-free wifi card, but can be replaced with a free one. Has a mini-pci-e card slot.
-
-#####Please note that other targets may work; we are **NOT** responsible for **ANY** _bricked_ devices.
+# libreCMC supported Hardware
+
+### Buffalo
+* [WZR-HP-G300NH](/WZR_HP_G300NH.md)
+* WHR-HP-G300NH
+
+### Netgear 
+
+* [WNDR3800](/WNDR3800.md)
+
+### TP-link 
+
+* [TL-MR3020 v1](/TL_MR3020.md) 
+* [TL-WR741ND](/TL_WR741ND.md)
+* [TL-WR841ND](/TP_WR841ND.md)
+* [TL-WR842ND](/TL_WR842ND.md)
+* [TL-WR1043ND](/TL_WR1043ND)
+
+### ThinkPenguin
+* [TPE-NWIFIROUTER2](/TPE_NWIFIROUTER2.md)
+* [TPE-R1100](/TPE_R1100.md)
+
+### Qi-Hardware
+
+* [Ben Nanonote](/Ben_Nanonote.md)
+
+## Tested Hardware
+
+[List of tested hardware](/List_of_Tested_Hardware.md)
+
+# libreCMC unofficially supported Hardware
+
+### D-Link
+
+* DGL-5500 a1 : Ships with non-free wifi card, but can be replaced with a free one. Has a mini-pci-e card slot.
+
+#####Please note that other targets may work; we are **NOT** responsible for **ANY** _bricked_ devices.

+ 0 - 67
docs/System_Log.md

@@ -1,67 +0,0 @@
-# System Log
-
-## Viewing the system log from LuCi
-
-Select the `Status >> System Log` menu entry.
-
-![alt text](images/librecmc-luci-selecting-system-log.png "Selecting
- the System Log page in LuCi")
-
-![alt text](images/librecmc-luci-system-log.png "The System Log page
- in LuCi")
-
-The `System Log` page in LuCi does not have an interface for filtering
-output. Therefore, you will likely want to use the shell interface.
-
-## Viewing the system log from the shell
-
-Once logged in via SSH, use the `logread` command
-
-```bash
-Usage: logread [options]
-Options:
-    -s <path>		Path to ubus socket
-    -l	<count>		Got only the last 'count' messages
-    -e	<pattern>	Filter messages with a regexp
-    -r	<server> <port>	Stream message to a server
-    -F	<file>		Log file
-    -S	<bytes>		Log size
-    -p	<file>		PID file
-    -h	<hostname>	Add hostname to the message
-    -P	<prefix>	Prefix custom text to streamed messages
-    -f			Follow log messages
-    -u			Use UDP as the protocol
-    -t			Add an extra timestamp
-    -0			Use \0 instead of \n as trailer when using TCP
-```
-
-For example:
-
-```bash
-root@libreCMC:~$ logread | grep 'kern\.warn'
-Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.000000] No valid device tree found, continuing without
-Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
-Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
-Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.669305] Crashlog allocated RAM at address 0x3f00000
-Mon Jan 15 20:22:01 2018 kern.warn kernel: [    0.752178] m25p80 spi0.0: found mx25l12805d, expected m25p80
-```
-
-One should be able to use `logread -e` instead of `grep`, but it seems
-that not all the same regular expressions work for both:
-
-```bash
-root@libreCMC:~$ logread -e 'kern\.warn' # and other similar variations
-(no output)
-```
-
-The system log is contained in a limited size, circular buffer in
-memory. So, if you have some process writing messages periodically,
-this will eventually erase messages that were only written once.
-
-## Configuring the system log
-
-TODO
-
-## Monitoring the system log
-
-TODO

+ 19 - 3
docs/TL_WR841ND.md

@@ -1,4 +1,6 @@
-# TP-WR841ND
+# TP-WR841N[D]
+
+TP-WR841N and TP-WR841ND is one and the same model, except TP-WR841ND has detachable antennas.
 
 ## Specs
 
@@ -20,6 +22,20 @@ DO NOT BUY v13!!! V13 contains a mediatek
 chipset, which requires a non-free firmware
 blob.
 
-## Reset instructions
+## Flashing from Web GUI
+
+Flashing instructions listed below were tested with TP-WR841N ver 8, with original firmware version 3.13.33.
+
+1. Reset to factory default state (don't really know if it's required, but definitely won't do any harm).
+2. Go to 192.168.0.1 and login with default credentials (admin/admin)
+3. Navigate to _System Tools -> Firmware Upgrade_ and provide factory bin file. Press Upgrade to perform flash.
+4. After router is flashed and restarted make sure to stop NetworkManager service (might not be required, but I couldn't access libreCMC web interface without stopping it).
+5. Go to 192.168.10.1 and login with default credentials (root/root).
+6. Navigate to _System-> Backup/Flash Firmware_ and in "Flash new firmware image" section provide sysupgrade bin file. Press Flash image to perform flash.
+7. After successfull flash NetworkManager can be started again.
+
+## Hard reset instructions
 
-???
+1. Press and hold RESET button for several seconds.
+2. Release the button when SYS (gear) led starts blinking.
+3. Wait for router to boot.

+ 1 - 1
docs/TPE_R1100.md

@@ -1,4 +1,4 @@
-# Think Penguin [TPE-R1100 mini WiFi Router](https://www.thinkpenguin.com/gnu-linux/free-software-wireless-n-mini-vpn-router-tpe-r1100)
+# Think Penguin [TPE-R1100 mini WiFi Router](https://www.thinkpenguin.com/TPE-R1100)
 
 ## Specs
 

BIN
docs/images/librecmc-changing-admin-password.png


BIN
docs/images/librecmc-changing-essid.png


BIN
docs/images/librecmc-changing-wifi-password.png


BIN
docs/images/librecmc-default-interfaces.png


BIN
docs/images/librecmc-default-login.png


BIN
docs/images/librecmc-dhcp-server-ignore-lan.png


BIN
docs/images/librecmc-eth0-added-to-lan.png


BIN
docs/images/librecmc-luci-selecting-system-log.png


BIN
docs/images/librecmc-luci-system-log.png


BIN
docs/images/librecmc-port-forwards-after-save-apply.png


BIN
docs/images/librecmc-port-forwards-entering-parameters.png


BIN
docs/images/librecmc-selecting-firewall-menu.png


BIN
docs/images/librecmc-selecting-port-forwards-tab.png


BIN
docs/images/librecmc-switch-lan-to-dhcp.png


BIN
docs/images/serial.png


+ 1 - 1
docs/unbrick_with_uboot_mod.md

@@ -16,7 +16,7 @@ After the 3rd flash, release the reset button (it may
 take some coordination. From power on to the release of
 the button is exactly 3 sec.
 
-7. Open a web browser and go to 192.168.1.1/index.html
+7. Open a web browser and go to 192.168.1/index.html
 
 8. Click the "browse" button and select the firmware image for your router
 

+ 1 - 1
feeds.conf.default

@@ -1 +1 @@
-src-git packages https://gogs.librecmc.org/libreCMC/package-feed.git;v1.4
+src-git packages https://gogs.librecmc.org/libreCMC/package-feed.git;v1.5

+ 2 - 2
include/cmake.mk

@@ -7,8 +7,8 @@ ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
 endif
 
 CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
-CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)
-HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)
+CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
+HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
 MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
 
 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)

+ 59 - 22
include/download.mk

@@ -19,17 +19,23 @@ endif
 
 DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
 
+define dl_method_git
+$(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git)
+endef
+
 # Try to guess the download method from the URL
 define dl_method
 $(strip \
-  $(if $(2),$(2), \
-    $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @SF/% @GNU/% @KERNEL_LIBRE/% @KERNEL/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \
-      $(if $(filter git://%,$(1)),git, \
-        $(if $(filter svn://%,$(1)),svn, \
-          $(if $(filter cvs://%,$(1)),cvs, \
-            $(if $(filter hg://%,$(1)),hg, \
-              $(if $(filter sftp://%,$(1)),bzr, \
-                unknown \
+  $(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)),
+    $(if $(2),$(2), \
+      $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL_LIBRE/% @KERNEL/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \
+        $(if $(filter git://%,$(1)),$(call dl_method_git,$(1),$(2)), \
+          $(if $(filter svn://%,$(1)),svn, \
+            $(if $(filter cvs://%,$(1)),cvs, \
+              $(if $(filter hg://%,$(1)),hg, \
+                $(if $(filter sftp://%,$(1)),bzr, \
+                  unknown \
+                ) \
               ) \
             ) \
           ) \
@@ -56,6 +62,10 @@ ifdef CHECK
 check_escape=$(subst ','\'',$(1))
 #')
 
+# $(1): suffix of the F_, C_ variables, e.g. hash_deprecated, hash_mismatch, etc.
+# $(2): filename
+# $(3): expected hash value
+# $(4): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH}
 check_warn_nofix = $(info $(shell printf "$(_R)WARNING: %s$(_N)" '$(call check_escape,$(call C_$(1),$(2),$(3),$(4)))'))
 ifndef FIXUP
   check_warn = $(check_warn_nofix)
@@ -71,11 +81,17 @@ F_hash_mismatch = $(F_hash_deprecated)
 F_hash_missing = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile add-hash $(3) $(call gen_sha256sum,$(1))
 endif
 
+# $(1): filename
+# $(2): expected hash value
+# $(3): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH}
 C_download_missing = $(1) is missing, please run make download before re-running this check
 C_hash_mismatch = $(3) does not match $(1) hash $(call gen_sha256sum,$(1))
 C_hash_deprecated = $(3) uses deprecated hash, set to $(call gen_sha256sum,$(1))
 C_hash_missing = $(3) is missing, set to $(call gen_sha256sum,$(1))
 
+# $(1): filename
+# $(2): expected hash value
+# $(3): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH}
 check_hash = \
   $(if $(wildcard $(DL_DIR)/$(1)), \
     $(if $(filter-out x,$(2)), \
@@ -116,6 +132,9 @@ define DownloadMethod/default
 	)
 endef
 
+# $(1): "check"
+# $(2): "PKG_" if <name> as in Download/<name> is "default", otherwise "Download/<name>:"
+# $(3): shell command sequence to do the download
 define wrap_mirror
 $(if $(if $(MIRROR),$(filter-out x,$(MIRROR_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || ( $(3) ),$(3)) \
 $(if $(filter check,$(1)), \
@@ -159,23 +178,41 @@ endef
 
 define DownloadMethod/git
 	$(call wrap_mirror,$(1),$(2), \
-		echo "Checking out files from the git repository..."; \
-		mkdir -p $(TMP_DIR)/dl && \
-		cd $(TMP_DIR)/dl && \
-		rm -rf $(SUBDIR) && \
-		[ \! -d $(SUBDIR) ] && \
-		git clone $(OPTS) $(URL) $(SUBDIR) && \
-		(cd $(SUBDIR) && git checkout $(VERSION) && \
-		git submodule update --init --recursive) && \
-		echo "Packing checkout..." && \
-		export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
-		rm -rf $(SUBDIR)/.git && \
-		$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
-		mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
-		rm -rf $(SUBDIR); \
+		$(call DownloadMethod/rawgit) \
+	)
+endef
+
+define DownloadMethod/github_archive
+	$(call wrap_mirror,$(1),$(2), \
+		$(SCRIPT_DIR)/dl_github_archive.py \
+			--dl-dir="$(DL_DIR)" \
+			--url="$(URL)" \
+			--version="$(VERSION)" \
+			--subdir="$(SUBDIR)" \
+			--source="$(FILE)" \
+			--hash="$(MIRROR_HASH)" \
+		|| ( $(call DownloadMethod/rawgit) ); \
 	)
 endef
 
+# Only intends to be called as a submethod from other DownloadMethod
+define DownloadMethod/rawgit
+	echo "Checking out files from the git repository..."; \
+	mkdir -p $(TMP_DIR)/dl && \
+	cd $(TMP_DIR)/dl && \
+	rm -rf $(SUBDIR) && \
+	[ \! -d $(SUBDIR) ] && \
+	git clone $(OPTS) $(URL) $(SUBDIR) && \
+	(cd $(SUBDIR) && git checkout $(VERSION) && \
+	git submodule update --init --recursive) && \
+	echo "Packing checkout..." && \
+	export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
+	rm -rf $(SUBDIR)/.git && \
+	$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
+	mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
+	rm -rf $(SUBDIR);
+endef
+
 define DownloadMethod/bzr
 	$(call wrap_mirror,$(1),$(2), \
 		echo "Checking out files from the bzr repository..."; \

+ 6 - 11
include/feeds.mk

@@ -10,17 +10,11 @@
 
 FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*))
 FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n))
-FEEDS_ENABLED:=$(foreach feed,$(FEEDS_AVAILABLE),$(if $(CONFIG_FEED_$(feed)),$(feed)))
-FEEDS_DISABLED:=$(filter-out $(FEEDS_ENABLED),$(FEEDS_AVAILABLE))
 
 PACKAGE_SUBDIRS=$(PACKAGE_DIR)
 ifneq ($(CONFIG_PER_FEED_REPO),)
   PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base
-  ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
-    PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
-  else
-    PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_ENABLED),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
-  endif
+  PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
 endif
 
 opkg_package_files = $(wildcard \
@@ -39,10 +33,11 @@ endef
 # 1: destination file
 define FeedSourcesAppend
 ( \
-  echo "src/gz %d_core %U/targets/%S/packages"; \
+  echo 'src/gz %d_core %U/targets/%S/packages'; \
   $(strip $(if $(CONFIG_PER_FEED_REPO), \
-	$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %d_$(feed) %U/packages/%A/$(feed)";) \
-	$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
-		$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %d_$(feed) %U/packages/%A/$(feed)";)))) \
+	echo 'src/gz %d_base %U/packages/%A/base'; \
+	$(foreach feed,$(FEEDS_AVAILABLE), \
+		$(if $(CONFIG_FEED_$(feed)), \
+			echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \
 ) >> $(1)
 endef

+ 2 - 2
include/hardening.mk

@@ -18,8 +18,8 @@ ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
 endif
 ifdef CONFIG_PKG_ASLR_PIE
   ifeq ($(strip $(PKG_ASLR_PIE)),1)
-    TARGET_CFLAGS += -fPIC
-    TARGET_LDFLAGS += -specs=$(INCLUDE_DIR)/hardened-ld-pie.specs
+    TARGET_CFLAGS += $(FPIC)
+    TARGET_LDFLAGS += $(FPIC) -specs=$(INCLUDE_DIR)/hardened-ld-pie.specs
   endif
 endif
 ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR

+ 1 - 1
include/host-build.mk

@@ -132,7 +132,7 @@ define Host/Exports/Default
   $(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX)
   $(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig
   $(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig
-  $(1) : export CCACHE_DIR:=$(STAGING_DIR_HOST)/ccache
+  $(if $(CONFIG_CCACHE),$(1) : export CCACHE_DIR:=$(STAGING_DIR_HOST)/ccache)
   $(if $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE))
   $(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG))
 endef

+ 48 - 2
include/image-commands.mk

@@ -49,6 +49,27 @@ define Build/eva-image
 	mv $@.new $@
 endef
 
+define Build/zyxel-ras-image
+	let \
+		newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
+		$(STAGING_DIR_HOST)/bin/mkrasimage \
+			-b $(RAS_BOARD) \
+			-v $(RAS_VERSION) \
+			-r $@ \
+			-s $$newsize \
+			-o $@.new \
+			$(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \
+		&& mv $@.new $@
+endef
+
+define Build/mkbuffaloimg
+	$(STAGING_DIR_HOST)/bin/mkbuffaloimg -B $(BOARDNAME) \
+		-R $$(($(subst k, * 1024,$(ROOTFS_SIZE)))) \
+		-K $$(($(subst k, * 1024,$(KERNEL_SIZE)))) \
+		-i $@ -o $@.new
+	mv $@.new $@
+endef
+
 define Build/netgear-chk
 	$(STAGING_DIR_HOST)/bin/mkchkimg \
 		-o $@.new \
@@ -60,7 +81,7 @@ endef
 
 define Build/netgear-dni
 	$(STAGING_DIR_HOST)/bin/mkdniimg \
-		-B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(REVISION) \
+		-B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \
 		$(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \
 		-r "$(1)" \
 		-i $@ -o $@.new
@@ -102,6 +123,16 @@ define Build/tplink-safeloader
 		$(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv $@.new $@ || rm -f $@
 endef
 
+define Build/mksercommfw
+	-$(STAGING_DIR_HOST)/bin/mksercommfw \
+		$@ \
+		$(KERNEL_OFFSET) \
+		$(HWID) \
+		$(HWVER) \
+		$(SWVER)
+endef
+
+
 define Build/append-dtb
 	cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
 endef
@@ -135,7 +166,7 @@ define Build/lzma-no-dict
 endef
 
 define Build/gzip
-	gzip --force -9n -c $@ $(1) > $@.new
+	gzip -f -9n -c $@ $(1) > $@.new
 	@mv $@.new $@
 endef
 
@@ -186,6 +217,10 @@ define Build/append-ubi
 	rm $@.tmp
 endef
 
+define Build/append-uboot
+	dd if=$(UBOOT_PATH) >> $@
+endef
+
 define Build/pad-to
 	dd if=$@ of=$@.new bs=$(1) conv=sync
 	mv $@.new $@
@@ -239,6 +274,11 @@ define Build/openmesh-image
 		"$(call param_get_default,rootfs,$(1),$@)" "rootfs"
 endef
 
+define Build/senao-header
+	$(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o $@.new
+	mv $@.new $@
+endef
+
 define Build/sysupgrade-tar
 	sh $(TOPDIR)/scripts/sysupgrade-tar.sh \
 		--board $(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)) \
@@ -292,6 +332,12 @@ metadata_json = \
 
 define Build/append-metadata
 	$(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
+	[ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
+		cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
+		usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
+		ucert -A -c "$@.ucert" -x "$@.sig" ;\
+		fwtool -S "$@.ucert" "$@" ;\
+	}
 endef
 
 define Build/kernel2minor

+ 1 - 0
include/image.mk

@@ -393,6 +393,7 @@ endef
 
 define Device/Check/Common
   _PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile))))
+  DEVICE_PACKAGES += $$(call extra_packages,$$(DEVICE_PACKAGES))
   ifdef TARGET_PER_DEVICE_ROOTFS
     $$(eval $$(call merge_packages,_PACKAGES,$$(DEVICE_PACKAGES) $$(call DEVICE_EXTRA_PACKAGES,$(1))))
     ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(_PACKAGES)))

+ 1 - 1
include/kernel-build.mk

@@ -11,7 +11,7 @@ ifneq ($(DUMP),1)
   all: compile
 endif
 
-KERNEL_FILE_DEPENDS=$(BACKPORT_PATCH_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
+KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
 STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,$(KERNEL_FILE_DEPENDS),)))
 STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
 include $(INCLUDE_DIR)/download.mk

+ 6 - 8
include/kernel-version.mk

@@ -2,15 +2,13 @@
 
 LINUX_RELEASE?=1
 
-LINUX_VERSION-3.18 = .108
-LINUX_VERSION-4.4 = .121
-LINUX_VERSION-4.9 = .96
-LINUX_VERSION-4.14 = .37
+LINUX_VERSION-3.18 = .124
+LINUX_VERSION-4.9 = .135
+LINUX_VERSION-4.14 = .78
 
-LINUX_KERNEL_HASH-3.18.108 = 73a946e45750f74b4f87097017d30c40accef8fe1639a7d0d8d2e8ebaa879246
-LINUX_KERNEL_HASH-4.4.121 = 44a88268b5088dc326b30c9b9133ac35a9a200b636b7268d08f32abeae6ca729
-LINUX_KERNEL_HASH-4.9.96 = 80533670cf26b8a369928a34fc7c6882ebe61d556de31bc3f60e0775dd459270
-LINUX_KERNEL_HASH-4.14.37 = e1211222b162d8c0d60bf620d38d06cf0652576ec73fe8ee1eb0d6c59b014917
+LINUX_KERNEL_HASH-3.18.124 =
+LINUX_KERNEL_HASH-4.9.135 =
+LINUX_KERNEL_HASH-4.14.78 =
 
 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
 sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))

+ 2 - 2
include/kernel.mk

@@ -60,7 +60,6 @@ else
   LINUX_KERNEL:=$(KERNEL_BUILD_DIR)/vmlinux
 
   LINUX_SOURCE:=linux-libre-$(LINUX_VERSION)-gnu.tar.xz
-  TESTING:=$(if $(findstring -rc,$(LINUX_VERSION)),/testing,)
   ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
       LINUX_SITE:=@KERNEL_LIBRE/$(LINUX_VERSION)-gnu$(TESTING)
   else
@@ -97,7 +96,7 @@ endif
 
 KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
 
-KERNEL_MAKE_FLAGS := \
+KERNEL_MAKE_FLAGS = \
 	HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
 	CROSS_COMPILE="$(KERNEL_CROSS)" \
 	ARCH="$(LINUX_KARCH)" \
@@ -254,6 +253,7 @@ $(call KernelPackage/$(1)/config)
   $$(eval $$(call BuildPackage,kmod-$(1)))
 
   $$(IPKG_kmod-$(1)): $$(wildcard $$(FILES))
+
 endef
 
 version_filter=$(if $(findstring @,$(1)),$(shell $(SCRIPT_DIR)/package-metadata.pl version_filter $(KERNEL_PATCHVER) $(1)),$(1))

+ 1 - 0
include/netfilter.mk

@@ -106,6 +106,7 @@ $(eval $(call nf_add,IPT_PHYSDEV,CONFIG_NETFILTER_XT_MATCH_PHYSDEV, $(P_XT)xt_ph
 # filter
 
 $(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_STRING, $(P_XT)xt_string))
+$(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_BPF, $(P_XT)xt_bpf))
 
 
 # ipopt

+ 1 - 1
include/package-ipkg.mk

@@ -190,7 +190,7 @@ $(_endef)
 			fi; \
 		done; $(Package/$(1)/extra_provides) \
 	) | sort -u > $(PKG_INFO_DIR)/$(1).provides
-	$(if $(PROVIDES),@for pkg in $(PROVIDES); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
+	$(if $(PROVIDES),@for pkg in $(filter-out $(1),$(PROVIDES)); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
 	$(CheckDependencies)
 
 	$(RSTRIP) $$(IDIR_$(1))

+ 2 - 2
include/package.mk

@@ -144,7 +144,7 @@ define Build/Exports/Default
   $(1) : export CONFIG_SITE:=$$(CONFIG_SITE)
   $(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH)
   $(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH)
-  $(1) : export CCACHE_DIR:=$(STAGING_DIR)/ccache
+  $(if $(CONFIG_CCACHE),$(1) : export CCACHE_DIR:=$(STAGING_DIR)/ccache)
 endef
 Build/Exports=$(Build/Exports/Default)
 
@@ -228,7 +228,7 @@ define Build/CoreTargets
 
   ifneq ($(CONFIG_AUTOREMOVE),)
     compile:
-		-touch $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
+		-touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
 		$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
 			$(XARGS) rm -rf
   endif

+ 2 - 2
include/prereq-build.mk

@@ -27,7 +27,7 @@ $(eval $(call TestHostCommand,proper-umask, \
 	umask | grep -xE 00[012][012]))
 
 $(eval $(call SetupHostCommand,gcc, \
-	Please install the GNU C Compiler (gcc) 4.8 or later \
+	Please install the GNU C Compiler (gcc) 4.8 or later, \
 	$(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \
 	gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \
 	gcc48 --version | grep gcc, \
@@ -46,7 +46,7 @@ $(eval $(call TestHostCommand,working-gcc, \
 		gcc -x c -o $(TMP_DIR)/a.out -))
 
 $(eval $(call SetupHostCommand,g++, \
-	Please install the GNU C++ Compiler (g++) 4.8 or later \
+	Please install the GNU C++ Compiler (g++) 4.8 or later, \
 	$(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \
 	g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \
 	g++48 --version | grep g++, \

+ 1 - 1
include/scan.awk

@@ -2,7 +2,7 @@ BEGIN { FS="/" }
 $1 ~ /^feeds/ { FEEDS[$NF]=$0 }
 $1 !~ /^feeds/ { PKGS[$NF]=$0 }
 END {
-	# Filter-out libreCMC packages which have a feeds equivalent
+	# Filter-out OpenWrt packages which have a feeds equivalent
 	for (pkg in PKGS)
 		if (pkg in FEEDS) {
 			print PKGS[pkg] > of

+ 6 - 0
include/scan.mk

@@ -12,6 +12,12 @@ OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE)
 
 export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
 
+ifeq ($(SCAN_NAME),target)
+  SCAN_DEPS=image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk image/*.mk
+else
+  SCAN_DEPS=$(TOPDIR)/include/package*.mk
+endif
+
 ifeq ($(IS_TTY),1)
   define progress
 	printf "\033[M\r$(1)" >&2;

+ 1 - 0
include/subdir.mk

@@ -43,6 +43,7 @@ log_make = \
 	 $(if $(BUILD_LOG), \
 		set -o pipefail; \
 		mkdir -p $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4));) \
+	$(SCRIPT_DIR)/time.pl "time: $(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2)" \
 	$$(SUBMAKE) $(subdir_make_opts) $(if $(3),$(3)-)$(2) \
 		$(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2).txt)
 

+ 3 - 4
include/target.mk

@@ -51,7 +51,7 @@ else
   endif
 endif
 
-ifneq ($(filter 3.18 4.4 4.9,$(KERNEL_PATCHVER)),)
+ifneq ($(filter 3.18 4.9,$(KERNEL_PATCHVER)),)
   DEFAULT_PACKAGES.router:=$(filter-out kmod-ipt-offload,$(DEFAULT_PACKAGES.router))
 endif
 
@@ -59,7 +59,7 @@ endif
 DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
 
 filter_packages = $(filter-out -% $(patsubst -%,%,$(filter -%,$(1))),$(1))
-extra_packages = $(if $(filter wpad-mini wpad nas,$(1)),iwinfo)
+extra_packages = $(if $(filter wpad-mini wpad-basic wpad nas,$(1)),iwinfo)
 
 define ProfileDefault
   NAME:=
@@ -72,7 +72,6 @@ define Profile
   $(eval $(call ProfileDefault))
   $(eval $(call Profile/$(1)))
   dumpinfo : $(call shexport,Profile/$(1)/Description)
-  DEFAULT_PACKAGES := $(filter-out $(patsubst -%,%,$(filter -%,$(PACKAGES))),$(DEFAULT_PACKAGES))
   PACKAGES := $(filter-out -%,$(PACKAGES))
   DUMPINFO += \
 	echo "Target-Profile: $(1)"; \
@@ -175,7 +174,7 @@ ifeq ($(DUMP),1)
     CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64
     CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc
     CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc
-    CPU_CFLAGS_octeon = -march=octeon -mabi=64
+    CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64
   endif
   ifeq ($(ARCH),i386)
     CPU_TYPE ?= pentium

+ 2 - 2
include/toplevel.mk

@@ -82,8 +82,8 @@ _ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))
 prepare-tmpinfo: FORCE
 	@+$(MAKE) -r -s staging_dir/host/.prereq-build $(PREP_MK)
 	mkdir -p tmp/info
-	$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=5 SCAN_EXTRA=""
-	$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
+	$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA=""
+	$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
 	for type in package target; do \
 		f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
 		[ "$$t" -nt "$$f" ] || ./scripts/$${type}-metadata.pl $(_ignore) config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \

+ 1 - 1
include/verbose.mk

@@ -54,7 +54,7 @@ ifeq ($(findstring s,$(OPENWRT_VERBOSE)),)
   else
     SILENT:=>/dev/null $(if $(findstring w,$(OPENWRT_VERBOSE)),,2>&1)
     export QUIET:=1
-    SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* < /dev/null || { echo "make $$*: build failed. Please re-run make with -j1 V=s to see what's going on"; false; } } 8>&1 9>&2; cmd
+    SUBMAKE=cmd() { $(SILENT) $(MAKE) -s "$$@" < /dev/null || { echo "make $$*: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on"; false; } } 8>&1 9>&2; cmd
   endif
 
   .SILENT: $(MAKECMDGOALS)

+ 43 - 37
include/version.mk

@@ -10,10 +10,13 @@
 # REVISION:=x
 # SOURCE_DATE_EPOCH:=x
 
+RELEASE:=libreCMC-Next
+
 PKG_CONFIG_DEPENDS += \
 	CONFIG_VERSION_BUG_URL \
 	CONFIG_VERSION_NUMBER \
 	CONFIG_VERSION_CODE \
+	CONFIG_VERSION_NICK \
 	CONFIG_VERSION_REPO \
 	CONFIG_VERSION_DIST \
 	CONFIG_VERSION_MANUFACTURER \
@@ -22,37 +25,43 @@ PKG_CONFIG_DEPENDS += \
 	CONFIG_VERSION_SUPPORT_URL \
 	CONFIG_VERSION_HWREV \
 
+qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
+#'
+
 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
 
-VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
-VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.5-next)
+VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
+VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.5)
 
-VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
+VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_CODE))
 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
 
-VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
+VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
+VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
+
+VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://librecmc.org/librecmc/downloads/snapshots/%v)
 
-VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
+VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),libreCMC)
 VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
 
-VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
+VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),libreCMC)
 
-VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
+VERSION_MANUFACTURER_URL:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER_URL))
 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org)
 
-VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
+VERSION_BUG_URL:=$(call qstrip_escape,$(CONFIG_VERSION_BUG_URL))
 VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://gogs.librecmc.org/libreCMC/libreCMC/issues)
 
-VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
-VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),https://librecmc.org/)
+VERSION_SUPPORT_URL:=$(call qstrip_escape,$(CONFIG_VERSION_SUPPORT_URL))
+VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL))
 
-VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
+VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT))
 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
 
-VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV))
+VERSION_HWREV:=$(call qstrip_escape,$(CONFIG_VERSION_HWREV))
 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
 
 define taint2sym
@@ -79,28 +88,25 @@ VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
 
 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
 
-# escape commas, backslashes, squotes, and ampersands for sed
-define sed_escape
-$(subst &,\&,$(subst $(comma),\$(comma),$(subst ','\'',$(subst \,\\,$(1)))))
-endef
-#'
-
-VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
-	-e 's,%V,$(call sed_escape,$(VERSION_NUMBER)),g' \
-	-e 's,%v,\L$(call sed_escape,$(subst $(space),_,$(VERSION_NUMBER))),g' \
-	-e 's,%C,$(call sed_escape,$(VERSION_CODE)),g' \
-	-e 's,%c,\L$(call sed_escape,$(subst $(space),_,$(VERSION_CODE))),g' \
-	-e 's,%D,$(call sed_escape,$(VERSION_DIST)),g' \
-	-e 's,%d,\L$(call sed_escape,$(subst $(space),_,$(VERSION_DIST))),g' \
-	-e 's,%R,$(call sed_escape,$(REVISION)),g' \
-	-e 's,%T,$(call sed_escape,$(BOARD)),g' \
-	-e 's,%S,$(call sed_escape,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)),g' \
-	-e 's,%A,$(call sed_escape,$(ARCH_PACKAGES)),g' \
-	-e 's,%t,$(call sed_escape,$(VERSION_TAINTS)),g' \
-	-e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \
-	-e 's,%m,$(call sed_escape,$(VERSION_MANUFACTURER_URL)),g' \
-	-e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \
-	-e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
-	-e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
-	-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'
-
+VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
+	-e 's,%V,$(VERSION_NUMBER),g' \
+	-e 's,%v,\L$(subst $(space),_,$(VERSION_NUMBER)),g' \
+	-e 's,%C,$(VERSION_CODE),g' \
+	-e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
+	-e 's,%N,$(VERSION_NICK),g' \
+	-e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
+	-e 's,%D,$(VERSION_DIST),g' \
+	-e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
+	-e 's,%R,$(REVISION),g' \
+	-e 's,%T,$(BOARD),g' \
+	-e 's,%S,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic),g' \
+	-e 's,%A,$(ARCH_PACKAGES),g' \
+	-e 's,%t,$(VERSION_TAINTS),g' \
+	-e 's,%M,$(VERSION_MANUFACTURER),g' \
+	-e 's,%m,$(VERSION_MANUFACTURER_URL),g' \
+	-e 's,%b,$(VERSION_BUG_URL),g' \
+	-e 's,%s,$(VERSION_SUPPORT_URL),g' \
+	-e 's,%P,$(VERSION_PRODUCT),g' \
+	-e 's,%h,$(VERSION_HWREV),g'
+
+VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED))

+ 8 - 6
package/base-files/Makefile

@@ -12,11 +12,11 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=190
+PKG_RELEASE:=196
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
-PKG_BUILD_DEPENDS:=usign/host
+PKG_BUILD_DEPENDS:=usign/host ucert/host
 PKG_LICENSE:=GPL-2.0
 
 # Extend depends from version.mk
@@ -25,9 +25,7 @@ PKG_CONFIG_DEPENDS += \
 	CONFIG_NAND_SUPPORT \
 	CONFIG_CLEAN_IPKG \
 	CONFIG_PER_FEED_REPO \
-	CONFIG_PER_FEED_REPO_ADD_DISABLED \
-	CONFIG_PER_FEED_REPO_ADD_COMMENTED \
-	$(foreach feed,$(FEEDS_INSTALLED),CONFIG_FEED_$(feed))
+	$(foreach feed,$(FEEDS_AVAILABLE),CONFIG_FEED_$(feed))
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -41,7 +39,7 @@ define Package/base-files
   CATEGORY:=Base system
   DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:librecmc-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool
   TITLE:=Base filesystem for libreCMC
-  URL:=http://librecmc.org/
+  URL:=https://librecmc.org/
   VERSION:=$(PKG_RELEASE)-$(REVISION)
 endef
 
@@ -51,6 +49,7 @@ define Package/base-files/conffiles
 /etc/config/system
 /etc/crontabs/
 /etc/dropbear/
+/etc/ethers
 /etc/group
 /etc/hosts
 /etc/inittab
@@ -104,6 +103,9 @@ ifdef CONFIG_SIGNED_PACKAGES
 	[ -s $(BUILD_KEY) -a -s $(BUILD_KEY).pub ] || \
 		$(STAGING_DIR_HOST)/bin/usign -G -s $(BUILD_KEY) -p $(BUILD_KEY).pub -c "Local build key"
 
+	[ -s $(BUILD_KEY).ucert ] || \
+		$(STAGING_DIR_HOST)/bin/ucert -I -c $(BUILD_KEY).ucert -p $(BUILD_KEY).pub -s $(BUILD_KEY)
+
   endef
 
   define Package/base-files/install-key

+ 29 - 18
package/base-files/files/bin/config_generate

@@ -15,10 +15,14 @@ generate_static_network() {
 		set network.loopback.proto='static'
 		set network.loopback.ipaddr='127.0.0.1'
 		set network.loopback.netmask='255.0.0.0'
-		delete network.globals
-		set network.globals='globals'
-		set network.globals.ula_prefix='auto'
 	EOF
+		[ -e /proc/sys/net/ipv6 ] && {
+			uci -q batch <<-EOF
+				delete network.globals
+				set network.globals='globals'
+				set network.globals.ula_prefix='auto'
+			EOF
+		}
 
 	if json_is_a dsl object; then
 		json_select dsl
@@ -102,21 +106,23 @@ generate_network() {
 				set network.$1.proto='static'
 				set network.$1.ipaddr='$ipad'
 				set network.$1.netmask='$netm'
-				set network.$1.ip6assign='60'
 			EOF
+			[ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
 		;;
 
 		dhcp)
 			# fixup IPv6 slave interface if parent is a bridge
 			[ "$type" = "bridge" ] && ifname="br-$1"
 
-			uci -q batch <<-EOF
-				set network.$1.proto='dhcp'
-				delete network.${1}6
-				set network.${1}6='interface'
-				set network.${1}6.ifname='$ifname'
-				set network.${1}6.proto='dhcpv6'
-			EOF
+			uci set network.$1.proto='dhcp'
+			[ -e /proc/sys/net/ipv6 ] && {
+				uci -q batch <<-EOF
+					delete network.${1}6
+					set network.${1}6='interface'
+					set network.${1}6.ifname='$ifname'
+					set network.${1}6.proto='dhcpv6'
+				EOF
+			}
 		;;
 
 		pppoe)
@@ -124,12 +130,16 @@ generate_network() {
 				set network.$1.proto='pppoe'
 				set network.$1.username='username'
 				set network.$1.password='password'
-				set network.$1.ipv6='1'
-				delete network.${1}6
-				set network.${1}6='interface'
-				set network.${1}6.ifname='@${1}'
-				set network.${1}6.proto='dhcpv6'
 			EOF
+			[ -e /proc/sys/net/ipv6 ] && {
+				uci -q batch <<-EOF
+					set network.$1.ipv6='1'
+					delete network.${1}6
+					set network.${1}6='interface'
+					set network.${1}6.ifname='@${1}'
+					set network.${1}6.proto='dhcpv6'
+				EOF
+			}
 		;;
 	esac
 }
@@ -356,11 +366,12 @@ generate_led() {
 		;;
 
 		switch)
-			local port_mask speed_mask
-			json_get_vars port_mask speed_mask
+			local port_mask speed_mask mode
+			json_get_vars port_mask speed_mask mode
 			uci -q batch <<-EOF
 				set system.$cfg.port_mask='$port_mask'
 				set system.$cfg.speed_mask='$speed_mask'
+				set system.$cfg.mode='$mode'
 			EOF
 		;;
 

+ 6 - 0
package/base-files/files/etc/ethers

@@ -0,0 +1,6 @@
+#
+#  Lookup man 5 ethers for syntax documentation
+#
+#  Examples :
+#	02:00:11:22:33:44	libreCMC.lan
+#	02:00:11:22:33:44	192.168.10.1

+ 4 - 2
package/base-files/files/etc/init.d/led

@@ -20,7 +20,7 @@ load_led() {
 	config_get trigger $1 trigger "none"
 	config_get dev $1 dev
 	config_get ports $1 port
-	config_get mode $1 mode "link"
+	config_get mode $1 mode
 	config_get_bool default $1 default "nil"
 	config_get delayon $1 delayon
 	config_get delayoff $1 delayoff
@@ -71,7 +71,7 @@ load_led() {
 		"netdev")
 			[ -n "$dev" ] && {
 				echo $dev > /sys/class/leds/${sysfs}/device_name
-				echo $mode > /sys/class/leds/${sysfs}/mode
+				echo "${mode:-link}" > /sys/class/leds/${sysfs}/mode
 				echo $interval > /sys/class/leds/${sysfs}/interval
 			}
 			;;
@@ -110,6 +110,8 @@ load_led() {
 			config_get speed_mask $1 speed_mask
 			[ -n "$speed_mask" ] && \
 				echo $speed_mask > /sys/class/leds/${sysfs}/speed_mask
+			[ -n "$mode" ] && \
+				echo "$mode" > /sys/class/leds/${sysfs}/mode
 			;;
 		esac
 	}

+ 1 - 1
package/base-files/files/etc/init.d/sysctl

@@ -39,6 +39,6 @@ apply_defaults() {
 start() {
 	apply_defaults
 	for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do
-		[ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
+		[ -f "$CONF" ] && sysctl -e -p "$CONF" >&-
 	done
 }

+ 1 - 1
package/base-files/files/etc/init.d/system

@@ -7,7 +7,7 @@ USE_PROCD=1
 validate_system_section()
 {
 	uci_validate_section system system "${1}" \
-		'hostname:string:OpenWrt' \
+		'hostname:string:libreCMC' \
 		'conloglevel:uinteger' \
 		'buffersize:uinteger' \
 		'timezone:string:UTC' \

+ 5 - 1
package/base-files/files/etc/profile

@@ -14,7 +14,11 @@ export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
 export HOME=${HOME:-/root}
 export PS1='\u@\h:\w\$ '
 
-[ "$TERM" = "xterm" ] && export PS1='\[\e]0;\u@\h: \w\a\]'$PS1
+case "$TERM" in
+	xterm*|rxvt*)
+		export PS1='\[\e]0;\u@\h: \w\a\]'$PS1
+		;;
+esac
 
 [ -x /bin/more ] || alias more=less
 [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi

+ 2 - 2
package/base-files/files/etc/services

@@ -29,8 +29,8 @@ kerberos	88/tcp		kerberos5 krb5 kerberos-sec
 kerberos	88/udp		kerberos5 krb5 kerberos-sec
 pop3		110/tcp
 pop3		110/udp
-sunrpc		111/tcp
-sunrpc		111/udp
+sunrpc		111/tcp		rpcbind
+sunrpc		111/udp		rpcbind
 auth		113/tcp		ident
 sftp		115/tcp
 nntp		119/tcp

+ 8 - 12
package/base-files/files/lib/functions.sh

@@ -57,16 +57,16 @@ config () {
 	export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1))
 	name="${name:-cfg$CONFIG_NUM_SECTIONS}"
 	append CONFIG_SECTIONS "$name"
-	[ -n "$NO_CALLBACK" ] || config_cb "$cfgtype" "$name"
 	export ${NO_EXPORT:+-n} CONFIG_SECTION="$name"
-	export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_TYPE=$cfgtype"
+	config_set "$CONFIG_SECTION" "TYPE" "${cfgtype}"
+	[ -n "$NO_CALLBACK" ] || config_cb "$cfgtype" "$name"
 }
 
 option () {
 	local varname="$1"; shift
 	local value="$*"
 
-	export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_${varname}=$value"
+	config_set "$CONFIG_SECTION" "${varname}" "${value}"
 	[ -n "$NO_CALLBACK" ] || option_cb "$varname" "$*"
 }
 
@@ -81,7 +81,7 @@ list() {
 	config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
 	config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
 	append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP"
-	list_cb "$varname" "$*"
+	[ -n "$NO_CALLBACK" ] || list_cb "$varname" "$*"
 }
 
 config_unset() {
@@ -113,11 +113,8 @@ config_set() {
 	local section="$1"
 	local option="$2"
 	local value="$3"
-	local old_section="$CONFIG_SECTION"
 
-	CONFIG_SECTION="$section"
-	option "$option" "$value"
-	CONFIG_SECTION="$old_section"
+	export ${NO_EXPORT:+-n} "CONFIG_${section}_${option}=${value}"
 }
 
 config_foreach() {
@@ -232,10 +229,9 @@ default_postinst() {
 	if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then
 		. /lib/functions/system.sh
 		[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
-		for i in $(sed -ne 's!^/etc/uci-defaults/!!p' "/usr/lib/opkg/info/${pkgname}.list"); do (
-			cd /etc/uci-defaults
-			[ -f "$i" ] && . ./"$i" && rm -f "$i"
-		) done
+		for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do
+			( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
+		done
 		uci commit
 	fi
 

+ 14 - 3
package/base-files/files/lib/functions/network.sh

@@ -6,10 +6,16 @@
 __network_ifstatus() {
 	local __tmp
 
-	[ -z "$__NETWORK_CACHE" ] && \
-		export __NETWORK_CACHE="$(ubus call network.interface dump)"
+	[ -z "$__NETWORK_CACHE" ] && {
+		__tmp="$(ubus call network.interface dump 2>&1)"
+		case "$?" in
+			4) : ;;
+			0) export __NETWORK_CACHE="$__tmp" ;;
+			*) echo "$__tmp" >&2 ;;
+		esac
+	}
 
-	__tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "$__NETWORK_CACHE" -e "$1=@.interface${2:+[@.interface='$2']}$3")"
+	__tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "${__NETWORK_CACHE:-{}}" -e "$1=@.interface${2:+[@.interface='$2']}$3")"
 
 	[ -z "$__tmp" ] && \
 		unset "$1" && \
@@ -265,6 +271,11 @@ network_is_up()
 # 2: interface
 network_get_protocol() { __network_ifstatus "$1" "$2" ".proto"; }
 
+# determine the metric of the given logical interface
+# 1: destination variable
+# 2: interface
+network_get_metric() { __network_ifstatus "$1" "$2" ".metric"; }
+
 # determine the layer 3 linux network device of the given logical interface
 # 1: destination variable
 # 2: interface

+ 27 - 8
package/base-files/files/lib/functions/system.sh

@@ -20,8 +20,7 @@ find_mtd_chardev() {
 	echo "${INDEX:+$PREFIX$INDEX}"
 }
 
-mtd_get_mac_ascii()
-{
+mtd_get_mac_ascii() {
 	local mtdname="$1"
 	local key="$2"
 	local part
@@ -39,6 +38,29 @@ mtd_get_mac_ascii()
 	[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
 }
 
+mtd_get_mac_text() {
+	local mtdname=$1
+	local offset=$2
+	local part
+	local mac_dirty
+
+	part=$(find_mtd_part "$mtdname")
+	if [ -z "$part" ]; then
+		echo "mtd_get_mac_text: partition $mtdname not found!" >&2
+		return
+	fi
+
+	if [ -z "$offset" ]; then
+		echo "mtd_get_mac_text: offset missing!" >&2
+		return
+	fi
+
+	mac_dirty=$(dd if="$part" bs=1 skip="$offset" count=17 2>/dev/null)
+
+	# "canonicalize" mac
+	[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
+}
+
 mtd_get_mac_binary() {
 	local mtdname="$1"
 	local offset="$2"
@@ -87,22 +109,19 @@ macaddr_add() {
 	echo $oui:$nic
 }
 
-macaddr_setbit_la()
-{
+macaddr_setbit_la() {
 	local mac=$1
 
 	printf "%02x:%s" $((0x${mac%%:*} | 0x02)) ${mac#*:}
 }
 
-macaddr_2bin()
-{
+macaddr_2bin() {
 	local mac=$1
 
 	echo -ne \\x${mac//:/\\x}
 }
 
-macaddr_canonicalize()
-{
+macaddr_canonicalize() {
 	local mac="$1"
 	local canon=""
 

+ 31 - 49
package/base-files/files/lib/functions/uci-defaults.sh

@@ -27,30 +27,33 @@ json_select_object() {
 	json_select "$1"
 }
 
-_ucidef_set_interface() {
-	local name="$1"
-	local iface="$2"
-	local proto="$3"
+ucidef_set_interface() {
+	local network=$1; shift
 
-	json_select_object "$name"
-	json_add_string ifname "$iface"
-
-	if ! json_is_a protocol string || [ -n "$proto" ]; then
-		case "$proto" in
-			static|dhcp|none|pppoe) : ;;
-			*)
-				case "$name" in
-					lan) proto="static" ;;
-					wan) proto="dhcp" ;;
-					*) proto="none" ;;
-				esac
-			;;
-		esac
+	[ -z "$network" ] && return
 
-		json_add_string protocol "$proto"
+	json_select_object network
+	json_select_object "$network"
+
+	while [ -n "$1" ]; do
+		local opt=$1; shift
+		local val=$1; shift
+
+		[ -n "$opt" -a -n "$val" ] || break
+
+		json_add_string "$opt" "$val"
+	done
+
+	if ! json_is_a protocol string; then
+		case "$network" in
+			lan) json_add_string protocol static ;;
+			wan) json_add_string protocol dhcp ;;
+			*) json_add_string protocol none ;;
+		esac
 	fi
 
 	json_select ..
+	json_select ..
 }
 
 ucidef_set_board_id() {
@@ -66,31 +69,19 @@ ucidef_set_model_name() {
 }
 
 ucidef_set_interface_lan() {
-	json_select_object network
-	_ucidef_set_interface lan "$@"
-	json_select ..
+	ucidef_set_interface "lan" ifname "$1" protocol "${2:-static}"
 }
 
 ucidef_set_interface_wan() {
-	json_select_object network
-	_ucidef_set_interface wan "$@"
-	json_select ..
+	ucidef_set_interface "wan" ifname "$1" protocol "${2:-dhcp}"
 }
 
 ucidef_set_interfaces_lan_wan() {
 	local lan_if="$1"
 	local wan_if="$2"
 
-	json_select_object network
-	_ucidef_set_interface lan "$lan_if"
-	_ucidef_set_interface wan "$wan_if"
-	json_select ..
-}
-
-ucidef_set_interface_raw() {
-	json_select_object network
-	_ucidef_set_interface "$@"
-	json_select ..
+	ucidef_set_interface_lan "$lan_if"
+	ucidef_set_interface_wan "$wan_if"
 }
 
 _ucidef_add_switch_port() {
@@ -185,9 +176,9 @@ _ucidef_finish_switch_roles() {
 					devices="${devices:+$devices }$device"
 				fi
 			json_select ..
-
-			_ucidef_set_interface "$role" "$devices"
 		json_select ..
+
+		ucidef_set_interface "$role" ifname "$devices"
 	done
 }
 
@@ -300,18 +291,7 @@ ucidef_set_interface_macaddr() {
 	local network="$1"
 	local macaddr="$2"
 
-	json_select_object network
-
-	json_select "$network"
-	[ $? -eq 0 ] || {
-		json_select ..
-		return
-	}
-
-	json_add_string macaddr "$macaddr"
-	json_select ..
-
-	json_select ..
+	ucidef_set_interface "$network" macaddr "$macaddr"
 }
 
 ucidef_add_atm_bridge() {
@@ -462,11 +442,13 @@ ucidef_set_led_switch() {
 	local trigger_name="$4"
 	local port_mask="$5"
 	local speed_mask="$6"
+	local mode="$7"
 
 	_ucidef_set_led_common "$1" "$2" "$3"
 
 	json_add_string trigger "$trigger_name"
 	json_add_string type switch
+	json_add_string mode "$mode"
 	json_add_string port_mask "$port_mask"
 	json_add_string speed_mask "$speed_mask"
 	json_select ..

+ 12 - 6
package/base-files/files/lib/upgrade/common.sh

@@ -78,18 +78,18 @@ rootfs_type() {
 
 get_image() { # <source> [ <command> ]
 	local from="$1"
-	local cat="$2"
+	local cmd="$2"
 
-	if [ -z "$cat" ]; then
+	if [ -z "$cmd" ]; then
 		local magic="$(dd if="$from" bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
 		case "$magic" in
-			1f8b) cat="zcat";;
-			425a) cat="bzcat";;
-			*) cat="cat";;
+			1f8b) cmd="zcat";;
+			425a) cmd="bzcat";;
+			*) cmd="cat";;
 		esac
 	fi
 
-	$cat "$from" 2>/dev/null
+	cat "$from" 2>/dev/null | $cmd
 }
 
 get_magic_word() {
@@ -211,6 +211,11 @@ jffs2_copy_config() {
 	fi
 }
 
+indicate_upgrade() {
+	. /etc/diag.sh
+	set_state upgrade
+}
+
 # Flash firmware to MTD partition
 #
 # $(1): path to image
@@ -222,6 +227,7 @@ default_do_upgrade() {
 	else
 		get_image "$1" "$2" | mtd write - "${PART_NAME:-image}"
 	fi
+	[ $? -ne 0 ] && exit 1
 }
 
 do_upgrade_stage2() {

+ 23 - 2
package/base-files/files/lib/upgrade/fwtool.sh

@@ -1,5 +1,26 @@
-fwtool_pre_upgrade() {
-	fwtool -q -i /dev/null "$1"
+fwtool_check_signature() {
+	[ $# -gt 1 ] && return 1
+
+	[ ! -x /usr/bin/ucert ] && {
+		if [ "$REQUIRE_IMAGE_SIGNATURE" = 1 ]; then
+			return 1
+		else
+			return 0
+		fi
+	}
+
+	if ! fwtool -q -t -s /tmp/sysupgrade.ucert "$1"; then
+		echo "Image signature not found"
+		[ "$REQUIRE_IMAGE_SIGNATURE" = 1 -a "$FORCE" != 1 ] && {
+			echo "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware"
+		}
+		[ "$REQUIRE_IMAGE_SIGNATURE" = 1 ] && return 1
+		return 0
+	fi
+
+	ucert -V -m "$1" -c "/tmp/sysupgrade.ucert" -P /etc/opkg/keys
+
+	return $?
 }
 
 fwtool_check_image() {

+ 1 - 0
package/base-files/files/lib/upgrade/stage2

@@ -122,6 +122,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
 	echo
 }
 
+indicate_upgrade
 
 killall -9 telnetd
 killall -9 dropbear

+ 7 - 5
package/base-files/files/sbin/sysupgrade

@@ -136,8 +136,7 @@ add_overlayfiles() {
 }
 
 # hooks
-sysupgrade_image_check="fwtool_check_image platform_check_image"
-sysupgrade_pre_upgrade="fwtool_pre_upgrade"
+sysupgrade_image_check="fwtool_check_signature fwtool_check_image platform_check_image"
 
 if [ $SAVE_OVERLAY = 1 ]; then
 	[ ! -d /overlay/upper/etc ] && {
@@ -166,6 +165,11 @@ do_save_conffiles() {
 	v "Saving config files..."
 	[ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
 	tar c${TAR_V}zf "$conf_tar" -T "$CONFFILES" 2>/dev/null
+	if [ "$?" -ne 0 ]; then
+		echo "Failed to create the configuration backup."
+		rm -f "$conf_tar"
+		exit 1
+	fi
 
 	rm -f "$CONFFILES"
 }
@@ -264,10 +268,8 @@ else
 	rm -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap
 fi
 
-run_hooks "" $sysupgrade_pre_upgrade
-
 install_bin /sbin/upgraded
-v "Commencing upgrade. All shell sessions will be closed now."
+v "Commencing upgrade. Closing all shell sessions."
 
 COMMAND='. /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2'
 

+ 3 - 2
package/base-files/files/sbin/wifi

@@ -6,7 +6,7 @@
 
 usage() {
 	cat <<EOF
-Usage: $0 [config|down|reload|status]
+Usage: $0 [config|up|down|reload|status]
 enables (default), disables or configures devices not yet configured.
 EOF
 	exit 1
@@ -241,5 +241,6 @@ case "$1" in
 	reload) wifi_reload "$2";;
 	reload_legacy) wifi_reload_legacy "$2";;
 	--help|help) usage;;
-	*) ubus call network reload; wifi_updown "enable" "$2";;
+	''|up) ubus call network reload; wifi_updown "enable" "$2";;
+	*) usage; exit 1;;
 esac

+ 1 - 1
package/base-files/files/usr/lib/os-release

@@ -4,7 +4,7 @@ ID="%d"
 ID_LIKE="lede openwrt"
 PRETTY_NAME="%D %V"
 VERSION_ID="%v"
-HOME_URL="%m"
+HOME_URL="%u"
 BUG_URL="%b"
 SUPPORT_URL="%s"
 BUILD_ID="%R"

+ 8 - 16
package/base-files/image-config.in

@@ -183,7 +183,7 @@ if VERSIONOPT
 	config VERSION_REPO
 		string
 		prompt "Release repository"
-		default "https://librecmc.org/librecmc/downloads/snapshots/%v"
+		default "http://downloads.lede-project.org/snapshots"
 		help
 			This is the repository address embedded in the image, it defaults
 			to the trunk snapshot repo; the url may contain the following placeholders:
@@ -193,7 +193,7 @@ if VERSIONOPT
 			 %C .. Configured release revision code or value of %R, uppercase
 			 %c .. Configured release revision code or value of %R, lowercase
 			 %D .. Distribution name or "libreCMC", uppercase
-			 %d .. Distribution name or "librecmc", lowercase
+			 %d .. Distribution name or "libreCMC", lowercase
 			 %T .. Target name
 			 %S .. Target/Subtarget name
 			 %A .. Package architecture
@@ -202,6 +202,12 @@ if VERSIONOPT
 			 %P .. Product name or "Generic"
 			 %h .. Hardware revision or "v0"
 
+	config VERSION_HOME_URL
+		string
+		prompt "Release Homepage"
+		help
+			This is the release version homepage
+
 	config VERSION_MANUFACTURER
 		string
 		prompt "Manufacturer name"
@@ -268,18 +274,4 @@ menuconfig PER_FEED_REPO
 		If set, a separate repository is generated within bin/*/packages/
 		for the core packages and each enabled feed.
 
-	config PER_FEED_REPO_ADD_DISABLED
-		bool "Add available but not enabled feeds to opkg.conf"
-		default y
-		depends on PER_FEED_REPO
-		help
-		  Add not installed or disabled feeds from feeds.conf to opkg.conf.
-
-	config PER_FEED_REPO_ADD_COMMENTED
-		bool "Comment out not enabled feeds"
-		default !BUILDBOT
-		depends on PER_FEED_REPO && PER_FEED_REPO_ADD_DISABLED
-		help
-		  Add not enabled feeds as commented out source lines to opkg.conf.
-
 source "tmp/.config-feeds.in"

+ 3 - 3
package/boot/arm-trusted-firmware-sunxi/Makefile

@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=https://github.com/apritzel/arm-trusted-firmware
-PKG_SOURCE_DATE:=2018-02-04
-PKG_SOURCE_VERSION:=ae78724247a01560164d607ed66db111c74d8df0
-PKG_MIRROR_HASH:=e4ddc3294f86c1e163d683a2322427bbdd5b63762ead4b1792b34df75d7bda28
+PKG_SOURCE_DATE:=2018-02-10
+PKG_SOURCE_VERSION:=c9f55c023164a6c8c49f70f7ac6c68c626839d6f
+PKG_MIRROR_HASH:=94b5338592cf0bcc353b55da5fdd62c91ae8e6263822f73724cb72ecde3dbbf9
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=license.md

+ 0 - 46
package/boot/fconfig/Makefile

@@ -1,46 +0,0 @@
-#
-# Copyright (C) 2006-2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=fconfig
-PKG_VERSION:=20080329
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://andrzejekiert.ovh.org/software/fconfig/
-PKG_HASH:=4ff0e8f07e35e46b705c0dbe9d9544ede01ea092a69e3f7db03e55a3f2bb8eb7
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/fconfig
-  SECTION:=utils
-  CATEGORY:=Utilities
-  SUBMENU:=Boot Loaders
-  TITLE:=RedBoot configuration editor
-  URL:=http://andrzejekiert.ovh.org/software.html.en
-endef
-
-define Package/fconfig/description
-	displays and (if writable) also edits the RedBoot configuration.
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
-	$(call Build/Compile/Default)
-endef
-
-define Package/fconfig/install
-	$(INSTALL_DIR) $(1)/usr/sbin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/fconfig $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,fconfig))

+ 1 - 1
package/boot/grub2/Makefile

@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 PKG_NAME:=grub
 PKG_CPE_ID:=cpe:/a:gnu:grub2
 PKG_VERSION:=2.02
-PKG_RELEASE:=1
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@GNU/grub

+ 71 - 0
package/boot/grub2/patches/0008-Fix-packed-not-aligned-error-on-GCC-8.patch

@@ -0,0 +1,71 @@
+From 563b1da6e6ae7af46cc8354cadb5dab416989f0a Mon Sep 17 00:00:00 2001
+From: Michael Chang <mchang@suse.com>
+Date: Mon, 26 Mar 2018 16:52:34 +0800
+Subject: Fix packed-not-aligned error on GCC 8
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When building with GCC 8, there are several errors regarding packed-not-aligned.
+
+./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned]
+
+This patch fixes the build error by cleaning up the ambiguity of placing
+aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
+grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
+has to be packed, to ensure the structure is bit-to-bit mapped to the format
+laid on disk. I think we could blame to copy and paste error here for the
+mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
+the name suggests. :)
+
+Signed-off-by: Michael Chang <mchang@suse.com>
+Tested-by: Michael Chang <mchang@suse.com>
+Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/fs/btrfs.c          | 2 +-
+ include/grub/efiemu/runtime.h | 2 +-
+ include/grub/gpt_partition.h  | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
+index 4849c1ceb..be195448d 100644
+--- a/grub-core/fs/btrfs.c
++++ b/grub-core/fs/btrfs.c
+@@ -175,7 +175,7 @@ struct grub_btrfs_time
+ {
+   grub_int64_t sec;
+   grub_uint32_t nanosec;
+-} __attribute__ ((aligned (4)));
++} GRUB_PACKED;
+ 
+ struct grub_btrfs_inode
+ {
+diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
+index 9b6b729f4..36d2dedf4 100644
+--- a/include/grub/efiemu/runtime.h
++++ b/include/grub/efiemu/runtime.h
+@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
+ 
+ struct efi_variable
+ {
+-  grub_efi_guid_t guid;
++  grub_efi_packed_guid_t guid;
+   grub_uint32_t namelen;
+   grub_uint32_t size;
+   grub_efi_uint32_t attributes;
+diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
+index 1b32f6725..9668a68c3 100644
+--- a/include/grub/gpt_partition.h
++++ b/include/grub/gpt_partition.h
+@@ -28,7 +28,7 @@ struct grub_gpt_part_type
+   grub_uint16_t data2;
+   grub_uint16_t data3;
+   grub_uint8_t data4[8];
+-} __attribute__ ((aligned(8)));
++} GRUB_PACKED;
+ typedef struct grub_gpt_part_type grub_gpt_part_type_t;
+ 
+ #define GRUB_GPT_PARTITION_TYPE_EMPTY \
+-- 
+cgit v1.1-33-g03f6

+ 40 - 0
package/boot/grub2/patches/300-CVE-2015-8370.patch

@@ -0,0 +1,40 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Hector Marco-Gisbert <hecmargi@upv.es>
+Date: Fri, 13 Nov 2015 16:21:09 +0100
+Subject: [PATCH] Fix security issue when reading username and password
+
+  This patch fixes two integer underflows at:
+    * grub-core/lib/crypto.c
+    * grub-core/normal/auth.c
+
+Resolves: CVE-2015-8370
+
+Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
+Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
+---
+ grub-core/lib/crypto.c  | 2 +-
+ grub-core/normal/auth.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/grub-core/lib/crypto.c
++++ b/grub-core/lib/crypto.c
+@@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned
+ 	  break;
+ 	}
+ 
+-      if (key == '\b')
++      if (key == '\b' && cur_len)
+ 	{
+ 	  if (cur_len)
+ 	    cur_len--;
+--- a/grub-core/normal/auth.c
++++ b/grub-core/normal/auth.c
+@@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned
+ 	  break;
+ 	}
+ 
+-      if (key == '\b')
++      if (key == '\b' && cur_len)
+ 	{
+ 	  if (cur_len)
+ 	    {

+ 75 - 0
package/boot/grub2/patches/400-R_X86_64_PLT32.patch

@@ -0,0 +1,75 @@
+From 02702bdfe14d8a04643a45b03715f734ae34dbac Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Sat, 17 Feb 2018 06:47:28 -0800
+Subject: x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32
+
+Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a:
+
+https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a
+
+x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for
+32-bit PC-relative branches.  Grub2 should treat R_X86_64_PLT32 as
+R_X86_64_PC32.
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+
+Origin: upstream, https://git.savannah.gnu.org/cgit/grub.git/commit/?id=842c390469e2c2e10b5aa36700324cd3bde25875
+Last-Update: 2018-07-30
+
+Patch-Name: R_X86_64_PLT32.patch
+---
+ grub-core/efiemu/i386/loadcore64.c | 1 +
+ grub-core/kern/x86_64/dl.c         | 1 +
+ util/grub-mkimagexx.c              | 1 +
+ util/grub-module-verifier.c        | 1 +
+ 4 files changed, 4 insertions(+)
+
+diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c
+index e49d0b6ff..18facf47f 100644
+--- a/grub-core/efiemu/i386/loadcore64.c
++++ b/grub-core/efiemu/i386/loadcore64.c
+@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
+ 		    break;
+ 
+ 		  case R_X86_64_PC32:
++		  case R_X86_64_PLT32:
+ 		    err = grub_efiemu_write_value (addr,
+ 						   *addr32 + rel->r_addend
+ 						   + sym.off
+diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
+index 440690673..3a73e6e6c 100644
+--- a/grub-core/kern/x86_64/dl.c
++++ b/grub-core/kern/x86_64/dl.c
+@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
+ 	  break;
+ 
+ 	case R_X86_64_PC32:
++	case R_X86_64_PLT32:
+ 	  {
+ 	    grub_int64_t value;
+ 	    value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
+diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
+index e63f148e4..f20255a28 100644
+--- a/util/grub-mkimagexx.c
++++ b/util/grub-mkimagexx.c
+@@ -832,6 +832,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
+ 		  break;
+ 
+ 		case R_X86_64_PC32:
++		case R_X86_64_PLT32:
+ 		  {
+ 		    grub_uint32_t *t32 = (grub_uint32_t *) target;
+ 		    *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
+diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
+index 9179285a5..a79271f66 100644
+--- a/util/grub-module-verifier.c
++++ b/util/grub-module-verifier.c
+@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = {
+       -1
+     }, (int[]){
+       R_X86_64_PC32,
++      R_X86_64_PLT32,
+       -1
+     }
+   },

+ 1 - 1
package/boot/uboot-envtools/Makefile

@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=uboot-envtools
 PKG_DISTNAME:=u-boot
 PKG_VERSION:=2018.03
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.xz

+ 1 - 0
package/boot/uboot-envtools/files/ar71xx

@@ -38,6 +38,7 @@ gl-ar750|\
 hornet-ub|\
 hornet-ub-x2|\
 jwap230|\
+koala|\
 mr1750|\
 mr1750v2|\
 mr600|\

+ 27 - 0
package/boot/uboot-envtools/files/ath79

@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (C) 2011-2014 OpenWrt.org
+#
+
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+glinet,ar300m|\
+ocedo,koala|\
+ocedo,raccoon|\
+openmesh,om5p-ac-v2)
+	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
+	;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0

+ 3 - 0
package/boot/uboot-envtools/files/ipq40xx

@@ -35,6 +35,9 @@ openmesh,a42 |\
 openmesh,a62)
 	ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000"
 	;;
+zyxel,nbg6617)
+	ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000"
+	;;
 esac
 
 config_load ubootenv

+ 3 - 0
package/boot/uboot-envtools/files/ipq806x

@@ -34,6 +34,9 @@ case "$board" in
 linksys,ea8500)
 	ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x20000" "0x20000"
 	;;
+netgear,r7800)
+	ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x040000" "0x20000"
+	;;
 qcom,ipq8064-ap148 |\
 qcom,ipq8064-db149)
 	ubootenv_add_uci_config $(ubootenv_mtdinfo)

+ 1 - 0
package/boot/uboot-envtools/files/kirkwood

@@ -15,6 +15,7 @@ board=$(board_name)
 case "$board" in
 cloudengines,pogoe02|\
 cloudengines,pogoplugv4|\
+iom,ix2-200|\
 linksys,viper|\
 raidsonic,ib-nas62x0|\
 seagate,dockstar|\

+ 25 - 0
package/boot/uboot-envtools/files/layerscape

@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 LEDE
+#
+
+[ -f /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+	traverse,ls1043v | \
+	traverse,ls1043s)
+		ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000"  "0x20000"
+	;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0

+ 2 - 1
package/boot/uboot-envtools/files/mvebu

@@ -19,7 +19,8 @@ armada-385-linksys-cobra|\
 armada-385-linksys-shelby)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000"
 	;;
-armada-385-linksys-rango)
+armada-385-linksys-rango|\
+armada-385-linksys-venom)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
 	;;
 armada-385-turris-omnia)

+ 0 - 57
package/boot/uboot-omap/Makefile

@@ -1,57 +0,0 @@
-#
-# Copyright (C) 2012-2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_VERSION:=2017.01
-PKG_RELEASE:=2
-
-PKG_HASH:=6c425175f93a4bcf2ec9faf5658ef279633dbd7856a293d95bd1ff516528ecf2
-
-include $(INCLUDE_DIR)/u-boot.mk
-include $(INCLUDE_DIR)/package.mk
-
-define U-Boot/Default
-  BUILD_TARGET:=omap
-  UBOOT_IMAGE:=u-boot.img MLO
-  UENV:=default
-endef
-
-define U-Boot/omap4_panda
-  NAME:=Pandaboard
-  BUILD_DEVICES:=omap4-panda
-endef
-
-define U-Boot/am335x_boneblack
-  NAME:=TI AM335x BeagleBone Black
-  BUILD_DEVICES:=am335x-boneblack
-endef
-
-define U-Boot/am335x_evm
-  NAME:=AM335x EVM
-  BUILD_DEVICES:=am335x-evm
-endef
-
-define U-Boot/omap3_overo
-  NAME:=Gumstix Overo
-endef
-
-define U-Boot/omap3_beagle
-  NAME:=BeagleBoard
-  BUILD_DEVICES:=omap3-beagle
-endef
-
-UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle am335x_boneblack
-
-define Build/InstallDev
-	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)
-	$(CP) $(patsubst %,$(PKG_BUILD_DIR)/%,$(UBOOT_IMAGE)) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)/
-	$(CP) ./files/uEnv-$(UENV).txt $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)/uEnv.txt
-endef
-
-$(eval $(call BuildPackage/U-Boot))

+ 0 - 8
package/boot/uboot-omap/files/uEnv-default.txt

@@ -1,8 +0,0 @@
-bootpart=0:1
-bootdir=/
-bootfile=zImage
-fdtdir=/dtbs
-uenvcmd=run loadfdt; run loadimage; run uenvbootargs ; bootz ${loadaddr} - ${fdtaddr}
-loadfdt=load mmc ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}
-devtype=mmc
-uenvbootargs=setenv bootargs console=${console} root=/dev/mmcblk0p2

+ 0 - 14
package/boot/uboot-omap/patches/101-disable-thumb-omap3.patch

@@ -1,14 +0,0 @@
-Index: u-boot-2017.01/include/configs/ti_omap3_common.h
-===================================================================
---- u-boot-2017.01.orig/include/configs/ti_omap3_common.h
-+++ u-boot-2017.01/include/configs/ti_omap3_common.h
-@@ -80,4 +80,9 @@
- /* Now bring in the rest of the common code. */
- #include <configs/ti_armv7_omap.h>
- 
-+/* beagleboard doesnt boot with thumb */
-+#ifdef CONFIG_SYS_THUMB_BUILD
-+#undef CONFIG_SYS_THUMB_BUILD
-+#endif
-+
- #endif	/* __CONFIG_TI_OMAP3_COMMON_H__ */

+ 0 - 44
package/boot/uboot-omap/patches/102-minify-spl.patch

@@ -1,44 +0,0 @@
-Index: u-boot-2017.01/configs/omap3_beagle_defconfig
-===================================================================
---- u-boot-2017.01.orig/configs/omap3_beagle_defconfig
-+++ u-boot-2017.01/configs/omap3_beagle_defconfig
-@@ -7,7 +7,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
- CONFIG_VERSION_VARIABLE=y
- CONFIG_SPL=y
- CONFIG_SPL_MTD_SUPPORT=y
--CONFIG_SPL_OS_BOOT=y
-+# CONFIG_SPL_EXT_SUPPORT is not set
- # CONFIG_CMD_IMLS is not set
- CONFIG_CMD_ASKENV=y
- # CONFIG_CMD_FLASH is not set
-Index: u-boot-2017.01/common/Makefile
-===================================================================
---- u-boot-2017.01.orig/common/Makefile
-+++ u-boot-2017.01/common/Makefile
-@@ -174,8 +174,11 @@ obj-$(CONFIG_CMDLINE) += cli_simple.o
- obj-y += cli.o
- obj-$(CONFIG_CMDLINE) += cli_readline.o
- obj-$(CONFIG_CMD_DFU) += dfu.o
-+
-+ifndef CONFIG_SPL_BUILD
- obj-y += command.o
- obj-y += s_record.o
- obj-y += xyzModem.o
-+endif
- 
- CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
-Index: u-boot-2017.01/cmd/Makefile
-===================================================================
---- u-boot-2017.01.orig/cmd/Makefile
-+++ u-boot-2017.01/cmd/Makefile
-@@ -161,7 +161,10 @@ endif # !CONFIG_SPL_BUILD
- 
- obj-$(CONFIG_CMD_BLOB) += blob.o
- 
-+
-+# ifndef CONFIG_SPL_BUILD
- # core command
- obj-y += nvedit.o
-+# endif # !CONFIG_SPL_BUILD
- 
- obj-$(CONFIG_ARCH_MVEBU) += mvebu/

+ 0 - 27
package/boot/uboot-omap/patches/103-disable-fat-write-spl.patch

@@ -1,27 +0,0 @@
-Index: u-boot-2017.01/fs/fat/Makefile
-===================================================================
---- u-boot-2017.01.orig/fs/fat/Makefile
-+++ u-boot-2017.01/fs/fat/Makefile
-@@ -4,8 +4,8 @@
- #
- 
- obj-$(CONFIG_FS_FAT)	:= fat.o
--obj-$(CONFIG_FAT_WRITE):= fat_write.o
- 
- ifndef CONFIG_SPL_BUILD
-+obj-$(CONFIG_FAT_WRITE):= fat_write.o
- obj-$(CONFIG_FS_FAT)	+= file.o
- endif
-Index: u-boot-2017.01/fs/fat/fat.c
-===================================================================
---- u-boot-2017.01.orig/fs/fat/fat.c
-+++ u-boot-2017.01/fs/fat/fat.c
-@@ -163,7 +163,7 @@ static void get_name(dir_entry *dirent,
- }
- 
- static int flush_dirty_fat_buffer(fsdata *mydata);
--#if !defined(CONFIG_FAT_WRITE)
-+#if !defined(CONFIG_FAT_WRITE) || defined(CONFIG_SPL_BUILD)
- /* Stub for read only operation */
- int flush_dirty_fat_buffer(fsdata *mydata)
- {

+ 0 - 18
package/boot/uboot-omap/patches/104-omap3-overo-enable-thumb.patch

@@ -1,18 +0,0 @@
-Index: u-boot-2017.01/include/configs/omap3_overo.h
-===================================================================
---- u-boot-2017.01.orig/include/configs/omap3_overo.h
-+++ u-boot-2017.01/include/configs/omap3_overo.h
-@@ -11,6 +11,13 @@
- #define CONFIG_NAND
- 
- #include <configs/ti_omap3_common.h>
-+
-+/* try to enable thumb - unknown if it's working
-+ * but otherwise it's too big for spl */
-+#ifndef CONFIG_SYS_THUMB_BUILD
-+#define CONFIG_SYS_THUMB_BUILD
-+#endif
-+
- /*
-  * We are only ever GP parts and will utilize all of the "downloaded image"
-  * area in SRAM which starts at 0x40200000 and ends at 0x4020FFFF (64KB).

+ 0 - 309
package/boot/uboot-omap/patches/105-serial-ns16550-bugfix-ns16550-fifo-not-enabled.patch

@@ -1,309 +0,0 @@
-From 17fa032671f7981628fe16b30399638842a4b1bb Mon Sep 17 00:00:00 2001
-From: Heiko Schocher <hs@denx.de>
-Date: Wed, 18 Jan 2017 08:05:49 +0100
-Subject: [PATCH] serial, ns16550: bugfix: ns16550 fifo not enabled
-
-commit: 65f83802b7a5b "serial: 16550: Add getfcr accessor"
-breaks u-boot commandline working with long commands
-sending to the board.
-
-Since the above patch, you have to setup the fcr register.
-
-For board/archs which enable OF_PLATDATA, the new field
-fcr in struct ns16550_platdata is not filled with a
-default value ...
-
-This leads in not setting up the uarts fifo, which ends
-in problems, when you send long commands to u-boots
-commandline.
-
-Detected this issue with automated tbot tests on am335x
-based shc board.
-
-The error does not popup, if you type commands. You need
-to copy&paste a long command to u-boots commandshell
-(or send a long command with tbot)
-
-Possible boards/plattforms with problems:
-./arch/arm/cpu/arm926ejs/lpc32xx/devices.c
-./arch/arm/mach-tegra/board.c
-./board/overo/overo.c
-./board/quipos/cairo/cairo.c
-./board/logicpd/omap3som/omap3logic.c
-./board/logicpd/zoom1/zoom1.c
-./board/timll/devkit8000/devkit8000.c
-./board/lg/sniper/sniper.c
-./board/ti/beagle/beagle.c
-./drivers/serial/serial_rockchip.c
-
-Signed-off-by: Heiko Schocher <hs@denx.de>
-Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
-Tested-by: Adam Ford <aford173@gmail.com>
-Reviewed-by: Tom Rini <trini@konsulko.com>
----
- arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 12 ++++++++----
- arch/arm/mach-omap2/am33xx/board.c       | 18 ++++++++++++------
- arch/arm/mach-tegra/board.c              |  1 +
- board/isee/igep00x0/igep00x0.c           |  3 ++-
- board/lg/sniper/sniper.c                 |  3 ++-
- board/logicpd/omap3som/omap3logic.c      |  3 ++-
- board/logicpd/zoom1/zoom1.c              |  3 ++-
- board/overo/overo.c                      |  3 ++-
- board/quipos/cairo/cairo.c               |  3 ++-
- board/ti/beagle/beagle.c                 |  3 ++-
- board/timll/devkit8000/devkit8000.c      |  3 ++-
- drivers/serial/ns16550.c                 |  9 +++------
- drivers/serial/serial_rockchip.c         |  1 +
- include/ns16550.h                        |  5 +++++
- 14 files changed, 46 insertions(+), 24 deletions(-)
-
-diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/devices.c b/arch/arm/cpu/arm926ejs/lpc32xx/devices.c
-index 399b07c5420a..f744398ca7ad 100644
---- a/arch/arm/cpu/arm926ejs/lpc32xx/devices.c
-+++ b/arch/arm/cpu/arm926ejs/lpc32xx/devices.c
-@@ -45,10 +45,14 @@ void lpc32xx_uart_init(unsigned int uart_id)
- 
- #if !CONFIG_IS_ENABLED(OF_CONTROL)
- static const struct ns16550_platdata lpc32xx_uart[] = {
--	{ .base = UART3_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
--	{ .base = UART4_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
--	{ .base = UART5_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
--	{ .base = UART6_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-+	{ .base = UART3_BASE, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
-+	{ .base = UART4_BASE, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
-+	{ .base = UART5_BASE, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
-+	{ .base = UART6_BASE, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
- };
- 
- #if defined(CONFIG_LPC32XX_HSUART)
-diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c
-index 73824df18fa7..190310fd0079 100644
---- a/arch/arm/mach-omap2/am33xx/board.c
-+++ b/arch/arm/mach-omap2/am33xx/board.c
-@@ -40,14 +40,20 @@ DECLARE_GLOBAL_DATA_PTR;
- 
- #if !CONFIG_IS_ENABLED(OF_CONTROL)
- static const struct ns16550_platdata am33xx_serial[] = {
--	{ .base = CONFIG_SYS_NS16550_COM1, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-+	{ .base = CONFIG_SYS_NS16550_COM1, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
- # ifdef CONFIG_SYS_NS16550_COM2
--	{ .base = CONFIG_SYS_NS16550_COM2, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-+	{ .base = CONFIG_SYS_NS16550_COM2, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
- #  ifdef CONFIG_SYS_NS16550_COM3
--	{ .base = CONFIG_SYS_NS16550_COM3, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
--	{ .base = CONFIG_SYS_NS16550_COM4, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
--	{ .base = CONFIG_SYS_NS16550_COM5, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
--	{ .base = CONFIG_SYS_NS16550_COM6, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-+	{ .base = CONFIG_SYS_NS16550_COM3, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
-+	{ .base = CONFIG_SYS_NS16550_COM4, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
-+	{ .base = CONFIG_SYS_NS16550_COM5, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
-+	{ .base = CONFIG_SYS_NS16550_COM6, .reg_shift = 2,
-+	  .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
- #  endif
- # endif
- };
-diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c
-index 3d1d26d13d13..b3a041b539af 100644
---- a/arch/arm/mach-tegra/board.c
-+++ b/arch/arm/mach-tegra/board.c
-@@ -219,6 +219,7 @@ static struct ns16550_platdata ns16550_com1_pdata = {
- 	.base = CONFIG_SYS_NS16550_COM1,
- 	.reg_shift = 2,
- 	.clock = CONFIG_SYS_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(ns16550_com1) = {
-diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
-index ae7959b1eb6e..5a3498f570a6 100644
---- a/board/isee/igep00x0/igep00x0.c
-+++ b/board/isee/igep00x0/igep00x0.c
-@@ -32,7 +32,8 @@ DECLARE_GLOBAL_DATA_PTR;
- static const struct ns16550_platdata igep_serial = {
- 	.base = OMAP34XX_UART3,
- 	.reg_shift = 2,
--	.clock = V_NS16550_CLK
-+	.clock = V_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(igep_uart) = {
-diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
-index 0662449c3875..b2b8f8861f11 100644
---- a/board/lg/sniper/sniper.c
-+++ b/board/lg/sniper/sniper.c
-@@ -31,7 +31,8 @@ const omap3_sysinfo sysinfo = {
- static const struct ns16550_platdata serial_omap_platdata = {
- 	.base = OMAP34XX_UART3,
- 	.reg_shift = 2,
--	.clock = V_NS16550_CLK
-+	.clock = V_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(sniper_serial) = {
-diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
-index 21b3fdcf49cf..b2fcc28f8b4b 100644
---- a/board/logicpd/omap3som/omap3logic.c
-+++ b/board/logicpd/omap3som/omap3logic.c
-@@ -49,7 +49,8 @@ DECLARE_GLOBAL_DATA_PTR;
- static const struct ns16550_platdata omap3logic_serial = {
- 	.base = OMAP34XX_UART1,
- 	.reg_shift = 2,
--	.clock = V_NS16550_CLK
-+	.clock = V_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(omap3logic_uart) = {
-diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
-index 2821ee22674f..0fad23af62f6 100644
---- a/board/logicpd/zoom1/zoom1.c
-+++ b/board/logicpd/zoom1/zoom1.c
-@@ -47,7 +47,8 @@ static const u32 gpmc_lab_enet[] = {
- static const struct ns16550_platdata zoom1_serial = {
- 	.base = OMAP34XX_UART3,
- 	.reg_shift = 2,
--	.clock = V_NS16550_CLK
-+	.clock = V_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(zoom1_uart) = {
-diff --git a/board/overo/overo.c b/board/overo/overo.c
-index 40f13e5876cc..5e447262bcfd 100644
---- a/board/overo/overo.c
-+++ b/board/overo/overo.c
-@@ -70,7 +70,8 @@ static struct {
- static const struct ns16550_platdata overo_serial = {
- 	.base = OMAP34XX_UART3,
- 	.reg_shift = 2,
--	.clock = V_NS16550_CLK
-+	.clock = V_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(overo_uart) = {
-diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c
-index 77e4482906f0..793aa9023150 100644
---- a/board/quipos/cairo/cairo.c
-+++ b/board/quipos/cairo/cairo.c
-@@ -93,7 +93,8 @@ void get_board_mem_timings(struct board_sdrc_timings *timings)
- static const struct ns16550_platdata cairo_serial = {
- 	.base = OMAP34XX_UART2,
- 	.reg_shift = 2,
--	.clock = V_NS16550_CLK
-+	.clock = V_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(cairo_uart) = {
-diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
-index cfdab3e34253..23c79333a223 100644
---- a/board/ti/beagle/beagle.c
-+++ b/board/ti/beagle/beagle.c
-@@ -75,7 +75,8 @@ static struct {
- static const struct ns16550_platdata beagle_serial = {
- 	.base = OMAP34XX_UART3,
- 	.reg_shift = 2,
--	.clock = V_NS16550_CLK
-+	.clock = V_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(beagle_uart) = {
-diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
-index f785dbe6d732..b2f060b2ddbf 100644
---- a/board/timll/devkit8000/devkit8000.c
-+++ b/board/timll/devkit8000/devkit8000.c
-@@ -48,7 +48,8 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = {
- static const struct ns16550_platdata devkit8000_serial = {
- 	.base = OMAP34XX_UART3,
- 	.reg_shift = 2,
--	.clock = V_NS16550_CLK
-+	.clock = V_NS16550_CLK,
-+	.fcr = UART_FCR_DEFVAL,
- };
- 
- U_BOOT_DEVICE(devkit8000_uart) = {
-diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
-index 9b423a591d8a..2df4a1f04fe5 100644
---- a/drivers/serial/ns16550.c
-+++ b/drivers/serial/ns16550.c
-@@ -20,9 +20,6 @@ DECLARE_GLOBAL_DATA_PTR;
- #define UART_LCRVAL UART_LCR_8N1		/* 8 data, 1 stop, no parity */
- #define UART_MCRVAL (UART_MCR_DTR | \
- 		     UART_MCR_RTS)		/* RTS/DTR */
--#define UART_FCRVAL (UART_FCR_FIFO_EN |	\
--		     UART_FCR_RXSR |	\
--		     UART_FCR_TXSR)		/* Clear & enable FIFOs */
- 
- #ifndef CONFIG_DM_SERIAL
- #ifdef CONFIG_SYS_NS16550_PORT_MAPPED
-@@ -138,7 +135,7 @@ static u32 ns16550_getfcr(NS16550_t port)
- #else
- static u32 ns16550_getfcr(NS16550_t port)
- {
--	return UART_FCRVAL;
-+	return UART_FCR_DEFVAL;
- }
- #endif
- 
-@@ -275,7 +272,7 @@ static inline void _debug_uart_init(void)
- 					    CONFIG_BAUDRATE);
- 	serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER);
- 	serial_dout(&com_port->mcr, UART_MCRVAL);
--	serial_dout(&com_port->fcr, UART_FCRVAL);
-+	serial_dout(&com_port->fcr, UART_FCR_DEFVAL);
- 
- 	serial_dout(&com_port->lcr, UART_LCR_BKSE | UART_LCRVAL);
- 	serial_dout(&com_port->dll, baud_divisor & 0xff);
-@@ -440,7 +437,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
- 		return -EINVAL;
- 	}
- 
--	plat->fcr = UART_FCRVAL;
-+	plat->fcr = UART_FCR_DEFVAL;
- 	if (port_type == PORT_JZ4780)
- 		plat->fcr |= UART_FCR_UME;
- 
-diff --git a/drivers/serial/serial_rockchip.c b/drivers/serial/serial_rockchip.c
-index 6bac95a414ce..c06afc58f7ea 100644
---- a/drivers/serial/serial_rockchip.c
-+++ b/drivers/serial/serial_rockchip.c
-@@ -27,6 +27,7 @@ static int rockchip_serial_probe(struct udevice *dev)
- 	plat->plat.base = plat->dtplat.reg[0];
- 	plat->plat.reg_shift = plat->dtplat.reg_shift;
- 	plat->plat.clock = plat->dtplat.clock_frequency;
-+	plat->plat.fcr = UART_FCR_DEFVAL;
- 	dev->platdata = &plat->plat;
- 
- 	return ns16550_serial_probe(dev);
-diff --git a/include/ns16550.h b/include/ns16550.h
-index 7c9703683109..5fcbcd2e74e3 100644
---- a/include/ns16550.h
-+++ b/include/ns16550.h
-@@ -121,6 +121,11 @@ typedef struct NS16550 *NS16550_t;
- /* Ingenic JZ47xx specific UART-enable bit. */
- #define UART_FCR_UME		0x10
- 
-+/* Clear & enable FIFOs */
-+#define UART_FCR_DEFVAL (UART_FCR_FIFO_EN | \
-+			UART_FCR_RXSR |	\
-+			UART_FCR_TXSR)
-+
- /*
-  * These are the definitions for the Modem Control Register
-  */
--- 
-2.17.0
-

+ 27 - 6
package/boot/uboot-sunxi/Makefile

@@ -9,9 +9,9 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
-PKG_VERSION:=2017.11
+PKG_VERSION:=2018.05
 
-PKG_HASH:=6a018fd3caf58f3dcfa23ee989a82bd35df03af71872b9dca8c6d758a0d26c05
+PKG_HASH:=4da13c2a6139a78cc08608f21fd4741db27eda336cfad7ab8264fda923b9c048
 
 PKG_MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
 
@@ -150,6 +150,12 @@ define U-Boot/orangepi_r1
   BUILD_DEVICES:=sun8i-h2-plus-orangepi-r1
 endef
 
+define U-Boot/orangepi_zero
+  BUILD_SUBTARGET:=cortexa7
+  NAME:=Orange Pi Zero (H2+)
+  BUILD_DEVICES:=sun8i-h2-plus-orangepi-zero
+endef
+
 define U-Boot/orangepi_pc
   BUILD_SUBTARGET:=cortexa7
   NAME:=Orange Pi PC (H3)
@@ -182,6 +188,14 @@ define U-Boot/nanopi_neo_plus2
   UENV:=a64
 endef
 
+define U-Boot/nanopi_neo2
+  BUILD_SUBTARGET:=cortexa53
+  NAME:=NanoPi NEO2 (H5)
+  BUILD_DEVICES:=sun50i-h5-nanopi-neo2
+  DEPENDS:=+PACKAGE_u-boot-nanopi_neo2:arm-trusted-firmware-sunxi
+  UENV:=a64
+endef
+
 define U-Boot/pine64_plus
   BUILD_SUBTARGET:=cortexa53
   NAME:=Pine64 Plus A64
@@ -207,6 +221,14 @@ define U-Boot/orangepi_zero_plus
   UENV:=a64
 endef
 
+define U-Boot/orangepi_pc2
+  BUILD_SUBTARGET:=cortexa53
+  NAME:=Xunlong Orange Pi PC2
+  BUILD_DEVICES:=sun50i-h5-orangepi-pc2
+  DEPENDS:=+PACKAGE_u-boot-orangepi_pc2:arm-trusted-firmware-sunxi
+  UENV:=a64
+endef
+
 UBOOT_TARGETS := \
 	A10-OLinuXino-Lime \
 	A13-OLinuXino \
@@ -229,10 +251,13 @@ UBOOT_TARGETS := \
 	nanopi_m1_plus \
 	nanopi_neo \
 	nanopi_neo_plus2 \
+	nanopi_neo2 \
+	orangepi_zero \
 	orangepi_r1 \
 	orangepi_pc \
 	orangepi_plus \
 	orangepi_2 \
+	orangepi_pc2 \
 	pangolin \
 	pine64_plus \
 	sopine_baseboard \
@@ -245,11 +270,7 @@ UBOOT_MAKE_FLAGS += \
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
-ifeq ($(SUBTARGET),cortexa53)
-	cat $(PKG_BUILD_DIR)/spl/sunxi-spl.bin $(PKG_BUILD_DIR)/u-boot.itb > $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-u-boot-with-spl.bin
-else
 	$(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-u-boot-with-spl.bin
-endif
 	mkimage -C none -A arm -T script -d uEnv-$(UENV).txt \
 		$(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-boot.scr
 endef

+ 2 - 2
package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch

@@ -1,6 +1,6 @@
 --- a/arch/arm/dts/Makefile
 +++ b/arch/arm/dts/Makefile
-@@ -261,6 +261,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \
+@@ -290,6 +290,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \
  	sun6i-a31-m9.dtb \
  	sun6i-a31-mele-a1000g-quad.dtb \
  	sun6i-a31-mixtile-loftq.dtb \
@@ -360,7 +360,7 @@
 +CONFIG_SUNXI_SPI=y
 --- a/arch/arm/mach-sunxi/Kconfig
 +++ b/arch/arm/mach-sunxi/Kconfig
-@@ -752,6 +752,14 @@ config VIDEO_LCD_PANEL_I2C_SCL
+@@ -836,6 +836,14 @@ config VIDEO_LCD_PANEL_I2C_SCL
  	Set the SCL pin for the LCD i2c interface. This takes a string in the
  	format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
  

+ 1 - 1
package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch

@@ -2,7 +2,7 @@
 
 --- a/configs/A20-OLinuXino-Lime2_defconfig
 +++ b/configs/A20-OLinuXino-Lime2_defconfig
-@@ -24,6 +24,7 @@ CONFIG_DFU_RAM=y
+@@ -22,6 +22,7 @@ CONFIG_DFU_RAM=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_RGMII=y
  CONFIG_SUN7I_GMAC=y

+ 1 - 1
package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch

@@ -14,7 +14,7 @@ More specifically, the following settings are now used:
 
 --- a/arch/arm/mach-sunxi/clock_sun6i.c
 +++ b/arch/arm/mach-sunxi/clock_sun6i.c
-@@ -113,11 +113,12 @@ void clock_set_pll1(unsigned int clk)
+@@ -112,11 +112,12 @@ void clock_set_pll1(unsigned int clk)
  	struct sunxi_ccm_reg * const ccm =
  		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
  	const int p = 0;

+ 2 - 2
package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch

@@ -18,7 +18,7 @@ required setting for the PLL LDO is 1.37v as per the A31 manual.
 
 --- a/arch/arm/mach-sunxi/clock_sun6i.c
 +++ b/arch/arm/mach-sunxi/clock_sun6i.c
-@@ -26,13 +26,26 @@ void clock_init_safe(void)
+@@ -25,13 +25,26 @@ void clock_init_safe(void)
  	struct sunxi_prcm_reg * const prcm =
  		(struct sunxi_prcm_reg *)SUNXI_PRCM_BASE;
  
@@ -49,7 +49,7 @@ required setting for the PLL LDO is 1.37v as per the A31 manual.
  #if defined(CONFIG_MACH_SUN8I_R40) || defined(CONFIG_MACH_SUN50I)
 --- a/arch/arm/include/asm/arch-sunxi/prcm.h
 +++ b/arch/arm/include/asm/arch-sunxi/prcm.h
-@@ -111,13 +111,13 @@
+@@ -110,13 +110,13 @@
  #define PRCM_PLL_CTRL_LDO_OUT_MASK \
  	__PRCM_PLL_CTRL_LDO_OUT(0x7)
  /* When using the low voltage 20 mV steps, and high voltage 30 mV steps */

+ 1 - 1
package/boot/uboot-sunxi/patches/100-sun6i-alternate-on-UART2.patch

@@ -6,7 +6,7 @@ Subject: sun6i: define alternate-function for UART2 on GPG
 
 --- a/arch/arm/include/asm/arch-sunxi/gpio.h
 +++ b/arch/arm/include/asm/arch-sunxi/gpio.h
-@@ -186,6 +186,7 @@ enum sunxi_gpio_number {
+@@ -185,6 +185,7 @@ enum sunxi_gpio_number {
  #define SUN6I_GPG_SDC1		2
  #define SUN8I_GPG_SDC1		2
  #define SUN6I_GPG_TWI3		2

Some files were not shown because too many files changed in this diff