Re: [LEDE-DEV] [PATCH] kernel: bump 4.14 to 4.14.39

2018-05-08 Thread Tomasz Maciej Nowak
W dniu 08.05.2018 o 15:54, Koen Vandeputte pisze:
> 
> 
> On 2018-05-08 15:47, Michael Yartys wrote:
>> The patch doesn't apply without changing what I've highlighted below.
>>
>>
>> diff --git a/include/kernel-version.mk b/include/kernel-version.mk
>>
>> index 68795f767c04..192ee1c2e969 100644
>>
>> --- a/include/kernel-version.mk
>>
>> +++ b/include/kernel-version.mk
>>
>> @@ -4,13 +4,13 @@ LINUX_RELEASE?=1
>>
>> LINUX_VERSION-3.18 = .71
>>
>> LINUX_VERSION-4.4 = .121
>>
>> -LINUX_VERSION-4.14 = .37
>>
>> LINUX_VERSION-4.9 = .98
>>
>> +LINUX_VERSION-4.14 = .39
>> ^ Must be reordered so that 4.9 is above 4.14. Also, 4.9 is at .96 and 
>> not .98, which might also cause some issues.
>>> LINUX_KERNEL_HASH-3.18.71 = 
>>> 5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240
>>>
>>> LINUX_KERNEL_HASH-4.4.121 = 
>>> 44a88268b5088dc326b30c9b9133ac35a9a200b636b7268d08f32abeae6ca729
>>>
>>> -LINUX_KERNEL_HASH-4.14.37 = 
>>> 8197e7ed3620713e412905430a7bf93e2048384042ffba189a66f0eeb6908e92
>>>
>>> LINUX_KERNEL_HASH-4.9.98 = 
>>> 12cd90355adbc946e7e95aa5cdef2dd99b8e166cb64fe53a91c3e1d8f81810ef
>>>
>>> +LINUX_KERNEL_HASH-4.14.39 = 
>>> 269fc576ab0509e10c3b26e57866aea3f272c17f172f14fd75e2676d38c1b7bd
>>>
>> ^ The same here. Change hash if kernel 4.9.98 is also an issue.
>>> remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1
>>>
>>> sanitize_uri=$(call qstrip,$(subst @,,$(subst :,,$(subst .,,$(subst 
>>> -,,$(subst /,_,$(1)))
> Hi,
> 
> As mentioned in the patch notes:
> - Please apply the patch from Kevin DB first before applying this one 
> (kernel: bump 4.9 to 4.9.98)

It still doesn't apply after Kevin patch. Michael is right with "reordering" 
part.
You also added refresh_kernel.sh to the tree. After cleaning the patch You can 
add my Tested-by, I tested it on mvebu/espressobin.

> 
> 
> I'm doing this on purpose so it's easier for maintainers to just apply both 
> patches at once, without requiring any modification of the 
> include/kernel-version file
> 
> 
> Koen
> 
> ___
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev

Regards, Tomasz.
-- 
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 2/2] kernel: bump 4.14 to 4.14.38

2018-05-07 Thread Tomasz Maciej Nowak
W dniu 07.05.2018 o 14:46, Koen Vandeputte pisze:
> 
> 
> On 2018-05-06 23:41, Koen Vandeputte wrote:
>>
>>
>> On 06-05-18 19:25, Tomasz Maciej Nowak wrote:
>>> Hi Koen.
>>>
>>> W dniu 03.05.2018 o 11:57, Koen Vandeputte pisze:
>>>> All,
>>>>
>>>> Please skip these.
>>>> It does not apply anymore due to:   "kernel: add missing in6_dev_put_clear 
>>>> call to an ipv6 network patch"
>>>>
>>>> Also .. yet another kernel bump was released yesterday ..
>>> If You'll be doing kernel bump for 4.14.39 or later, You cane safely drop 
>>> these patches:
>>>
>>> target/linux/mvebu/patches-4.14/522-PCI-aardvark-fix-logic-in-PCI-configuration-read-write-functions.patch
>>> target/linux/mvebu/patches-4.14/523-PCI-aardvark-set-PIO_ADDR_LS-correctly-in-advk_pcie_rd_conf.patch
>>> target/linux/mvebu/patches-4.14/524-PCI-aardvark-set-host-and-device-to-the-same-MAX-payload-size.patch
>>> target/linux/mvebu/patches-4.14/525-PCI-aardvark-use-isr1-instead-of-isr0-interrupt-in-legacy-irq-mode.patch
>>> target/linux/mvebu/patches-4.14/526-PCI-aardvark-disable-LOS-state-by-default.patch
>>> target/linux/mvebu/patches-4.14/527-PCI-aardvark-fix-PCIe-max-read-request-size-setting.patch
>>>
>>> Thanks for all Your work.
>> Hi,
>> I started working on the V2 last week, and it seems not all of these were 
>> upstreamed.
>> If I have some time, I'll check it further in detail tomorrow how it should 
>> be handled.
>>
> I've gone into the details of it, also checking the online discussions 
> between the author and Bjorn Helgaas.  [1]
> 
> It seems it is still ongoing .. and the safest option according to me is to 
> keep the MPS at 128 for now, ensuring no malformed communication happens 
> between the RC and the endpoints.
> Dropping this patch would be cleaner and might very slightly improving 
> performance, but at the cost of potential communication errors with specific 
> devices.
> 
> The disable-LoS patch is similar and should also be kept for now.
> 
> 
> Please let me know if you disagree (and why :) )
> 

OK, seems I was bit to hasty. That's a valid point about those two patches. 
Given that Thomas dropped the mentioned patches in later series revision [1] 
and is working on better solution, let's keep them for now (better safe than 
sorry). 
Initially I added the whole series regarding this [2] bug report. That made the 
mini PCIe port working without kernel lockups or panics. After some of the 
patches got accepted, I removed the series and included the fixes which still 
made my cards JWX6051 (ath9k) and U7612E-H1 (mt76) working, didn't observe any 
issues. Unfortunately since the beginning my board is missing one element and 
it's not providing 1.5V to mini PCIe port, so cards requiring it do not work. 
Because of that my testing has been limited. Last week I ordered the missing 
element and at end of the week I should be ready for testing the rest of cards. 
I'll report back if those test show any difference with or without those 
patches.

1. https://www.spinics.net/lists/linux-pci/msg70774.html
2. https://bugzilla.kernel.org/show_bug.cgi?id=196339

> 
> Koen
> 
> [1] https://patchwork.kernel.org/patch/9976017/
>>>> V2 later on ..
>>>>
>>>> Koen
>>>>
>>> Cheers, Tomasz.
>>>
>>
> 
> 
> ___
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev

Regards, Tomasz.
-- 
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 2/2] kernel: bump 4.14 to 4.14.38

2018-05-06 Thread Tomasz Maciej Nowak
Hi Koen.

W dniu 03.05.2018 o 11:57, Koen Vandeputte pisze:
> All,
> 
> Please skip these.
> It does not apply anymore due to:   "kernel: add missing in6_dev_put_clear 
> call to an ipv6 network patch"
> 
> Also .. yet another kernel bump was released yesterday ..

If You'll be doing kernel bump for 4.14.39 or later, You cane safely drop these 
patches:

target/linux/mvebu/patches-4.14/522-PCI-aardvark-fix-logic-in-PCI-configuration-read-write-functions.patch
target/linux/mvebu/patches-4.14/523-PCI-aardvark-set-PIO_ADDR_LS-correctly-in-advk_pcie_rd_conf.patch
target/linux/mvebu/patches-4.14/524-PCI-aardvark-set-host-and-device-to-the-same-MAX-payload-size.patch
target/linux/mvebu/patches-4.14/525-PCI-aardvark-use-isr1-instead-of-isr0-interrupt-in-legacy-irq-mode.patch
target/linux/mvebu/patches-4.14/526-PCI-aardvark-disable-LOS-state-by-default.patch
target/linux/mvebu/patches-4.14/527-PCI-aardvark-fix-PCIe-max-read-request-size-setting.patch

Thanks for all Your work.

> V2 later on ..
> 
> Koen
> 

Cheers, Tomasz.

-- 
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-27 Thread Tomasz Maciej Nowak
W dniu 26.04.2018 o 20:04, Stijn Segers pisze:
> Op di, 24 apr 2018 om 10:18 , schreef Tomasz Maciej Nowak <tome...@o2.pl>:
>> W dniu 24.04.2018 o 22:00, Stijn Segers pisze:
>> [snip]
>>>>>
>>>>>   I'm not sure what's going wrong here, I'm on a clean master tree but 
>>>>> your first patch does not apply:
>>>>>
>>>>>   $ git am 1.patch
>>>>>   Applying: x86: add amd microcode entries to grub config
>>>>>   error: patch failed: 
>>>>> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
>>>>>   error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: patch 
>>>>> does not apply
>>>>>   error: patch failed: target/linux/x86/image/grub-iso.cfg:10
>>>>>   error: target/linux/x86/image/grub-iso.cfg: patch does not apply
>>>>>   error: patch failed: target/linux/x86/image/grub.cfg:10
>>>>>   error: target/linux/x86/image/grub.cfg: patch does not apply
>>>>>   Patch failed at 0001 x86: add amd microcode entries to grub config
>>>>>   $ ./scripts/getver.sh
>>>>>   r6755-d089a5d773
>>>>>
>>>>
>>>>  Hi.
>>>>
>>>>  I did wrongly spell myself out instead of "This series needs to be 
>>>> applied on top of 'intel-microcode: load as early as possible' series." it 
>>>> should be: "This series needs to be applied after 'intel-microcode: load 
>>>> as early as possible' series.". Sorry about it.
>>>
>>>  Nope - turns out I was too quick, my apologies :-(. I merely looked at 
>>> your first mail that actually had a patch for AMD and not at the one 
>>> preceding it (which stated I needed to apply the Intel series first). 
>>> Applied cleanly. How do I check whether it's functional? I grepped dmesg 
>>> for AMD or ucode, but nothing shows. Logread doesn't work at all (but I 
>>> reckon that's unrelated).
>>
>> You should grep -i for "microcode", it should say something like: "microcode 
>> updated early ..." probably on first line in kernel log.
>>
>> Strange thing is that logread doesn't work, but I don't know what's causing 
>> this.
> 
> Hi Thomas,
> 
> I just booted OpenWrt off my USB stick, grepping for microcode returned this:
> 
> [    2.038790] microcode: CPU0: patch_level=0x08001129
> [    2.043782] microcode: CPU1: patch_level=0x08001129
> [    2.114395] microcode: CPU2: patch_level=0x08001129
> [    2.119391] microcode: CPU3: patch_level=0x08001129
> [    2.124390] microcode: CPU4: patch_level=0x08001129
> [    2.129382] microcode: CPU5: patch_level=0x08001129
> [    2.134512] microcode: CPU6: patch_level=0x08001129
> [    2.139498] microcode: CPU7: patch_level=0x08001129
> [    2.144491] microcode: Microcode Update Driver: v2.2.
> 
> Does that help you any? Tested on a Ryzen 1800X.

Maybe Your BIOS already provides updated microcode. See this:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/cpu/microcode/amd.c#n801
for how the message should look like.

Can You show kernel messages when the microcode is not loaded (remove the lines 
in grub config) and kernel messages for the current OpenWrt snapshot with 
arm64-microcode package installed?

> 
> I reckon logread not working might have to do with my using the combined-ext4 
> image, /tmp is kinda broken as well.
> 
> Cheers
> 
> Stijn
>>
>>
>>>
>>>  Dmesg does say full retpoline support has been enabled, but unless I'm 
>>> mistaken that was a compiler feature, not something that could be solved 
>>> with microcode alone>
>>>  Cheers
>>>
>>>  Stijn
>>>
>>>
>>>
>>>>
>>>>>   Second does apply cleanly.
>>>>>
>>>>>   Cheers
>>>>>
>>>>>   Stijn
>>>>>
>> [snip]
>>
>> -- 
>> TMN
>>
>> ___
>> Lede-dev mailing list
>> Lede-dev@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev
> 


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-24 Thread Tomasz Maciej Nowak
W dniu 24.04.2018 o 22:00, Stijn Segers pisze:
[snip]
>>>
>>>  I'm not sure what's going wrong here, I'm on a clean master tree but your 
>>> first patch does not apply:
>>>
>>>  $ git am 1.patch
>>>  Applying: x86: add amd microcode entries to grub config
>>>  error: patch failed: 
>>> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
>>>  error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: patch 
>>> does not apply
>>>  error: patch failed: target/linux/x86/image/grub-iso.cfg:10
>>>  error: target/linux/x86/image/grub-iso.cfg: patch does not apply
>>>  error: patch failed: target/linux/x86/image/grub.cfg:10
>>>  error: target/linux/x86/image/grub.cfg: patch does not apply
>>>  Patch failed at 0001 x86: add amd microcode entries to grub config
>>>  $ ./scripts/getver.sh
>>>  r6755-d089a5d773
>>>
>>
>> Hi.
>>
>> I did wrongly spell myself out instead of "This series needs to be applied 
>> on top of 'intel-microcode: load as early as possible' series." it should 
>> be: "This series needs to be applied after 'intel-microcode: load as early 
>> as possible' series.". Sorry about it.
> 
> Nope - turns out I was too quick, my apologies :-(. I merely looked at your 
> first mail that actually had a patch for AMD and not at the one preceding it 
> (which stated I needed to apply the Intel series first). Applied cleanly. How 
> do I check whether it's functional? I grepped dmesg for AMD or ucode, but 
> nothing shows. Logread doesn't work at all (but I reckon that's unrelated).

You should grep -i for "microcode", it should say something like: "microcode 
updated early ..." probably on first line in kernel log.

Strange thing is that logread doesn't work, but I don't know what's causing 
this.

> 
> Dmesg does say full retpoline support has been enabled, but unless I'm 
> mistaken that was a compiler feature, not something that could be solved with 
> microcode alone> 
> Cheers
> 
> Stijn
> 
> 
> 
>>
>>>  Second does apply cleanly.
>>>
>>>  Cheers
>>>
>>>  Stijn
>>>
[snip]

-- 
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-24 Thread Tomasz Maciej Nowak
W dniu 24.04.2018 o 21:03, Stijn Segers pisze:
> Hi Tomasz,
> 
> Op di, 24 apr 2018 om 2:56 , schreef Tomasz Maciej Nowak <tome...@o2.pl>:
>> 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 <tome...@o2.pl>
>> ---
>>  .../x86/base-files/lib/preinit/02_load_x86_ucode | 12 
>>  target/linux/x86/image/grub-iso.cfg  |  3 +++
>>  target/linux/x86/image/grub.cfg  |  3 +++
>>  3 files changed, 6 insertions(+), 12 deletions(-)
>>  delete mode 100644 target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
> 
> I'm not sure what's going wrong here, I'm on a clean master tree but your 
> first patch does not apply:
> 
> $ git am 1.patch
> Applying: x86: add amd microcode entries to grub config
> error: patch failed: 
> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
> error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: patch does 
> not apply
> error: patch failed: target/linux/x86/image/grub-iso.cfg:10
> error: target/linux/x86/image/grub-iso.cfg: patch does not apply
> error: patch failed: target/linux/x86/image/grub.cfg:10
> error: target/linux/x86/image/grub.cfg: patch does not apply
> Patch failed at 0001 x86: add amd microcode entries to grub config
> $ ./scripts/getver.sh
> r6755-d089a5d773
> 

Hi.

I did wrongly spell myself out instead of "This series needs to be applied on 
top of 'intel-microcode: load as early as possible' series." it should be: 
"This series needs to be applied after 'intel-microcode: load as early as 
possible' series.". Sorry about it.

> Second does apply cleanly.
> 
> Cheers
> 
> Stijn
> 
> 
>>
>> 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 30b587bd1c..5a2d67b7b3 100644
>> --- a/target/linux/x86/image/grub-iso.cfg
>> +++ b/target/linux/x86/image/grub-iso.cfg
>> @@ -10,4 +10,7 @@ menuentry "OpenWrt" {
>>  if [ -e /boot/intel-ucode.img ]; then
>>  initrd /boot/intel-ucode.img
>>  fi
>> +    if [ -e /boot/amd-ucode.img ]; then
>> +    initrd /boot/amd-ucode.img
>> +    fi
>>  }
>> diff --git a/target/linux/x86/image/grub.cfg 
>> b/target/linux/x86/image/grub.cfg
>> index dde24b95ce..caf38ec2c4 100644
>> --- a/target/linux/x86/image/grub.cfg
>> +++ b/target/linux/x86/image/grub.cfg
>> @@ -10,6 +10,9 @@ menuentry "OpenWrt" {
>>  if [ -e /boot/intel-ucode.img ]; then
>>  initrd /boot/intel-ucode.img
>>  fi
>> +    if [ -e /boot/amd-ucode.img ]; then
>> +    initrd /boot/amd-ucode.img
>> +    fi
>>  }
>>  menuentry "OpenWrt (failsafe)" {
>>  linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
>> -- 
>> 2.17.0
>>
>>
>> ___
>> Lede-dev mailing list
>> Lede-dev@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev
> 
-- 
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 2/2] amd64-microcode: create early load microcode image

2018-04-24 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 <tome...@o2.pl>
---
 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 e88b02950f..5eecf24351 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.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH v2 5/6] x86: add intel microcode entries

2018-04-24 Thread Tomasz Maciej Nowak
Hi Stijn.

Go ahead and test it. Had to convert Makefile to use cpio instead of
$(LINUX_DIR)/usr/gen_init_cpio, because gen_init_cpio is built after
packages. The packaging of microcode follows loosely what's in
Documentation/x86/microcode.txt of kernel tree. This series needs to be
applied on top of 'intel-microcode: load as early as possible' series.

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  |  3 +++
 target/linux/x86/image/grub.cfg  |  3 +++
 4 files changed, 14 insertions(+), 14 deletions(-)
 delete mode 100644 target/linux/x86/base-files/lib/preinit/02_load_x86_ucode

-- 
2.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-24 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 <tome...@o2.pl>
---
 .../x86/base-files/lib/preinit/02_load_x86_ucode | 12 
 target/linux/x86/image/grub-iso.cfg  |  3 +++
 target/linux/x86/image/grub.cfg  |  3 +++
 3 files changed, 6 insertions(+), 12 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 30b587bd1c..5a2d67b7b3 100644
--- a/target/linux/x86/image/grub-iso.cfg
+++ b/target/linux/x86/image/grub-iso.cfg
@@ -10,4 +10,7 @@ menuentry "OpenWrt" {
if [ -e /boot/intel-ucode.img ]; then
initrd /boot/intel-ucode.img
fi
+   if [ -e /boot/amd-ucode.img ]; then
+   initrd /boot/amd-ucode.img
+   fi
 }
diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg
index dde24b95ce..caf38ec2c4 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -10,6 +10,9 @@ menuentry "OpenWrt" {
if [ -e /boot/intel-ucode.img ]; then
initrd /boot/intel-ucode.img
fi
+   if [ -e /boot/amd-ucode.img ]; then
+   initrd /boot/amd-ucode.img
+   fi
 }
 menuentry "OpenWrt (failsafe)" {
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
-- 
2.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH v2 5/6] x86: add intel microcode entries to grub config

2018-04-19 Thread Tomasz Maciej Nowak

W dniu 18.04.2018 o 00:51, Philip Prindeville pisze:

Is there a downside to forcing AMD to also do early firmware updates?


AFAIK there shouldn't be any for either methods regarding AMD. I made 
also a prototype for AMD, but as there are no downsides for current 
method and I don't have any hardware to test it, it's being left out.







On Apr 17, 2018, at 12:50 PM, Tomasz Maciej Nowak <tome...@o2.pl> wrote:

Create initrd enries for x86 images, that'll load intel microcode as
early as possible. Also restrict the late load of microcode to AMD
processors.

Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
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 cf1e1a9edf..523c07eb75 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 3d47a95a4b..30b587bd1c 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 "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -e /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 9ec6b2d39c..dde24b95ce 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -7,6 +7,9 @@ set root='(@ROOT@)'

menuentry "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -e /boot/intel-ucode.img ]; then
+   initrd /boot/intel-ucode.img
+   fi
}
menuentry "OpenWrt (failsafe)" {
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
--
2.17.0




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



--
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH v2 6/6] intel-microcode: create early load microcode image

2018-04-17 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 <tome...@o2.pl>
---
 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 d2663bb901..b0c91baabb 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
-   $(STAGING_DIR)/../host/bin/iucode_tool -q \
-   --write-firmware=$(PKG_BUILD_DIR)/intel-ucode 
$(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/* 
$(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.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH v2 5/6] x86: add intel microcode entries to grub config

2018-04-17 Thread Tomasz Maciej Nowak
Create initrd enries for x86 images, that'll load intel microcode as
early as possible. Also restrict the late load of microcode to AMD
processors.

Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
 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 cf1e1a9edf..523c07eb75 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 3d47a95a4b..30b587bd1c 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 "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -e /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 9ec6b2d39c..dde24b95ce 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -7,6 +7,9 @@ set root='(@ROOT@)'
 
 menuentry "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -e /boot/intel-ucode.img ]; then
+   initrd /boot/intel-ucode.img
+   fi
 }
 menuentry "OpenWrt (failsafe)" {
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
-- 
2.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH v2 4/6] intel-microcode: remove dependency on iucode-tool

2018-04-17 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 <tome...@o2.pl>
---
 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 1b7288fc14..d2663bb901 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.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH v2 3/6] x86: add packages files to image bootfs

2018-04-17 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 <tome...@o2.pl>
---
 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 8a3cb327e3..cf1e1a9edf 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -83,6 +83,7 @@ ifneq ($(CONFIG_GRUB_IMAGES),)
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
-e 's#@ROOT@#$(GRUB_ROOT)#g' \
./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+   -$(CP) $(STAGING_DIR)/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 \
@@ -120,6 +121,7 @@ define Image/Build/iso
-e 's#@CMDLINE@#root=/dev/sr0 rootfstype=iso9660 rootwait 
$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
./grub-iso.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+   -$(CP) $(STAGING_DIR)/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.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH v2 2/6] x86: mount writable bootfs

2018-04-17 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 <tome...@o2.pl>
---
 .../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.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH v2 0/6] intel-microcode: load as early as possible

2018-04-17 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.

1. https://lwn.net/Articles/530346
2. 
http://linux-kernel.vger.kernel.narkive.com/9XAb9Kw2/patch-v4-00-11-x86-microcode-early-load-microcode#post18
3. 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=723f2828a98c8ca19842042f418fb30dd8cfc0f7

Changes:
  - 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 sugested by Matthias Schiffer and Philip Prindeville.

Tomasz Maciej Nowak (6):
  include/rootfs.mk: move boot directory for later use
  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.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH v2 1/6] include/rootfs.mk: move boot directory for later use

2018-04-17 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 move /boot with contents
to staging directory for later processing, which in result will also
save space on target root file system.

Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
 include/rootfs.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/rootfs.mk b/include/rootfs.mk
index 76425c017a..2530fd8d07 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
+   -mv -f $(1)/boot $(STAGING_DIR)/
$(call clean_ipkg,$(1))
$(call mklibs,$(1))
 endef
-- 
2.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 3/3] intel-microcode: create early load microcode image

2018-04-11 Thread Tomasz Maciej Nowak

W dniu 11.04.2018 o 09:26, Matthias Schiffer pisze:

On 04/03/2018 03:13 PM, Tomasz Maciej Nowak wrote:

Create initrd image with packed microcode. This'll allow to load it at
early boot stage. Unfortunately the package can't install files directly
to /boot directory, therefore additional installation hooks are placed
for standalone package and when building directly into target image.





Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
  package/firmware/intel-microcode/Makefile | 32 +--
  target/linux/x86/image/Makefile   |  6 ++
  2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/package/firmware/intel-microcode/Makefile 
b/package/firmware/intel-microcode/Makefile
index d2663bb901..9970f8f072 100644
--- a/package/firmware/intel-microcode/Makefile
+++ b/package/firmware/intel-microcode/Makefile
@@ -35,15 +35,35 @@ 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
-   $(STAGING_DIR)/../host/bin/iucode_tool -q \
-   --write-firmware=$(PKG_BUILD_DIR)/intel-ucode 
$(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/* 
$(1)/lib/firmware/intel-ucode
+   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DATA) $(PKG_BUILD_DIR)/intel-ucode.cpio \
+   $(1)/lib/firmware/intel-ucode.img
+endef
+
+ifeq ($(CONFIG_PACKAGE_intel-microcode),m)


This condition is problematic: Even when the package is built into the
image, the generated ipk package should work on other systems as well; this
means the contents of the package may not depend on the m/y setting in any way.


That's a major oversight on my part, thanks.



Normally, we would deal with such cases by checking $IPKG_INSTROOT inside
the postinst script. But in this case, I'd prefer to change /boot always to
be mounted rw, so we can just get rid of the postinst/prerm scripts and
special /boot handling.


That will make things a lot less complicated.




+define Package/intel-microcode/postinst
+#!/bin/sh
+
+mount /boot -o remount,rw,noatime
+cp -f /lib/firmware/intel-ucode.img /boot/
+mount /boot -o remount,ro,noatime
+endef
+endif
+
+define Package/intel-microcode/prerm
+#!/bin/sh
+
+mount /boot -o remount,rw,noatime
+rm /boot/intel-ucode.img
+mount /boot -o remount,ro,noatime
  endef
  
  $(eval $(call BuildPackage,intel-microcode))

diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index a05f4babd9..4d6a3016d2 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -83,6 +83,9 @@ ifneq ($(CONFIG_GRUB_IMAGES),)
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
-e 's#@ROOT@#$(GRUB_ROOT)#g' \
./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+ifeq ($(CONFIG_PACKAGE_intel-microcode),y)


We should get rid of this hack too, and move everything that is found in
/boot of the rootfs into the boot partition rather than dealing with
individual packages here.


Will address all of the concerns in next version.




+   $(CP) $(STAGING_DIR)/root-x86/lib/firmware/intel-ucode.img 
$(KDIR)/root.grub/boot/
+endif
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 \
@@ -120,6 +123,9 @@ define Image/Build/iso
-e 's#@CMDLINE@#root=/dev/sr0 rootfstype=iso9660 rootwait 
$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
./grub-iso.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+  ifeq ($(CONFIG_PACKAGE_intel-microcode),y)
+   $(CP) $(STAGING_DIR)/root-x86/lib/firmware/intel-ucode.img 
$(KDIR)/root.grub/boot/
+  endif
mkisofs -R -b boot/grub/eltorito.img -no-emul-boot -boot-info-table \
-o $(KDIR)/root.iso $(KDIR)/root.grub $(TARGET_DIR)
  endef



Regards,
Matthias



Thanks for the review.

--
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] Advice on filesystem for x86 (CF card)

2018-04-11 Thread Tomasz Maciej Nowak

W dniu 11.04.2018 o 14:35, Mikael Bak pisze:

On 2018-04-11 14:11, Nishant Sharma wrote:
[snip]


I didn't know a way to expand squashfs, so decided to compile the 
image and adjusted /root size as per the size of the disk.




I'm using the Image Builder to create custom images. I can't find any 
option how to specify the size of the rootfs and/or the overlay.


Is it possible with Image Builder or must I build the whole thing from 
source?


Should be possible by editing CONFIG_TARGET_ROOTFS_PARTSIZE in .config.


 > TIA,
Mikael

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


--
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 3/3] intel-microcode: create early load microcode image

2018-04-09 Thread Tomasz Maciej Nowak

W dniu 09.04.2018 o 21:05, Philip Prindeville pisze:

Inline


On Apr 3, 2018, at 7:13 AM, Tomasz Maciej Nowak <tome...@o2.pl> wrote:

Create initrd image with packed microcode. This'll allow to load it at
early boot stage. Unfortunately the package can't install files directly
to /boot directory, therefore additional installation hooks are placed
for standalone package and when building directly into target image.

Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
package/firmware/intel-microcode/Makefile | 32 +--
target/linux/x86/image/Makefile   |  6 ++
2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/package/firmware/intel-microcode/Makefile 
b/package/firmware/intel-microcode/Makefile
index d2663bb901..9970f8f072 100644
--- a/package/firmware/intel-microcode/Makefile
+++ b/package/firmware/intel-microcode/Makefile
@@ -35,15 +35,35 @@ 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
-   $(STAGING_DIR)/../host/bin/iucode_tool -q \
-   --write-firmware=$(PKG_BUILD_DIR)/intel-ucode 
$(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/* 
$(1)/lib/firmware/intel-ucode
+   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DATA) $(PKG_BUILD_DIR)/intel-ucode.cpio \
+   $(1)/lib/firmware/intel-ucode.img
+endef
+
+ifeq ($(CONFIG_PACKAGE_intel-microcode),m)
+define Package/intel-microcode/postinst
+#!/bin/sh
+
+mount /boot -o remount,rw,noatime
+cp -f /lib/firmware/intel-ucode.img /boot/


Can we preserve the timestamp (-p) on the microcode file, too?


Will add in v2.





+mount /boot -o remount,ro,noatime
+endef
+endif
+
+define Package/intel-microcode/prerm
+#!/bin/sh
+
+mount /boot -o remount,rw,noatime
+rm /boot/intel-ucode.img



“rm -f” so that if the uninstall fails it’s idempotent and doesn’t leave things 
in a weird state.


Good catch, had this locally but sent the wrong version.





+mount /boot -o remount,ro,noatime
endef

$(eval $(call BuildPackage,intel-microcode))
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index a05f4babd9..4d6a3016d2 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -83,6 +83,9 @@ ifneq ($(CONFIG_GRUB_IMAGES),)
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
-e 's#@ROOT@#$(GRUB_ROOT)#g' \
./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+ifeq ($(CONFIG_PACKAGE_intel-microcode),y)
+   $(CP) $(STAGING_DIR)/root-x86/lib/firmware/intel-ucode.img 
$(KDIR)/root.grub/boot/
+endif



Do we need this?  Won’t the postinst happen during “make world”?


Yes it's needed, the package doesn't install files directly to /boot, 
and when executing postinst it'll naturally fail trying to mount host 
file system and stop the whole build process.


What can be changed is handling of this command, instead conditional, 
mark it as non-fatal.






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 \
@@ -120,6 +123,9 @@ define Image/Build/iso
-e 's#@CMDLINE@#root=/dev/sr0 rootfstype=iso9660 rootwait 
$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
./grub-iso.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+  ifeq ($(CONFIG_PACKAGE_intel-microcode),y)
+   $(CP) $(STAGING_DIR)/root-x86/lib/firmware/intel-ucode.img 
$(KDIR)/root.grub/boot/
+  endif



Ditto.
>

mkisofs -R -b boot/grub/eltorito.img -no-emul-boot -boot-info-table \
-o $(KDIR)/root.iso $(KDIR)/root.grub $(TARGET_DIR)
endef
--
2.16.3





___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 2/3] x86: add intel microcode entries to grub config

2018-04-09 Thread Tomasz Maciej Nowak

W dniu 09.04.2018 o 21:00, Philip Prindeville pisze:

Inline.  Has this been tested with UEFI?


No, I don't have any UEFI system which can be employed for testing.





On Apr 3, 2018, at 7:13 AM, Tomasz Maciej Nowak <tome...@o2.pl> wrote:

Create initrd enries for x86 images, that'll load intel microcode as
early as possible. Also restrict the late load of microcode to AMD
processors.

Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
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..68ebdf8651 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 -c AuthenticAMD /proc/cpuinfo)" -gt "0" ]; then



Way too complicated.  Try:

if grep -q AuthenticAMD /proc/cpuinfo; then

instead.  -q inhibits output, and instead you get true for having matches, and 
false for no matches.


Thanks, will change in v2.





+   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 8a3cb327e3..a05f4babd9 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



What is “test” in this case?


GRUB module for shell-like tests, used in grub-iso.cfg and grub-cfg see 
below.






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 3d47a95a4b..30b587bd1c 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 "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -e /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 9ec6b2d39c..dde24b95ce 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -7,6 +7,9 @@ set root='(@ROOT@)'

menuentry "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -e /boot/intel-ucode.img ]; then
+   initrd /boot/intel-ucode.img
+   fi
}
menuentry "OpenWrt (failsafe)" {
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
--
2.16.3




Thank You for the review.

--
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 3/3] intel-microcode: create early load microcode image

2018-04-03 Thread Tomasz Maciej Nowak
Create initrd image with packed microcode. This'll allow to load it at
early boot stage. Unfortunately the package can't install files directly
to /boot directory, therefore additional installation hooks are placed
for standalone package and when building directly into target image.

Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
 package/firmware/intel-microcode/Makefile | 32 +--
 target/linux/x86/image/Makefile   |  6 ++
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/package/firmware/intel-microcode/Makefile 
b/package/firmware/intel-microcode/Makefile
index d2663bb901..9970f8f072 100644
--- a/package/firmware/intel-microcode/Makefile
+++ b/package/firmware/intel-microcode/Makefile
@@ -35,15 +35,35 @@ 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
-   $(STAGING_DIR)/../host/bin/iucode_tool -q \
-   --write-firmware=$(PKG_BUILD_DIR)/intel-ucode 
$(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/* 
$(1)/lib/firmware/intel-ucode
+   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DATA) $(PKG_BUILD_DIR)/intel-ucode.cpio \
+   $(1)/lib/firmware/intel-ucode.img
+endef
+
+ifeq ($(CONFIG_PACKAGE_intel-microcode),m)
+define Package/intel-microcode/postinst
+#!/bin/sh
+
+mount /boot -o remount,rw,noatime
+cp -f /lib/firmware/intel-ucode.img /boot/
+mount /boot -o remount,ro,noatime
+endef
+endif
+
+define Package/intel-microcode/prerm
+#!/bin/sh
+
+mount /boot -o remount,rw,noatime
+rm /boot/intel-ucode.img
+mount /boot -o remount,ro,noatime
 endef
 
 $(eval $(call BuildPackage,intel-microcode))
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index a05f4babd9..4d6a3016d2 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -83,6 +83,9 @@ ifneq ($(CONFIG_GRUB_IMAGES),)
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
-e 's#@ROOT@#$(GRUB_ROOT)#g' \
./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+ifeq ($(CONFIG_PACKAGE_intel-microcode),y)
+   $(CP) $(STAGING_DIR)/root-x86/lib/firmware/intel-ucode.img 
$(KDIR)/root.grub/boot/
+endif
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 \
@@ -120,6 +123,9 @@ define Image/Build/iso
-e 's#@CMDLINE@#root=/dev/sr0 rootfstype=iso9660 rootwait 
$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
./grub-iso.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+  ifeq ($(CONFIG_PACKAGE_intel-microcode),y)
+   $(CP) $(STAGING_DIR)/root-x86/lib/firmware/intel-ucode.img 
$(KDIR)/root.grub/boot/
+  endif
mkisofs -R -b boot/grub/eltorito.img -no-emul-boot -boot-info-table \
-o $(KDIR)/root.iso $(KDIR)/root.grub $(TARGET_DIR)
 endef
-- 
2.16.3


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 2/3] x86: add intel microcode entries to grub config

2018-04-03 Thread Tomasz Maciej Nowak
Create initrd enries for x86 images, that'll load intel microcode as
early as possible. Also restrict the late load of microcode to AMD
processors.

Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
 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..68ebdf8651 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 -c AuthenticAMD /proc/cpuinfo)" -gt "0" ]; 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 8a3cb327e3..a05f4babd9 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 3d47a95a4b..30b587bd1c 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 "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -e /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 9ec6b2d39c..dde24b95ce 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -7,6 +7,9 @@ set root='(@ROOT@)'
 
 menuentry "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
+   if [ -e /boot/intel-ucode.img ]; then
+   initrd /boot/intel-ucode.img
+   fi
 }
 menuentry "OpenWrt (failsafe)" {
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
-- 
2.16.3


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 1/3] intel-microcode: remove dependency on iucode-tool

2018-04-03 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 <tome...@o2.pl>
---
 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 1b7288fc14..d2663bb901 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.16.3


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [RFC PATCH 0/3] intel-microcode: load as early as possible

2018-04-03 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.

1. https://lwn.net/Articles/530346
2. 
http://linux-kernel.vger.kernel.narkive.com/9XAb9Kw2/patch-v4-00-11-x86-microcode-early-load-microcode#post18
3. 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=723f2828a98c8ca19842042f418fb30dd8cfc0f7

Tomasz Maciej Nowak (3):
  intel-microcode: remove dependency on iucode-tool
  x86: add intel microcode entries to grub config
  intel-microcode: create early load microcode image

 package/firmware/intel-microcode/Makefile  | 34 +-
 .../x86/base-files/lib/preinit/02_load_x86_ucode   |  6 ++--
 target/linux/x86/image/Makefile| 10 +--
 target/linux/x86/image/grub-iso.cfg|  3 ++
 target/linux/x86/image/grub.cfg|  3 ++
 5 files changed, 45 insertions(+), 11 deletions(-)

-- 
2.16.3


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 2/2] mvebu: new subtarget cortex A53

2018-03-07 Thread Tomasz Maciej Nowak
This commit introduces new subtarget for Marvell EBU Armada Cortex A53
processor based devices.

The first device is Globalscale ESPRESSObin. Some hardware specs:

SoC: Marvell Armada 3700LP (88F3720) dual core ARM Cortex A53
 processor up to 1.2GHz
RAM: 512MB, 1GB or 2GB DDR3
Storage: SATA interface
 µSD card slot with footprint for an optional 4GB EMMC
 4MB SPI NOR flash for bootloader
Ethernet: Topaz Networking Switch (88E6341) with 3x GbE ports
Connectors: USB 3.0
USB 2.0
µUSB port connected to PL2303SA (USB to serial bridge
controller) for UART access
Expansion: 2x 46-pin GPIO headers for accessories and shields with
   I2C, GPIOs, PWM, UART, SPI, MMC, etc
   MiniPCIe slot
Misc: Reset button, JTAG interface

Currently booting only from µSD card is supported.
The boards depending on date of dispatch can come with various U-Boot
versions. For the newest version 2017.03-armada-17.10 no manual
intervention should be needed to boot OpenWrt image. For the older ones
it's necessary to modify default U-Boot environment:

 1. Interrupt boot process to run U-Boot command line,

 2. Run following commands:
(for version 2017.03-armada-17.06 and 2017.03-armada-17.08)
 setenv bootcmd "load mmc 0:1 0x4d0 boot.scr; source 0x4d0"
 saveenv

(for version 2015.01-armada-17.02 and 2015.01-armada-17.04)
 setenv bootargs "console=ttyMV0,115200 root=/dev/mmcblk0p2 rw rootwait"
 setenv bootcmd "ext4load mmc 0:1 ${fdt_addr} armada-3720-espressobin.dtb; 
ext4load mmc 0:1 ${kernel_addr} Image; booti ${kernel_addr} - ${fdt_addr}"
 saveenv

 3. Poweroff, insert SD card with OpenWrt image, boot and enjoy.

Signed-off-by: Tomasz Maciej Nowak <tome...@o2.pl>
---
 target/linux/mvebu/Makefile|   4 +-
 .../linux/mvebu/base-files/etc/board.d/02_network  |   3 +
 target/linux/mvebu/base-files/lib/mvebu.sh |   3 +
 .../linux/mvebu/base-files/lib/upgrade/platform.sh |   4 +-
 target/linux/mvebu/config-4.14 |   1 +
 target/linux/mvebu/cortexa53/config-default| 119 
 target/linux/mvebu/cortexa53/target.mk |  15 +
 target/linux/mvebu/image/Makefile  |  26 +-
 target/linux/mvebu/image/cortex-a53.mk |  16 ++
 .../mvebu/image/globalscale-espressobin.bootscript |  10 +
 ...mvebu-armada-37xx-periph-cosmetic-changes.patch |  78 +
 ...rmada-37xx-periph-prepare-cpu-clk-to-be-u.patch | 178 
 ...rmada-37xx-periph-add-DVFS-support-for-cp.patch | 315 +
 ...-cpufreq-Add-DVFS-support-for-Armada-37xx.patch | 297 +++
 ...hange-SPI-mode-before-asserting-chip-sele.patch |  70 +
 ...dts-marvell-Fix-A37xx-UART0-register-size.patch |  39 +++
 ...64-dts-marvell-armada-37xx-add-UART-clock.patch |  27 ++
 ...arvell-armada-37xx-add-nodes-allowing-cpu.patch |  48 
 ...m64-dts-marvell-armada37xx-Add-eth0-alias.patch |  20 ++
 ...521-esporessobin-dt-enable-spi-nor-on-i2c.patch |  29 ++
 ...in-PCI-configuration-read-write-functions.patch |  66 +
 ...IO_ADDR_LS-correctly-in-advk_pcie_rd_conf.patch |  53 
 ...t-and-device-to-the-same-MAX-payload-size.patch | 137 +
 ...tead-of-isr0-interrupt-in-legacy-irq-mode.patch | 143 ++
 ...PCI-aardvark-disable-LOS-state-by-default.patch |  55 
 ...rk-fix-PCIe-max-read-request-size-setting.patch |  63 +
 26 files changed, 1813 insertions(+), 6 deletions(-)
 create mode 100644 target/linux/mvebu/cortexa53/config-default
 create mode 100644 target/linux/mvebu/cortexa53/target.mk
 create mode 100644 target/linux/mvebu/image/cortex-a53.mk
 create mode 100644 target/linux/mvebu/image/globalscale-espressobin.bootscript
 create mode 100644 
target/linux/mvebu/patches-4.14/500-clk-mvebu-armada-37xx-periph-cosmetic-changes.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/501-clk-mvebu-armada-37xx-periph-prepare-cpu-clk-to-be-u.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/502-clk-mvebu-armada-37xx-periph-add-DVFS-support-for-cp.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/503-cpufreq-Add-DVFS-support-for-Armada-37xx.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/504-spi-a3700-Change-SPI-mode-before-asserting-chip-sele.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/505-arm64-dts-marvell-Fix-A37xx-UART0-register-size.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/506-arm64-dts-marvell-armada-37xx-add-UART-clock.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/507-arm64-dts-marvell-armada-37xx-add-nodes-allowing-cpu.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/520-arm64-dts-marvell-armada37xx-Add-eth0-alias.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/521-esporessobin-dt-enable-spi-nor-on-i2c.patch
 create mode 100644 
target/linux/mvebu/patches-4.14/522-PCI-aardvark-fix-logic-in-PCI-configuration-rea

[LEDE-DEV] [PATCH 1/2] mvebu: add subtarget for cortex A9 build

2018-03-07 Thread Tomasz Maciej Nowak
From: Hauke Mehrtens 

This is in preparation for adding a subtarget for the Cortex A53 later.

Signed-off-by: Hauke Mehrtens 
---
 package/boot/uboot-mvebu/Makefile |   1 +
 target/linux/mvebu/Makefile   |   6 +-
 target/linux/mvebu/cortexa9/target.mk |  14 
 target/linux/mvebu/image/Makefile | 137 +--
 target/linux/mvebu/image/cortex-a9.mk | 148 ++
 5 files changed, 165 insertions(+), 141 deletions(-)
 create mode 100644 target/linux/mvebu/cortexa9/target.mk
 create mode 100644 target/linux/mvebu/image/cortex-a9.mk

diff --git a/package/boot/uboot-mvebu/Makefile 
b/package/boot/uboot-mvebu/Makefile
index 2c280faa21..53abcafda0 100644
--- a/package/boot/uboot-mvebu/Makefile
+++ b/package/boot/uboot-mvebu/Makefile
@@ -24,6 +24,7 @@ endef
 define U-Boot/clearfog
   NAME:=SolidRun ClearFog A1
   BUILD_DEVICES:=armada-388-clearfog-base armada-388-clearfog-pro
+  BUILD_SUBTARGET:=cortexa9
   UBOOT_IMAGE:=u-boot-spl.kwb
 endef
 
diff --git a/target/linux/mvebu/Makefile b/target/linux/mvebu/Makefile
index 6f0c1925c2..490583fb39 100644
--- a/target/linux/mvebu/Makefile
+++ b/target/linux/mvebu/Makefile
@@ -6,20 +6,16 @@
 #
 include $(TOPDIR)/rules.mk
 
-ARCH:=arm
 BOARD:=mvebu
 BOARDNAME:=Marvell Armada 37x/38x/XP
 FEATURES:=fpu usb pci pcie gpio nand squashfs
-CPU_TYPE:=cortex-a9
-CPU_SUBTYPE:=vfpv3
+SUBTARGETS:=cortexa9
 MAINTAINER:=Imre Kaloz 
 
 KERNEL_PATCHVER:=4.14
 
 include $(INCLUDE_DIR)/target.mk
 
-KERNELNAME:=zImage dtbs
-
 DEFAULT_PACKAGES += uboot-envtools kmod-gpio-button-hotplug
 
 $(eval $(call BuildTarget))
diff --git a/target/linux/mvebu/cortexa9/target.mk 
b/target/linux/mvebu/cortexa9/target.mk
new file mode 100644
index 00..2a75599bc9
--- /dev/null
+++ b/target/linux/mvebu/cortexa9/target.mk
@@ -0,0 +1,14 @@
+#
+# Copyright (C) 2017 Hauke Mehrtens
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+ARCH:=arm
+BOARDNAME:=Marvell Armada 37x/38x/XP
+CPU_TYPE:=cortex-a9
+CPU_SUBTYPE:=vfpv3
+KERNELNAME:=zImage dtbs
diff --git a/target/linux/mvebu/image/Makefile 
b/target/linux/mvebu/image/Makefile
index 68adfc3ddd..1ed9c39f00 100644
--- a/target/linux/mvebu/image/Makefile
+++ b/target/linux/mvebu/image/Makefile
@@ -89,141 +89,6 @@ define Device/NAND-512K
   PAGESIZE := 4096
 endef
 
-define Device/linksys
-  DEVICE_TITLE := Linksys $(1)
-  DEVICE_PACKAGES := kmod-mwlwifi wpad-mini swconfig
-endef
-
-define Device/armada-385-linksys
-  $(Device/NAND-128K)
-  $(Device/UBI-factory)
-  KERNEL_SIZE := 6144k
-endef
-
-define Device/linksys-wrt1200ac
-  $(call Device/linksys,WRT1200AC (Caiman))
-  $(Device/armada-385-linksys)
-  DEVICE_DTS := armada-385-linksys-caiman
-  DEVICE_PACKAGES += mwlwifi-firmware-88w8864
-endef
-TARGET_DEVICES += linksys-wrt1200ac
-
-define Device/linksys-wrt1900acv2
-  $(call Device/linksys,WRT1900ACv2 (Cobra))
-  $(Device/armada-385-linksys)
-  DEVICE_DTS := armada-385-linksys-cobra
-  DEVICE_PACKAGES += mwlwifi-firmware-88w8864
-endef
-TARGET_DEVICES += linksys-wrt1900acv2
-
-define Device/linksys-wrt3200acm
-  $(call Device/linksys,WRT3200ACM (Rango))
-  $(Device/armada-385-linksys)
-  DEVICE_DTS := armada-385-linksys-rango
-  DEVICE_PACKAGES += kmod-btmrvl kmod-mwifiex-sdio mwlwifi-firmware-88w8964
-endef
-TARGET_DEVICES += linksys-wrt3200acm
-
-define Device/linksys-wrt1900acs
-  $(call Device/linksys,WRT1900ACS (Shelby))
-  $(Device/armada-385-linksys)
-  DEVICE_DTS := armada-385-linksys-shelby
-  DEVICE_PACKAGES += mwlwifi-firmware-88w8864
-endef
-TARGET_DEVICES += linksys-wrt1900acs
-
-define Device/linksys-wrt1900ac
-  $(call Device/linksys,WRT1900AC (Mamba))
-  DEVICE_DTS := armada-xp-linksys-mamba
-  DEVICE_PACKAGES += mwlwifi-firmware-88w8864
-  $(Device/NAND-128K)
-  $(Device/UBI-factory)
-  KERNEL_SIZE := 3072k
-endef
-TARGET_DEVICES += linksys-wrt1900ac
-
-define Device/openblocks-ax3-4
-  $(Device/UBI-factory)
-  DEVICE_DTS := armada-xp-openblocks-ax3-4
-  SUPPORTED_DEVICES := $(1)
-  BLOCKSIZE := 128k
-  PAGESIZE := 1
-  IMAGE/factory.img := append-kernel | pad-to $$(BLOCKSIZE) | append-ubi
-  DEVICE_TITLE := Plat'Home OpenBlocks AX3
-endef
-TARGET_DEVICES += openblocks-ax3-4
-
-define Device/armada-385-db-ap
-  $(Device/NAND-256K)
-  $(Device/UBI-factory)
-  KERNEL_SIZE := 8192k
-  DEVICE_TITLE := Marvell Armada 385 DB AP (DB-88F6820-AP)
-endef
-TARGET_DEVICES += armada-385-db-ap
-
-define Device/marvell-nand
-  $(Device/NAND-512K)
-  DEVICE_TITLE := Marvell Armada $(1)
-endef
-
-define Device/armada-370-db
-   $(call Device/marvell-nand,370 DB (DB-88F6710-BP-DDR3))
-endef
-TARGET_DEVICES += armada-370-db
-
-define Device/armada-370-rd
-   $(call Device/marvell-nand,370 RD (RD-88F6710-A1))
-endef
-TARGET_DEVICES += armada-370-rd
-
-define Device/armada-xp-db
-   $(call Device/marvell-nand,XP DB 

Re: [LEDE-DEV] Espressobin mvebu64

2018-01-08 Thread Tomasz Maciej Nowak
Hi,

2018-01-06 12:12 GMT+01:00, Nishant Sharma :
> Hi Hauke,
>
> On Friday 05 January 2018 11:33 PM, Hauke Mehrtens wrote:
>> I have never looked at the OpenWrt fork provided by Marvell, but I got
>> OpenWrt master working on the espressobin with kernel 4.14. It only has
>> a low number of patches mainly for the other mvebu broads and for sfp
>> support.
>>
>> You can find my git tree here:
>> https://git.lede-project.org/?p=openwrt/staging/hauke.git;a=shortlog;h=refs/heads/mvebu-4.14
>>
>> Tomasz did some additional extensions to it see here:
>> https://github.com/tmn505/source/commits/espressobin
>
> That sounds great!
>
> I will try building both of them and report back.
>
> Is the built 64 bits? Any tentative plans to bring it to mainstream
> OpenWrt please?
>
> Regards,
> Nishant
>

I updated my tree from the previous time You probably saw it. Most of
the features are complete. It requires to edit U-Boot environment with
this value:
bootcmd=load mmc 0:1 0x4d0 boot.scr; source 0x4d0
With that it should boot without manual intervention.

What is left out:
a) mini PCIe shouldn't work ATM here are some patches:
https://patchwork.ozlabs.org/cover/819585
You should omit the last one,
b) booting from other mediums than SD card,
c) sysupgrade on other mediums than SD card.

I'll appreciate any feedback.

-- 
Regards, Tomasz

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev