Re: [OpenWrt-Devel] [PATCH] bzip2: Fix download URL

2018-10-31 Thread Rosen Penev
On Wed, Oct 31, 2018 at 1:26 AM Syrone Wong  wrote:
>
> It's default behavior according to
> https://github.com/openwrt/openwrt/blob/master/scripts/download.pl#L263
The idea is to eliminate the dead URL. A solution like this is already
used in multiple places throughout the tree.
>
> Best Regards,
> Syrone Wong
> On Tue, Oct 30, 2018 at 1:18 AM Rosen Penev  wrote:
> >
> > Main website went down. Use openwrt sources for it.
> >
> > Matches a similar buildroot commit.
> >
> > Signed-off-by: Rosen Penev 
> > ---
> >  package/utils/bzip2/Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/package/utils/bzip2/Makefile b/package/utils/bzip2/Makefile
> > index ea2fc76833..9f4b1c4529 100644
> > --- a/package/utils/bzip2/Makefile
> > +++ b/package/utils/bzip2/Makefile
> > @@ -12,7 +12,7 @@ PKG_VERSION:=1.0.6
> >  PKG_RELEASE:=4
> >
> >  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> > -PKG_SOURCE_URL:=http://www.bzip.org/$(PKG_VERSION)
> > +PKG_SOURCE_URL:=https://downloads.openwrt.org/sources
> >  PKG_HASH:=a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd
> >  PKG_MAINTAINER:=Steven Barth 
> >
> > --
> > 2.19.1
> >
> >
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] tools/patch: Add fedora patch for crashing git style patches

2018-10-31 Thread Rosen Penev
https://lists.gnu.org/archive/html/bug-patch/2018-10/msg0.html

I assume a CVE number will be assigned soon.

Signed-off-by: Rosen Penev 
---
 tools/patch/Makefile  |  2 +-
 ...rror-handling-with-git-style-patches.patch | 58 +++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 
tools/patch/patches/040-Fix-error-handling-with-git-style-patches.patch

diff --git a/tools/patch/Makefile b/tools/patch/Makefile
index 7323b5b2ab..cab9fee9f6 100644
--- a/tools/patch/Makefile
+++ b/tools/patch/Makefile
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=patch
 PKG_VERSION:=2.7.6
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_CPE_ID:=cpe:/a:gnu:patch
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
diff --git 
a/tools/patch/patches/040-Fix-error-handling-with-git-style-patches.patch 
b/tools/patch/patches/040-Fix-error-handling-with-git-style-patches.patch
new file mode 100644
index 00..8d65ffe925
--- /dev/null
+++ b/tools/patch/patches/040-Fix-error-handling-with-git-style-patches.patch
@@ -0,0 +1,58 @@
+From 424da221cec76ea200cff1fa9b08a6f3d94c28a7 Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel 
+Date: Wed, 31 Oct 2018 16:39:13 -0700
+Subject: [PATCH] Fix error handling with git-style patches
+
+When an error is encountered in output_files(), the subsequent call to
+cleanup() calls back into output_files() resulting in an infinte recursion.
+This is trivially reproduced with a git-style patch (which utilizes
+output_file_later()) that tries to patch a nonexistent or unreadable
+file (see attached test case).
+
+* src/patch.c: (output_files) clear the files_to_output list before
+iterating it, so that recursive calls won't iterate the same files.
+---
+ src/patch.c | 12 
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/patch.c b/src/patch.c
+index 0fe6d72..dfee378 100644
+--- a/src/patch.c
 b/src/patch.c
+@@ -1938,8 +1938,12 @@ output_files (struct stat const *st)
+ {
+   gl_list_iterator_t iter;
+   const void *elt;
++  gl_list_t files;
+ 
+-  iter = gl_list_iterator (files_to_output);
++  files = files_to_output;
++  init_files_to_output ();
++
++  iter = gl_list_iterator (files);
+   while (gl_list_iterator_next (, , NULL))
+ {
+   const struct file_to_output *file_to_output = elt;
+@@ -1957,8 +1961,8 @@ output_files (struct stat const *st)
+ /* Free the list up to here. */
+ for (;;)
+   {
+-const void *elt2 = gl_list_get_at (files_to_output, 0);
+-gl_list_remove_at (files_to_output, 0);
++const void *elt2 = gl_list_get_at (files, 0);
++gl_list_remove_at (files, 0);
+ if (elt == elt2)
+   break;
+   }
+@@ -1967,7 +1971,7 @@ output_files (struct stat const *st)
+   }
+ }
+   gl_list_iterator_free ();
+-  gl_list_clear (files_to_output);
++  gl_list_clear (files);
+ }
+ 
+ /* Fatal exit with cleanup. */
+-- 
+2.19.1
+
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ath79: add support for Archer C58/C59 v1

2018-10-31 Thread David Bauer
This commit adds support for the Archer C58 v1 and C59 v1, previously
supported in the ar71xx target.

CPU:   Qualcomm QCA9561
RAM:   64M (C58) / 128M (C59)
FLASH: 8M (C58) / 16M (C59)
WiFi:  QCA9561 bgn 3x3:3
   QCA9888 nac 2x2:2
LED:   Power, WiFi 2.4, WiFi 5, WAN green, WAN amber, LAN, WPS
   Only C59: USB
BTN:   WPS, WiFi, Reset

Installation


Via Web-UI:
Update factory image via Web-UI.

Via TFTP:
Rename factory image to "tp_recovery.bin" and place it in the root-dir
of your tftp server. Configure to listen on 192.168.0.66. Power up the
router while holding down the reset-button. The router will flash itself
and reboot.

Note: For TFTP, you might need a switch between router and computer, as
link establishment might take to long.

Signed-off-by: David Bauer 
---
 .../ath79/base-files/etc/board.d/01_leds  |   5 +
 .../ath79/base-files/etc/board.d/02_network   |   4 +-
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |   6 +
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |   4 +
 .../dts/qca9561_tplink_archer-c58-v1.dts  | 130 +++
 .../dts/qca9561_tplink_archer-c59-v1.dts  | 153 ++
 .../ath79/dts/qca9561_tplink_archer-c5x.dtsi  |  98 +++
 target/linux/ath79/image/common-tp-link.mk|  20 +++
 target/linux/ath79/image/generic-tp-link.mk   |  22 +++
 9 files changed, 441 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts
 create mode 100644 target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
 create mode 100644 target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi

diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds 
b/target/linux/ath79/base-files/etc/board.d/01_leds
index f04eb7f5c6..95a4201fb2 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -49,6 +49,11 @@ pcs,cr3000)
ucidef_set_led_switch "lan3" "LAN3" "pcs:blue:lan3" "switch0" "0x10"
ucidef_set_led_switch "lan4" "LAN4" "pcs:blue:lan4" "switch0" "0x02"
;;
+tplink,archer-c58-v1|\
+tplink,archer-c59-v1)
+   ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x1E"
+   ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0"
+   ;;
 tplink,re450-v2)
ucidef_set_led_netdev "lan_data" "LAN Data" "tp-link:green:lan_data" 
"eth0" "tx rx"
ucidef_set_led_netdev "lan_link" "LAN Link" "tp-link:green:lan_link" 
"eth0" "link"
diff --git a/target/linux/ath79/base-files/etc/board.d/02_network 
b/target/linux/ath79/base-files/etc/board.d/02_network
index 5f02c5769a..e3f8c3eee3 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -31,7 +31,9 @@ ath79_setup_interfaces()
wd,mynet-wifi-rangeextender)
ucidef_set_interface_lan "eth0"
;;
-   avm,fritz4020)
+   avm,fritz4020|\
+   tplink,archer-c58-v1|\
+   tplink,archer-c59-v1)
ucidef_set_interface_wan "eth0"
ucidef_add_switch "switch0" \
"0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
diff --git 
a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index dfe2d3ef31..d8d18191a7 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -127,6 +127,12 @@ case "$FIRMWARE" in
ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
+   tplink,archer-c58-v1|\
+   tplink,archer-c59-v1)
+   ath10kcal_extract "art" 20480 12064
+   ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
+   /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
+   ;;
esac
;;
 *)
diff --git 
a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac 
b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index 59c58f9c67..fe5aa64a19 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -18,6 +18,10 @@ case "$board" in
[ "$PHYNBR" -eq 1 ] && \
echo $(k2t_get_mac "lan_mac") > 
/sys${DEVPATH}/macaddress
;;
+   tplink,archer-c58-v1|\
+   tplink,archer-c59-v1)
+   echo $(macaddr_add $(mtd_get_mac_binary mac 8)  $(($PHYNBR - 
1)) ) > /sys${DEVPATH}/macaddress
+   ;;
*)
;;
 esac
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts 
b/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts
new file mode 100644
index 00..ffce955fd3
--- /dev/null
+++ 

[OpenWrt-Devel] [PATCH v2 1/2] x86: add amd microcode entries to grub config

2018-10-31 Thread Tomasz Maciej Nowak
Create initrd enries for x86 images, that'll load amd microcode as early
as possible. Also remove the preinit script responsible for late load of
microcode.

Signed-off-by: Tomasz Maciej Nowak 
---
 .../x86/base-files/lib/preinit/02_load_x86_ucode | 12 
 target/linux/x86/image/grub-iso.cfg  |  9 +++--
 target/linux/x86/image/grub.cfg  |  9 +++--
 3 files changed, 14 insertions(+), 16 deletions(-)
 delete mode 100644 target/linux/x86/base-files/lib/preinit/02_load_x86_ucode

diff --git a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode 
b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
deleted file mode 100644
index d3a23e24b2..00
--- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2018 OpenWrt.org
-
-do_load_x86_ucode() {
-   if grep -q AuthenticAMD /proc/cpuinfo; then
-   if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
-   echo 1 > /sys/devices/system/cpu/microcode/reload
-   fi
-   fi
-}
-
-boot_hook_add preinit_main do_load_x86_ucode
diff --git a/target/linux/x86/image/grub-iso.cfg 
b/target/linux/x86/image/grub-iso.cfg
index 5d128aa3aa..c624cbe0ee 100644
--- a/target/linux/x86/image/grub-iso.cfg
+++ b/target/linux/x86/image/grub-iso.cfg
@@ -7,7 +7,12 @@ set root='(cd)'
 
 menuentry "@TITLE@" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
-   if [ -s /boot/intel-ucode.img ]; then
-   initrd /boot/intel-ucode.img
+   set amd="/boot/amd-ucode.img"
+   set intel="/boot/intel-ucode.img"
+   if [ -s "$amd" ]; then
+   initrd $amd $intel
+   fi
+   if [ -s "$intel" ]; then
+   initrd $intel $amd
fi
 }
diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg
index a665686863..21d719261b 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -7,8 +7,13 @@ set root='(@ROOT@)'
 
 menuentry "@TITLE@" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
-   if [ -s /boot/intel-ucode.img ]; then
-   initrd /boot/intel-ucode.img
+   set amd="/boot/amd-ucode.img"
+   set intel="/boot/intel-ucode.img"
+   if [ -s "$amd" ]; then
+   initrd $amd $intel
+   fi
+   if [ -s "$intel" ]; then
+   initrd $intel $amd
fi
 }
 menuentry "@TITLE@ (failsafe)" {
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 2/2] amd64-microcode: create early load microcode image

2018-10-31 Thread Tomasz Maciej Nowak
Create initrd image with packed microcode. This'll allow to load it at
early boot stage.

Signed-off-by: Tomasz Maciej Nowak 
---
 package/firmware/amd64-microcode/Makefile | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/firmware/amd64-microcode/Makefile 
b/package/firmware/amd64-microcode/Makefile
index 4fd3d04610..adf3352af2 100644
--- a/package/firmware/amd64-microcode/Makefile
+++ b/package/firmware/amd64-microcode/Makefile
@@ -35,11 +35,17 @@ define Build/Prepare
 endef
 
 define Build/Compile
+   mkdir -p $(PKG_BUILD_DIR)/kernel/x86/microcode/
+   cat $(PKG_BUILD_DIR)/microcode_amd*.bin \
+   > $(PKG_BUILD_DIR)/kernel/x86/microcode/AuthenticAMD.bin
+   (cd $(PKG_BUILD_DIR); \
+   echo "kernel/x86/microcode/AuthenticAMD.bin" \
+   | cpio -o -H newc --reproducible > amd-ucode.cpio)
 endef
 
 define Package/amd64-microcode/install
-   $(INSTALL_DIR) $(1)/lib/firmware/amd-ucode
-   $(INSTALL_DATA) $(PKG_BUILD_DIR)/*.bin $(1)/lib/firmware/amd-ucode
+   $(INSTALL_DIR) $(1)/boot
+   $(INSTALL_DATA) $(PKG_BUILD_DIR)/amd-ucode.cpio $(1)/boot/amd-ucode.img
 endef
 
 $(eval $(call BuildPackage,amd64-microcode))
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 0/2] amd-microcode: load as early as possible

2018-10-31 Thread Tomasz Maciej Nowak
This series is continuation of previous atempt [1]. AFAIK there are no
caveats for late loading of microcode for AMD processors, so it makes
this series completely optional, but as kernel folks consider late load
of microcode legacy method [2] lets switch to early one.
Loading of microcode  was succesfully tested on Acer D1F-AD (OEM)
mainboard.

Needs to be applied after "intel-microcode: load as early as possible"
series [3] or successor.

1. https://patchwork.ozlabs.org/project/lede/list/?series=40618
2. 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/x86/microcode.txt#n89
3. https://patchwork.ozlabs.org/project/openwrt/list/?series=73447

Changes v2:
  - rework the microcode loading; if both microcode images (amd and
intel) were installed, grub loaded only the last one defined as
initrd:
x86: add amd microcode entries to grub config
  - no changes:
amd64-microcode: create early load microcode image

Tomasz Maciej Nowak (2):
  x86: add amd microcode entries to grub config
  amd64-microcode: create early load microcode image

 package/firmware/amd64-microcode/Makefile| 10 --
 .../x86/base-files/lib/preinit/02_load_x86_ucode | 12 
 target/linux/x86/image/grub-iso.cfg  |  9 +++--
 target/linux/x86/image/grub.cfg  |  9 +++--
 4 files changed, 22 insertions(+), 18 deletions(-)
 delete mode 100644 target/linux/x86/base-files/lib/preinit/02_load_x86_ucode

-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 3/6] x86: add packages files to image bootfs

2018-10-31 Thread Tomasz Maciej Nowak
Add files to bootfs image from selected as built-in packages, which want
to install files to targets boot file system.

Signed-off-by: Tomasz Maciej Nowak 
---
 target/linux/x86/image/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index b537c40f24..310a143e13 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -85,6 +85,7 @@ ifneq ($(CONFIG_GRUB_IMAGES),)
-e 's#@ROOT@#$(GRUB_ROOT)#g' \
-e 's#@TITLE@#$(GRUB_TITLE)#g' \
./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+   -$(CP) $(STAGING_DIR_ROOT)/boot/* $(KDIR)/root.grub/boot/
PADDING="$(CONFIG_TARGET_IMAGES_PAD)" SIGNATURE="$(SIGNATURE)" 
PATH="$(TARGET_PATH)" $(SCRIPT_DIR)/gen_image_generic.sh \
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
$(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.grub \
@@ -123,6 +124,7 @@ define Image/Build/iso
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
-e 's#@TITLE@#$(GRUB_TITLE)#g' \
./grub-iso.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+   -$(CP) $(STAGING_DIR_ROOT)/boot/* $(KDIR)/root.grub/boot/
mkisofs -R -b boot/grub/eltorito.img -no-emul-boot -boot-info-table \
-o $(KDIR)/root.iso $(KDIR)/root.grub $(TARGET_DIR)
 endef
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 5/6] x86: add intel microcode entries to grub config

2018-10-31 Thread Tomasz Maciej Nowak
Create initrd enries for x86 images, that'll load intel microcode as
early as possible. To achieve that the test module for grub is enabled
which provides shell-like conditionals. Also restrict the late load of
microcode to AMD processors.

Signed-off-by: Tomasz Maciej Nowak 
---
 target/linux/x86/base-files/lib/preinit/02_load_x86_ucode | 6 --
 target/linux/x86/image/Makefile   | 4 ++--
 target/linux/x86/image/grub-iso.cfg   | 3 +++
 target/linux/x86/image/grub.cfg   | 3 +++
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode 
b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
index fb309c75c1..d3a23e24b2 100644
--- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
+++ b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
@@ -2,8 +2,10 @@
 # Copyright (C) 2018 OpenWrt.org
 
 do_load_x86_ucode() {
-   if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
-   echo 1 > /sys/devices/system/cpu/microcode/reload
+   if grep -q AuthenticAMD /proc/cpuinfo; then
+   if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
+   echo 1 > /sys/devices/system/cpu/microcode/reload
+   fi
fi
 }
 
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index 310a143e13..036523e075 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -9,8 +9,8 @@ include $(INCLUDE_DIR)/image.mk
 
 export PATH=$(TARGET_PATH):/sbin
 
-GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot 
serial vga
-GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos 
reboot serial vga
+GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot 
serial test vga
+GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos 
reboot serial test vga
 GRUB_TERMINALS =
 GRUB_SERIAL_CONFIG =
 GRUB_TERMINAL_CONFIG =
diff --git a/target/linux/x86/image/grub-iso.cfg 
b/target/linux/x86/image/grub-iso.cfg
index 9c59bdf6d4..5d128aa3aa 100644
--- a/target/linux/x86/image/grub-iso.cfg
+++ b/target/linux/x86/image/grub-iso.cfg
@@ -7,4 +7,7 @@ set root='(cd)'
 
 menuentry "@TITLE@" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -s /boot/intel-ucode.img ]; then
+   initrd /boot/intel-ucode.img
+   fi
 }
diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg
index dedfa0a636..a665686863 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -7,6 +7,9 @@ set root='(@ROOT@)'
 
 menuentry "@TITLE@" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -s /boot/intel-ucode.img ]; then
+   initrd /boot/intel-ucode.img
+   fi
 }
 menuentry "@TITLE@ (failsafe)" {
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 2/6] x86: mount writable bootfs

2018-10-31 Thread Tomasz Maciej Nowak
Mount boot file system with rw option to allow installation of packages
which install files to /boot directory.

Signed-off-by: Tomasz Maciej Nowak 
---
 .../linux/x86/base-files/lib/preinit/79_move_config  | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/target/linux/x86/base-files/lib/preinit/79_move_config 
b/target/linux/x86/base-files/lib/preinit/79_move_config
index 7b34d9e5da..debce43557 100644
--- a/target/linux/x86/base-files/lib/preinit/79_move_config
+++ b/target/linux/x86/base-files/lib/preinit/79_move_config
@@ -8,16 +8,12 @@ move_config() {
 
if export_bootdevice && export_partdevice partdev 1; then
mkdir -p /boot
-   if mount -t ext4 -o ro,noatime "/dev/$partdev" /boot; then
-   if [ -f /boot/sysupgrade.tgz ]; then
-   mount /boot -o remount,rw,noatime
-   mv -f /boot/sysupgrade.tgz /
-   mount /boot -o remount,ro,noatime
-   fi
-   mount --bind /boot/boot /boot
+   mount -t ext4 -o rw,noatime "/dev/$partdev" /boot
+   mount --bind /boot/boot /boot
+   if [ -f /boot/sysupgrade.tgz ]; then
+   mv -f /boot/sysupgrade.tgz /
fi
fi
 }
 
 boot_hook_add preinit_mount_root move_config
-
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 0/6] intel-microcode: load as early as possible

2018-10-31 Thread Tomasz Maciej Nowak
This small series addresses current problem with late loading of Intel
microcode in OpenWrt. Following the commit messages [1] and later
discussion, late loading off the microcode can be ineffective for some
processors [2] and for others disabled [3]. Also it is discouraged for
any processor starting from Haswell and Silvermont.
Therefore this series converts the Intel microcode bundle to an initial
ram disk which is loaded with grub, so kernel has access to it as early
as possible.
Previous patch series:
https://patchwork.ozlabs.org/project/lede/list/?series=39372

1. https://lore.kernel.org/patchwork/cover/348236
2. https://lore.kernel.org/patchwork/cover/348236/#508603
3. 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=723f2828a98c8ca19842042f418fb30dd8cfc0f7

Changes in v3:
  - replaced "include/rootfs.mk: move boot directory for later use"
with "include/rootfs.mk: remove boot directory"; the final rootfs is
always created after targets rootfs, so there's no need to save
files for later use, also there was side effect to this approach,
it kept the old files if packages version changed and buildroot
wasn't cleaned beforehand
  - reflect the changes in "include/rootfs.mk: remove boot directory":
x86: add packages files to image bootfs
  - expand commit message, narrow down the test in grub config:
x86: add intel microcode entries to grub config
  - no changes:
1) x86: mount writable bootfs
2) intel-microcode: remove dependency on iucode-tool
3) intel-microcode: create early load microcode image

Changes in v2:
  - three new commits allowing buildsystem to properly handle packages
installing files to /boot directory, mainly for x86 target:
1) include/rootfs.mk: move boot directory for later use
2) x86: mount writable bootfs
3) x86: add packages files to image bootfs
  - uncomplicate test for AMD processors in:
x86: add intel microcode entries to grub config
  - remove package specific hook in x86 image Makefile, remove
postinst/prerm scripts and install microcode directly to /boot:
intel-microcode: create early load microcode image
  - no changes:
intel-microcode: remove dependency on iucode-tool

All changes in v2 sugested by Matthias Schiffer and Philip Prindeville.

Tomasz Maciej Nowak (6):
  include/rootfs.mk: remove boot directory
  x86: mount writable bootfs
  x86: add packages files to image bootfs
  intel-microcode: remove dependency on iucode-tool
  x86: add intel microcode entries to grub config
  intel-microcode: create early load microcode image

 include/rootfs.mk|  1 +
 package/firmware/intel-microcode/Makefile| 16 +---
 .../x86/base-files/lib/preinit/02_load_x86_ucode |  6 --
 .../x86/base-files/lib/preinit/79_move_config| 12 
 target/linux/x86/image/Makefile  |  6 --
 target/linux/x86/image/grub-iso.cfg  |  3 +++
 target/linux/x86/image/grub.cfg  |  3 +++
 7 files changed, 28 insertions(+), 19 deletions(-)

-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 1/6] include/rootfs.mk: remove boot directory

2018-10-31 Thread Tomasz Maciej Nowak
Currently every file in boot directory is copied over target /boot on
root file system and is usually inaccessible because appropriate boot
file system is mounted on top of it. Therefore remove /boot, which in
result will also save space on target root file system.

Signed-off-by: Tomasz Maciej Nowak 
---
 include/rootfs.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/rootfs.mk b/include/rootfs.mk
index 76425c017a..dc8621dbae 100644
--- a/include/rootfs.mk
+++ b/include/rootfs.mk
@@ -90,6 +90,7 @@ define prepare_rootfs
rm -f $(1)/usr/lib/opkg/lists/*
rm -f $(1)/usr/lib/opkg/info/*.postinst*
rm -f $(1)/var/lock/*.lock
+   rm -rf $(1)/boot
$(call clean_ipkg,$(1))
$(call mklibs,$(1))
 endef
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 4/6] intel-microcode: remove dependency on iucode-tool

2018-10-31 Thread Tomasz Maciej Nowak
It is not necessary to have iucode-tool present on target system to have
functional intel-microcode package. The build time dependency is kept.

Signed-off-by: Tomasz Maciej Nowak 
---
 package/firmware/intel-microcode/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/firmware/intel-microcode/Makefile 
b/package/firmware/intel-microcode/Makefile
index 6987c795c0..07db9b1f96 100644
--- a/package/firmware/intel-microcode/Makefile
+++ b/package/firmware/intel-microcode/Makefile
@@ -30,7 +30,7 @@ define Package/intel-microcode
   SECTION:=firmware
   CATEGORY:=Firmware
   URL:=$(PKG_SOURCE_URL)
-  DEPENDS:=@TARGET_x86 +iucode-tool
+  DEPENDS:=@TARGET_x86
   TITLE:=Intel x86 CPU microcode
 endef
 
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 6/6] intel-microcode: create early load microcode image

2018-10-31 Thread Tomasz Maciej Nowak
Create initrd image with packed microcode. This'll allow to load it at
early boot stage.

Signed-off-by: Tomasz Maciej Nowak 
---
 package/firmware/intel-microcode/Makefile | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/package/firmware/intel-microcode/Makefile 
b/package/firmware/intel-microcode/Makefile
index 07db9b1f96..4bd47b087a 100644
--- a/package/firmware/intel-microcode/Makefile
+++ b/package/firmware/intel-microcode/Makefile
@@ -35,15 +35,17 @@ define Package/intel-microcode
 endef
 
 define Build/Compile
-   IUCODE_TOOL=$(STAGING_DIR)/../host/bin/iucode_tool $(MAKE) -C 
$(PKG_BUILD_DIR)
-   mkdir $(PKG_BUILD_DIR)/intel-ucode-ipkg
-   $(STAGING_DIR)/../host/bin/iucode_tool -q \
-   --write-firmware=$(PKG_BUILD_DIR)/intel-ucode-ipkg 
$(PKG_BUILD_DIR)/$(MICROCODE).bin
+   IUCODE_TOOL=$(STAGING_DIR)/../host/bin/iucode_tool \
+   $(MAKE) -C $(PKG_BUILD_DIR)
+   $(STAGING_DIR)/../host/bin/iucode_tool -q --mini-earlyfw \
+   --write-earlyfw=$(PKG_BUILD_DIR)/intel-ucode.cpio \
+   $(PKG_BUILD_DIR)/$(MICROCODE).bin
 endef
 
 define Package/intel-microcode/install
-   $(INSTALL_DIR) $(1)/lib/firmware/intel-ucode
-   $(INSTALL_DATA) $(PKG_BUILD_DIR)/intel-ucode-ipkg/* 
$(1)/lib/firmware/intel-ucode
+   $(INSTALL_DIR) $(1)/boot
+   $(INSTALL_DATA) $(PKG_BUILD_DIR)/intel-ucode.cpio \
+   $(1)/boot/intel-ucode.img
 endef
 
 $(eval $(call BuildPackage,intel-microcode))
-- 
2.19.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] libiwinfo: nl80211: add mesh stats on assoclist.

2018-10-31 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 include/iwinfo.h |  6 +
 iwinfo_nl80211.c | 76 
 2 files changed, 82 insertions(+)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 49ee7f0..02ad623 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -126,6 +126,12 @@ struct iwinfo_assoclist_entry {
uint8_t is_mfp:1;
uint8_t is_tdls:1;
uint32_t thr;
+   uint16_t llid;
+   uint16_t plid;
+   char plink_state[16];
+   char local_ps[16];
+   char peer_ps[16];
+   char nonpeer_ps[16];
 };
 
 struct iwinfo_survey_entry {
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index ca78742..5154230 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1756,6 +1756,57 @@ static int nl80211_get_survey_cb(struct nl_msg *msg, 
void *arg)
return NL_SKIP;
 }
 
+
+static void plink_state_to_str(char *dst, unsigned state)
+{
+   switch (state) {
+   case NL80211_PLINK_LISTEN:
+   strcpy(dst, "LISTEN");
+   break;
+   case NL80211_PLINK_OPN_SNT:
+   strcpy(dst, "OPN_SNT");
+   break;
+   case NL80211_PLINK_OPN_RCVD:
+   strcpy(dst, "OPN_RCVD");
+   break;
+   case NL80211_PLINK_CNF_RCVD:
+   strcpy(dst, "CNF_RCVD");
+   break;
+   case NL80211_PLINK_ESTAB:
+   strcpy(dst, "ESTAB");
+   break;
+   case NL80211_PLINK_HOLDING:
+   strcpy(dst, "HOLDING");
+   break;
+   case NL80211_PLINK_BLOCKED:
+   strcpy(dst, "BLOCKED");
+   break;
+   default:
+   strcpy(dst, "UNKNOWN");
+   break;
+   }
+}
+
+static void power_mode_to_str(char *dst, struct nlattr *a)
+{
+   enum nl80211_mesh_power_mode pm = nla_get_u32(a);
+
+   switch (pm) {
+   case NL80211_MESH_POWER_ACTIVE:
+   strcpy(dst, "ACTIVE");
+   break;
+   case NL80211_MESH_POWER_LIGHT_SLEEP:
+   strcpy(dst, "LIGHT SLEEP");
+   break;
+   case NL80211_MESH_POWER_DEEP_SLEEP:
+   strcpy(dst, "DEEP SLEEP");
+   break;
+   default:
+   strcpy(dst, "UNKNOWN");
+   break;
+   }
+}
+
 static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
 {
struct nl80211_array_buf *arr = arg;
@@ -1783,6 +1834,13 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
[NL80211_STA_INFO_STA_FLAGS] =
{ .minlen = sizeof(struct nl80211_sta_flag_update) },
[NL80211_STA_INFO_EXPECTED_THROUGHPUT]   = { .type = NLA_U32
},
+   /* mesh */
+   [NL80211_STA_INFO_LLID]  = { .type = NLA_U16},
+   [NL80211_STA_INFO_PLID]  = { .type = NLA_U16},
+   [NL80211_STA_INFO_PLINK_STATE]   = { .type = NLA_U8 },
+   [NL80211_STA_INFO_LOCAL_PM]  = { .type = NLA_U32},
+   [NL80211_STA_INFO_PEER_PM]   = { .type = NLA_U32},
+   [NL80211_STA_INFO_NONPEER_PM]= { .type = NLA_U32},
};
 
static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
@@ -1852,6 +1910,24 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT])
e->thr = 
nla_get_u32(sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]);
 
+   /* mesh */
+   if (sinfo[NL80211_STA_INFO_LLID])
+   e->llid = nla_get_u16(sinfo[NL80211_STA_INFO_LLID]);
+
+   if (sinfo[NL80211_STA_INFO_PLID])
+   e->plid = nla_get_u16(sinfo[NL80211_STA_INFO_PLID]);
+
+   if (sinfo[NL80211_STA_INFO_PLINK_STATE])
+   plink_state_to_str(e->plink_state,
+   
nla_get_u8(sinfo[NL80211_STA_INFO_PLINK_STATE]));
+
+   if (sinfo[NL80211_STA_INFO_LOCAL_PM])
+   power_mode_to_str(e->local_ps, 
sinfo[NL80211_STA_INFO_LOCAL_PM]);
+   if (sinfo[NL80211_STA_INFO_PEER_PM])
+   power_mode_to_str(e->peer_ps, 
sinfo[NL80211_STA_INFO_PEER_PM]);
+   if (sinfo[NL80211_STA_INFO_NONPEER_PM])
+   power_mode_to_str(e->nonpeer_ps, 
sinfo[NL80211_STA_INFO_NONPEER_PM]);
+
/* Station flags */
if (sinfo[NL80211_STA_INFO_STA_FLAGS])
{
-- 
2.11.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] bzip2: Fix download URL

2018-10-31 Thread Syrone Wong
It's default behavior according to
https://github.com/openwrt/openwrt/blob/master/scripts/download.pl#L263

Best Regards,
Syrone Wong
On Tue, Oct 30, 2018 at 1:18 AM Rosen Penev  wrote:
>
> Main website went down. Use openwrt sources for it.
>
> Matches a similar buildroot commit.
>
> Signed-off-by: Rosen Penev 
> ---
>  package/utils/bzip2/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/utils/bzip2/Makefile b/package/utils/bzip2/Makefile
> index ea2fc76833..9f4b1c4529 100644
> --- a/package/utils/bzip2/Makefile
> +++ b/package/utils/bzip2/Makefile
> @@ -12,7 +12,7 @@ PKG_VERSION:=1.0.6
>  PKG_RELEASE:=4
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> -PKG_SOURCE_URL:=http://www.bzip.org/$(PKG_VERSION)
> +PKG_SOURCE_URL:=https://downloads.openwrt.org/sources
>  PKG_HASH:=a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd
>  PKG_MAINTAINER:=Steven Barth 
>
> --
> 2.19.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel